In the recent update, Evernote has come up with a quite note-taking addon which sits in the system tray and pops up on clicking Ctrl+Alt+H. Would it be possible to have something similar for Obsidian enabling us to take quite notes and stays over other applications like a Sticky Note.
Yes this would be highly useful for me too. I have mainly been using OneNote before and it comes with a Quick Note keyboard shortcut (Win+N) which I use very often I would like to do something similar with Obsidian.
If thatās interesting for anyone, I can create a solution for that with AutoHotKey. Iād created a similar ultra-simple-quick-note-taking solution in the past, that basically displayed a window with three boxes: Title, main text, tags. When you clicked on a SAVE button, it was saved in a predefined, hard-coded path (but since AHK scripts are text-editable, it was changeable with any text editor). I can basically re-purpose it to remove any useless fluff I used, and upload it somewhere as ājust thatā. It wouldnāt open Obsidianās editor, but at the same time, thatās not the point of any āquick note takingā solution.
would you mind sharing the ahk code? thanks
I canāt find the particular file right now, but this older version looks close enough. Save it in an AHK file and replace the ā;ā in front of the script-lines for it to work. If I remember correctly, this should save anything copied to the clipboard to a note when pressing Windows Key + C at the same time⦠but I could be mistaken, and Iām working in a restricted computer where I canāt actually check and run it now. Sorry about that.
;#c::
;vFileName=I:\00_Cloud_Storage\Dropbox\ody_notes.txt
;fileencoding, UTF-8
;Send, ^c
;ClipWait, 5
;MsgBox, 1, ClipNotes, ClipNotes Loop Mode On, 5
;Loop,
;{
;ClipWait, 600
;MsgBox, 4, Copied, %Clipboard%,`nWrite to file and Go on?
;IfMsgBox Yes
;{
;FileAppend, `n%Clipboard%, %vFileName%
;Clipboard =
;}
;else
;return
;}
;return
OK, the above sucked and was a sub-par version of what I was using. Since thousands of people (har-har) asked for this, and it would also be useful for me, Iāve sat down and re-implemented it from scratch. I couldnāt find the old file, so, Iāve written a new script that performs the same function, more or less.
HOWEVERā¦
Since this is also saving notes, it has to respect filesystem restrictions. So, Iāve tapped into a secondary script Iām using that cleans text from any āweirdā characters. You should copy both, save the first, main script with whatever name you wish, and then save the second one as āclean_characters3.ahkā. The way Iām using it, this secondary script is in a āToolsā subdirectory. If you save both in the same directory, make sure to edit the main script to reflect that. The line with the path to the secondary āclean_characters3.ahkā script is:
RunWait %A_ScriptDir%\Tools\clean_characters3.ahk
Remove the āToolsā part if you wonāt save the script in a Tools subdirectory, and change its name if you donāt go for āclean_characters3.ahkā.
You should also change theā¦:
NotesPath = I:\00_Cloud_Storage\Dropbox\Notes\Obsidian\Duckland\!Inbox
ā¦line to reflect your own vaultās inbox folder. For example, it could be:
NotesPath = C:\notes\obsidian_vaults\DirtyNotes\IwasabadboySanta
Now, on with the show.
Script 1 - main one, for notes:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
; Made with assistance by AutoGUI 2.6.2
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetBatchLines -1
;_________________________________________________________________________( START! )____
;CTRL = ^, SHIFT = +, ALT = !, WINDOWS KEY = #
;________________________________________________________________( Variables Setup )____
;___________________________________________________________________( GUI Creation )____
#`::
Gui, 2:Add, Edit, x5 y5 w555 h50 vTitle, Title - Filename
Gui, 2:Add, Edit, x5 y60 w555 h500 vNote, %Clipboard%
Gui, 2:Add, Edit, x5 y565 w555 h100 vTags, Tags
Gui, 2:Add, Button, x5 y670 w555 h60 Default, OK
Gui, 2:Add, Button, x5 y735 w555 h30, Cancel
Gui, 2:Show, w565 h770, QuickNotes
Return
2ButtonOK:
NotesPath = I:\00_Cloud_Storage\Dropbox\Notes\Obsidian\Duckland\!Inbox
FormatTime, TimeString, %DateTime%, hh:mm dddd, dd-MM-yy
Gui, 2:Submit
FileEncoding, UTF-8
TempClipboard = %ClipBoard%
sleep, 50
ClipBoard = %Title%
sleep, 50
RunWait %A_ScriptDir%\Tools\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%Note%
FinalFilename = %NotesPath%\%FileName%.md
FileAppend, %NoteFormat%, %FinalFileName%
sleep, 50
Reload
Sleep 1000 ; If successful, the reload will close this instance during the Sleep, so the line below will never be reached.
MsgBox, 4,, The script could not be reloaded. Would you like to open it for editing?
IfMsgBox, Yes, Edit
return
2ButtonCancel:
Gui, 2: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%Note%
sleep, 50
Gui, 2:Destroy
return
2GuiEscape:
Gui, 2: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%Note%
sleep, 50
Gui, 2:Destroy
return
2GuiClose:
Gui, 2:Submit
Clipboard = `# %Title%`n- - -`n**Link: **`n**Tags:** `[%Tags%`]`n**Time:** %TimeString%`n`n**Notes: **`n- - -`n%Note%
sleep, 50
Gui, 2:Destroy
return
return
Script 2 - secondary, called to remove weird characters from the filename.
#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%
CleanMePlease := Regexreplace(CleanMePlease, "[^a-zA-Z0-9]", " ")
loop
{
StringReplace, CleanMePlease, CleanMePlease, %A_SPACE%%A_SPACE%, %A_SPACE%, all
if ErrorLevel <> 0
break
}
ClipBoard = %CleanMePlease%
How it works
Press Windows Key + ` (that-button-left-of-one-over-Tab) at the same time and the QuickNotes window will pop-up. You can enter a title, main text - which will be pre-populated with anything that was already in the Clipboard, and tags.
When the note is saved, itās styled according to a template Iām using. The noteās structure and contents are defined in:
NoteFormat = `# %Title%`n- - -`n**Link: **`n**Tags:** `[%Tags%`]`n**Time:** %TimeString%`n`n**Notes: **`n- - -`n%Note%
Itās easy to decipher what this does if you save a note with the script, then open it and check the line above. Iām just adding some titles and markdown in the content, saving the note with its cleaned-up version of its title as its filename, and then structure it as:
# Title
- - -
**Link: ** (you can enter links to other notes here)
**Tags: ** [List of tags you entered in the GUI part]
**Time: ** Auto-populated by the script. Check the TimeString line [and here](https://www.autohotkey.com/docs/commands/FormatTime.htm) for how to format the time.
**Notes:** I usually type some small notes here when I use the rest of the page for writing articles for clients. For personal use, where a note's a note - and not a project, this remains blank.
- - -
Here be content.
I hope someone finds this helpful
EDIT/UPDATE:
Some more info on the scriptās behavior. If you close the GUI or press Esc to cancel, hopefully your content should be styled precisely as if it would be saved in a new note, but copied to the clipboard instead. Thus, you can then paste it in another app, or Obsidian itself.
Also, to change the hotkey, change the:
#`::
ā¦line to anything you wish. Iāve included a reminder of the shortcodes AHK uses for the Windows, CTRL, Alt, and Shift keys, so you can change it to any combo you wish. For exampleā¦:
#+^a::
ā¦will call the GUI whenever you press Windows Key + Shift + CTRL + A at the same time.
EDIT 2: Updated the main script - it didnāt set the time properly. I hope it does now.
Great idea and implementation! Thanks.
Quick issue Iām running into within Obsidian: The new files seem to start with a character that Obsidian cannot read.
I noticed the red dot and get this when I hover over it with my mouse:
Here is the formatting Iām applying
NoteFormat = Title: %Title%`nTags: %Tags%`nTime: %TimeString%`n`n---`n`n# Notes:`n%Note%
Any ideas?
I donāt know, but remember seeing similar red dots and hover dialog codes when I imported notes I had created on my phone in ia writer.
The notes had links between them that followed the ia writer formatting. I simply deleted that stuff and forgot about it until I saw your post. I will be interested to hear what they are.
Thanks.
I-honestly-donāt-know! It bugs me as well, but have found no way around it. Initially I thought it was somehow borking because Iām adding a ā#ā character in front of the title, but while troubleshooting, it did the same thing both without the hash and when āescapingā it.
If anyone knows more about what this mysterious character is, Iād be interested as well. As it is, I, too, am manually deleting it from my notes, although it doesnāt seem to affect neither AHK nor Obsidian. Itās just⦠annoying
The character is the Byte Order Marker (aka BOM) and it looks like Obsidian doesnāt strip it automatically. Looking at the AHK docs, you should be able to fix it by using FileEncoding, UTF-8-RAW
rather than just UTF-8
in your OK button handler.
Oh, I had this issue too in my implementation. With BOM. Even have an issue. Thanks for the solution mention.
I hope Iāll have enough time to do the MVP of the crossplatform quick extraction/capture tool Iām working on
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.
@ducklord We can discuss and collaborate on that. You can text me on Discord and we can figure out how to make it work together. I didnāt update it for a while.
Or I can help you to put your solution on Github. It would be easier for you to maintain (in a long term) and for others to get updated version of the script.
@mrjackphil Strangely, Iām not THAT familiar with Discord, either. Iāve used it in the past, but I feel as if Iām⦠missing something. And, generally, fumbling a bit with it.
If you tell me how and when I can find you using it, though, I will
Do I just run it and search (somewhere) for your alias?
Hello guys,
Maybe I am too late here, but I want to say that this is a great idea.
I donāt know how to add that functionality to obsidian though.
Where should I add the scripts posted here? (I am a newbie regarding this type of scripting so the more detailed the explanation, the betterš )
Thanks.
It looks so interesting, could you share me: What is the pluginās name ?
YYYYEEEEARS LATEEEER⦠after forgetting all about this, I logged back seeking info on something, and found your reply. So, sorry for my delayed answer.
The scripts I provided run with AutoHotkey. That means you can download and install AutoHotkey on your Windows desktop, which will then act as āan engineā that āmakes those scripts runableā.
Then, copy the contents of my scripts, and paste them into notepad, saving them with appropriate filenames and ā.ahkā instead of ā.txtā extensions.
Finally, double-click on the script to ārun it with AutoHotkeyā.
This should be on the Feature Request section & not plugin request! Coz this is really damn necessary!
I made a new core feature request make sure to upvote & comment on it to help refine it.