Yup, thanks! This worked!
Sorry for not returning for so long with a fix. Life happened.
I’m also deeply sorry @mrjackphil , I’m NOT trying to one-up you, and I pretty much love how your implementation works. However, in the meantime, I had also updated and expanded my solution. I’d love it if you took ideas (or even copy-pasted stuff as it is) to also expand your solution, if you find anything I’ve added useful. Except if, maybe, you’d like a collaboration?
I know how to use Github, but I’m not much into it, so, feel free to take anything you need from here and implement it in your solution.
That said…
Drummroll please…
Here’s the new version.
Things added:
-
It now uses an INI file, where it temporarily stores the last note ('s path) you’ve worked on.
-
This wouldn’t be useful without a new “Load Previous Note” button, at the very top, that allows you to keep adding stuff to the last note you’ve worked on.
-
Two new buttons - that use the same INI file - for independently saving and loading a set of tags. That’s useful if you want to take a stream of quick notes, but use the same tags on all of them to assist in organization in Obsidian.
-
A non-working Word Count feature. Hey, I tried, failed, and had no time to really look into it. If anyone can fix it, I’m game - and many kudos to you!
Anyways. Here it is, and I hope you find it useful:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;___________________________________________________________________________________________________
; QuickNotes
; ----------
; The quickest way to take plaintext (or Markdown) notes.
; Variables: User-editable
; ------------------------
NotesPath = C:\ENTER_FULL_PATH\TO_YOUR_OBSIDIAN\NOTES_INBOX_HERE
QuickNotesSettings = %A_ScriptDir%\QuickNotes_Settings.ini
; Feel free to set the above "QuickNotes_Settings.ini" to any name you wish.
; By the way, I don't include the file 'cause it's initially empty. It's only used as temp storage.
WordCount = 0
SetBatchLines -1
;Pop-up window in 2nd monitor if available:
SysGet, ScreenNumber, MonitorCount
If (ScreenNumber > 1)
{
SysGet, Mon2, Monitor, 2
SmartWindowPlacement := (Mon2Left +1)
}
If (ScreenNumber = 1)
{
SysGet, MonitorPrimary, MonitorPrimary
SmartWindowPlacement := (MonitorPrimaryRight - 810)
}
;GUI code
Gui, QuickNotes:Add, Button, x5 y2 w555 h22 gLoadNote, Load Previous Note
Gui, QuickNotes:Add, Edit, x5 y25 w555 h50 vTitle, Title - Filename
Gui, QuickNotes:Add, Edit, x5 y80 w555 h500 vNote, %Clipboard%
;Gui, QuickNotes:Add, Edit, x5 y585 w555 h100 vTags, Tags
Gui, QuickNotes:Add, Edit, x5 y585 w455 h100 vTags, Tags
Gui, QuickNotes:Add, Button, x460 y585 w100 h50 gSaveTags, Save Tags
Gui, QuickNotes:Add, Button, x460 y635 w100 h50 gLoadTags, Load Tags
Gui, QuickNotes:Add, Button, x5 y690 w555 h60 Default, OK
Gui, QuickNotes:Add, Button, x5 y755 w555 h30, Cancel
Gui, QuickNotes:Add, Text, vWordCount x5 y790, Words`: %WordCount%
Gui, QuickNotes:Show, x%SmartWindowPlacement% y0 w565 h830, QuickNotes
return
;QuickNotes Functions
LoadNote:
IniRead, FinalFilename, %QuickNotesSettings%, Files, Working File
IniRead, Tags, %QuickNotesSettings%, Organization, Tags
IniRead, Title, %QuickNotesSettings%, Organization, Title
FileRead, FileContent, %FinalFilename%
Note = %FileContent%
GuiControl, QuickNotes:, Note, %Note%
GuiControl, QuickNotes:, Tags, %Tags%
GuiControl, QuickNotes:, Title, %Title%
return
SaveTags:
Gui, QuickNotes: Submit, NoHide
GuiControlGet, Tags
FileEncoding, UTF-8-RAW
IniWrite, %Tags%, %QuickNotesSettings%, Organization, StandaloneTags
return
LoadTags:
IniRead, Tags, %QuickNotesSettings%, Organization, StandaloneTags
GuiControl, QuickNotes:, Tags, %Tags%
return
QuickNotesButtonOK:
FormatTime, TimeString, %DateTime%, hh:mm dddd, dd-MM-yy
Gui, QuickNotes:Submit
FileEncoding, UTF-8-RAW
TempClipboard = %ClipBoard%
sleep, 50
ClipBoard = %Title%
sleep, 50
RunWait %A_ScriptDir%\clean_characters3.ahk
sleep, 50
FileName = %ClipBoard%
sleep, 50
ClipBoard = %TempClipboard%
sleep, 50
NoteFormat = `# %Title%`n- - -`n**Link: **`n**Tags:** `[%Tags%`]`n**Time:** %TimeString%`n`n**Notes: **`n- - -`n`n%Note%
FinalFilename = %NotesPath%\%FileName%.md
FileAppend, %NoteFormat%, %FinalFileName%
sleep, 50
GuiControlGet, Tags
GuiControlGet, Title
IniWrite, %FinalFilename%, %QuickNotesSettings%, Files, Working File
IniWrite, %Tags%, %QuickNotesSettings%, Organization, Tags
IniWrite, %Title%, %QuickNotesSettings%, Organization, Title
ExitApp
return
QuickNotesButtonCancel:
Gui, QuickNotes:Submit
FormatTime, TimeString, %DateTime%, hh:mm dddd, dd-MM-yy
Clipboard = `# %Title%`n- - -`n**Link: **`n**Tags:** `[%Tags%`]`n**Time:** %TimeString%`n`n**Notes: **`n- - -`n`n%Note%
sleep, 50
ExitApp
return
QuickNotesGuiEscape:
Gui, QuickNotes:Submit
FormatTime, TimeString, %DateTime%, hh:mm dddd, dd-MM-yy
Clipboard = `# %Title%`n- - -`n**Link: **`n**Tags:** `[%Tags%`]`n**Time:** %TimeString%`n`n**Notes: **`n- - -`n`n%Note%
sleep, 50
ExitApp
return
QuickNotesGuiClose:
Gui, QuickNotes:Submit
Clipboard = `# %Title%`n- - -`n**Link: **`n**Tags:** `[%Tags%`]`n**Time:** %TimeString%`n`n**Notes: **`n- - -`n`n%Note%
sleep, 50
ExitApp
return
As I said, don’t bash me, I know it sucks - I’m no coder, and I’m only using AHK for my own automation needs (and making some mini-apps like this one).
Extra Note
I’m on an ancient PC with a Core i7 2600K, a GTX 970, and 8GBs of RAM. Those “sleep, NUMBER” lines add delays to the script, without which it sometimes borks on me. MAYBE, though, that’s because of my ancient and slow PC, and you can skip them to make this QuickNotes solution even… errr… quicker… yes. That. To test if it works for you, add a “;” character (without the quotes) at the beginning of every “sleep, NUMBER” line. Then save the script and run it. Did it blend? Er… Work? Keep it like that! Did it bork? Re-add the delays.
I’m up for other ideas and suggestions, but I’m NOT planning to expand this into a full-blown note-taking solution. Nor support MarkDown, or include a full text editor. There are alternatives for that. However, they’re also more complicated, “heavier”, and less easy to use. This is a straightforward TXT note-taking solution. Nothing more, nothing less.
Extra-Extra Note
Default hotkey for taking a new note is Windows Key + ` (“The Tilde Key” on the top left of the English default QWERTY keyboard setup).
Hidden Features
-
I work on two monitors, one 1920x1200 and one 1920x1080. If the script detects two monitors, it changes the window’s pop-up coordinates to “horizontal resolution of first monitor +1”. This makes it appear at the top left of the second screen, right next to the primary one. You can play with the “Pop-up window in 2nd monitor if available” section to tweak how this works. If, however, there’s only one monitor, the window is set to appear on Monitor’s-Right-Edge-Minus-810-pixels. In other words, on the right of the screen (I’m subtracting the window’s width from the monitor’s horizontal resolution).
-
I saved the best for last - although it was the simplest to implement, it makes a world of difference for my note-taking, and I guess it will help others, too: the note’s body is automatically populated with the Clipboard! This means that you can copy something from your browser to the clipboard, then “call” this QuickNotes thingy, and what you copied will appear in the main note section. Add a title, maybe some extra notes and tags, and your note’s ready 
That’s all for now, and sorry for the long post - and even longer absence. Blame life 
IMPORTANT UPDATE!
Doh! I forgot! This also uses an extra script I wrote to clean the title - that’s also used as a filename - from “strange” characters. It’s the following one. Either save it in the same directory as the QuickNotes script with the name “clean_characters3.ahk”, or name it however you wish but then find any reference to “clean_characters3” in the QuickNotes script and change it to the name you used.
You could alternatively implement this as an extra function in the same script, but I keep it separate 'cause I’m also using it for other… er…eh… “solutions” of mine.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
CleanMePlease = %ClipBoard%
;MsgBox, CleanMePlease set as %CleanMePlease%
CleanMePlease := Regexreplace(CleanMePlease, "[^a-zA-Z0-9]", " ")
loop
{
StringReplace, CleanMePlease, CleanMePlease, %A_SPACE%%A_SPACE%, %A_SPACE%, all
if ErrorLevel <> 0
break
}
;MsgBox, CleanMePlease is now %CleanMePlease%
ClipBoard = %CleanMePlease%
Sorry for forgetting to post it before.