Quick add to Dynalist inbox using AutoHotKey


#1

Using AutoHotKey (Windows) I’ve created a keyboard shortcut that lets me easily add an item to my inbox without having to open up Dynalist.

Typing Ctrl-Win-F pops up this little input:

image

Here’s the script:

^#f::AddToDynalist()  ;  ctrl-win-F

AddToDynalist() {
	DynalistToken := "~~ YOUR API KEY HERE ~~"
	InputBox, UserInput, Task,Add to Dynalist inbox:,,350,125 
	If (!ErrorLevel and UserInput <> "")
	{
		; UserInput := UriEncode(UserInput)
		URL := "https://dynalist.io/api/v1/inbox/add"
		HttpObj := ComObjCreate("WinHttp.WinHttpRequest.5.1")
		HttpObj.Open("POST", URL, 0)
		HttpObj.SetRequestHeader("Content-Type", "application/json")
		Body := "{ ""token"": """ . DynalistToken . """, ""index"": 0, ""content"": """ . UserInput . """, ""checked"": false }"
		HttpObj.Send(Body)
		Result := HttpObj.ResponseText
		Status := HttpObj.Status
	}
}
 

#2

What do you mean? Why would you close Dynalist? :joy:

Useful script. Thanks for posting. :+1:


#3

Works great. :slightly_smiling_face:

One small thing though, I have my Inbox set to add new items to the bottom of the list - the script adds them to the top. Is that the API call?


#4

That’s what the index parameter is in the API call - just set it to -1 to force to the bottom, or remove it altogether to use your default.
https://apidocs.dynalist.io/#send-to-inbox


#5

Excellent! Thanks.


#6

Hi! Im trying to get this to work but i cant.
Im placeing my token between “” and changed the keys to Win-N.
i only get the error windows sound. What am i doing wrong?


#7

The “win-N” you have inserted is in the comments section i.e. after ; so it has no effect.

If you want Win+N as your shortcut you should replace ^#f with #n, however this key combination is used by OneNote for a new note usually. Just check the rest of the script is ok by using the built in Ctrl+Win+f shortcut (assuming this isn’t already being used for something else). Also, it’s best practice to put “return” at the end of the script.


#8

I got the popup now (wich i didnt get before), it doesent add the text to my Inbox. Do need to be a pro for it to work?

When u write “Also, it’s best practice to put “return” at the end of the script” do mean i just press enter at the end? (i know nothing about programing)

Thx!


#9

Hard for me to tell but it looks like you might have a space where there shouldn’t be one at the end of your token and before the closing speech marks. If so, delete the space and try again.


#10

Just type return on a new line at the end of the script to stop the script from running when it’s completed


#11

Thank you!


#12

:+1: You’re welcome


#13

This is really useful! Thanks for sharing!