Quick Note Taker (like a Sticky Note)

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.

12 Likes

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.

2 Likes

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.

5 Likes

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 :slight_smile:

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.

1 Like

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.

Screenshot 2020-12-28 233359

I noticed the red dot and get this when I hover over it with my mouse:

Screenshot 2020-12-28 233430

Here is the formatting Iā€™m applying

NoteFormat = Title: %Title%`nTags: %Tags%`nTime: %TimeString%`n`n---`n`n# Notes:`n%Note%

Any ideas?

1 Like

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 :smiley:

1 Like

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.

4 Likes

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

3 Likes

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? :smiley: 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 :slight_smile:

Thatā€™s all for now, and sorry for the long post - and even longer absence. Blame life :expressionless:

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.

3 Likes

@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 :slight_smile:

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.

2 Likes

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ā€.