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.