Sublime_evernote_AHK is used to quickly open notes in sublime text from evernote windows app
#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.
;this ahkscript open an evernote in sublime_text for quick editing in markdown
;define the hotkey here
^m::
clipboard=
;copying the shared url
sendInput {ctrl Down}{Alt Down}l{Alt Up}{ctrl up}
clipwait,3
;finding noteid and notebookid
Pos := RegExMatch(clipboard, "\Qevernote:///view/\E(\d+)/(.*)/(.*)/(.*)/", Var)
if(Pos==1)
{
;converting into GUID format that sublime_evernote plugin accepts
newurl= https://www.evernote.com/shard/%var2%/nl/%var1%/%var3%
clipboard:=newurl
SetTitleMatchMode, 2
IfWinExist,ahk_exe sublime_text.exe
{
WinActivate
WinMaximize
sleep 300
; we setup these keybinds in Sublime Settings.Download at
;https://gist.github.com/44568b64c7cac5a729ea12b8eb78f7fe
;and paste in preferences, key bindings
sendinput ^e
sendInput ^w
return
}
else
{
;open sublime text
run, %ProgramFiles%\Sublime Text 3\sublime_text.exe
WinWaitActive, ahk_exe sublime_text.exe, , 6
if ErrorLevel
{
MsgBox, Cant activate sublime text
return
}
else
{
sleep 5000
;sometimes sublime text doesnot open keybinding due to some delay
sendinput ^e
sendInput ^w
return
}
}
}
else
{
msgbox, Err in copying the url. Try Again
}