Autohotkey Script Examples

autohotkey

#21

Good one! Though, I’m personally not a fan of overwriting global hotkeys #n is a new Quick Note in OneNote. And, the w and t keys only works if you don’t have more things in your context menu that have the w as the trigger key. For me, I have WinZip installed and it’s trigger is a w leaving new text file the second w.

Here’s a way around that. This will copy the current path of the current File Explorer and create a new empty text file in that same directory (also notice I used !n as to not overwrite built in hotkeys).

!n::
KeyWait, n
Send, ^l^c
FileAppend,, %clipboard%\new_file.txt
return

Expanding on that, I like to keep a directory of text file notes. This one will take what you have in your clipboard, write it to a text file in your notes directory of choice then, show you the file.

^!n::
FormatTime, t,, yyyy-MM-dd-HH-mm
file = C:\path\to\notes\directory\%t%.txt
FileAppend, %clipboard%, %file%
run, %file%
return

Furthermore, if we want to use OneNote’s built in Quick Note, I made a hotkey that creates the Quick Note and adds the current date as the title triggered.

~#n::
WinWaitActive, Untitled page - OneNote
Send, ^+t
FormatTime, stamp,, yyyy-MM-dd h:mm:ss tt
SendInput, %stamp%{enter}
return

Note: the tilde in this hotkey allows the hotkey’s native function to still execute thus not overwriting it.

Hope someone gets some use out of these!


#22

I use Windows at work, the Mac at home. As such, I get so little time on the Mac to learn its basics. MPU and Automators have been a big help.

If you haven’t tried it yet, AuotIt 3 is s programming language/ framework that wraps much of the windows API. You can automate s lot of GUI activity, but you have to write the code yourself.
It’s an amazing free tool though.


#23

Good tip! The founder of AutoHotkey actually used AutoIt v2 as a base and expanded on it. In my personal opinion and preference, AHK has a lot more functionality and is easier to use/write. But, again, just my opinion. I have tried both and settled on AHK due to those reasons. It just seemed a bit more powerful too.

I encourage everyone to check them both out though! You might find that AutoIt vs AutoHotkey is a lot like Windows vs MacOS or any other opposing arguments (Google vs. MS or Android vs iOS). It just comes down to personal preference!

Cheers.


#24

You’re right. I do remember reading that a few years ago, but forgot. I’ll need to look into AHK again.