AHK code for multi-step thing

144 views
Skip to first unread message

Steve Kunkel

unread,
Mar 16, 2021, 12:21:46 PM3/16/21
to MyLifeOrganized
I've noted there are a few AutoHotkey users on the forum, so I thought I'd share this bit of code.  I've been using it for a while--seems to work well.  

My own custom MLO setup has a parent branch "COMPLETED" where I move completed cases (child branches) to.  Also, I have a context called 'Done' which is set with Ctrl+Alt+Shift+D.  I believe the rest of the below actions are using the default hotkeys(?)

The below script high jacks  Ctrl+Alt+Shift+D and does the steps.  It's 'context-sensitive' though and only works if activated when a window containing "MyLifeOrganized" in the title is active.  For this reason, make sure that TitleMatchMode is set for 2. 


#NoEnv ; For security
#SingleInstance force ; If it gets restarted, kill and usurp the old process in RAM.
#Persistent ; Keep on keeping on.
SetTitleMatchMode, 2 ; Win titles must contain specified string (doesn't have to be at beginning of title).

#IfWinActive, MyLifeOrganized
!^+d:: 
send,!^+d ; I have a Context "Done" that is set with Alt+Ctrl+Shift+d
send,!^+r ; "Replaces contexts in all subtasks..." is set with Alt+Ctrl+Shift+r
WinWaitActive, Confirm ; "Replaces contexts in all subtasks..." results in a confirmation window. 
send,{Enter} ; Closes confirmation window.
send,^m ; Default hotkey for "Move." 
WinWaitActive, Move task - select new parent
send,COMPLETED{Down}{Down}{Enter} 
Return
#IfWinActive

Richard Emes

unread,
Mar 17, 2021, 6:23:19 AM3/17/21
to MyLifeOrganized
Definitely going to try this out, thanks for sharing :-)

Steve Kunkel

unread,
Mar 25, 2021, 1:19:47 PM3/25/21
to MyLifeOrganized
Oddly, I've found that this code occasionally fails....  
I'll experiment more to see if it just needs a "sleep" command, or what...   Occasionally (but not always) the branch will get moved to the wrong spot.   There are two erroneous places that it sometimes goes.  Sometimes, it gets moved below the last sub-branch, of the last folder, in the current parent folder (i.e. gets moved to the end of its siblings and put at the bottom of the last sibling's kids).  Other times (and more often) it gets moved to the very last folder in the entire outline, and placed after the last child of that folder.  Like the very last possible spot.  


Reply all
Reply to author
Forward
0 new messages