User Tools

Site Tools


wiki:windows:auto_hotkey:auto_hoykey

Auto Hot Key

https://autohotkey.com/

AutoHotKey is a scripting and automation program with an emphasis on keyboard shortcuts. I am by no means an expert and am just starting to find all the useful things it can do. I am in the process of migrating from my batch files to accomplishing these tasks with AHK.

Note on Working Directory

A note on all of these Windows Explorer related scripts. It is incredibly cumbersome grabbing the working directory of the current Windows Explorer Window. I decided on a shortcut of focusing on the address bar and copying the address and utilizing the informatoin that way. It is not the fastest script and might have to be executed a couple times before it takes. But it is still easier than doing some of the selecting operations that the later scripts save.

My Scripts

Window Always on Top

This will toggle any window to be always on top. It is a built in Windows function that normally has to be hooked into by the developer. This enables it universally. This was the one that brought me to AutoHotKey, because my boss wanted calculator to be locked on top.

^SPACE::
Winset, Alwaysontop, , A
return

Insert Date

This will replace a succession of three d's with the current date in YYYYMDD format. I use this date string for a ton of stuff so this one is super handy. Here is list of a few different formats that are possible.

:R*?:ddd::
FormatTime, CurrentDateTime,, yyyyMMdd
SendInput %CurrentDateTime%
return

Create Dated Directory

This creates a folder named “YYYYMMDD” in current directory.

^!d::
Send !d
Send ^c
Destin = %Clipboard%
FormatTime, DatedDir, , yyyyMMdd
FileCreateDir, %Destin%\%DatedDir%

Create Dated Directory with Prefix

This creates a folder named “Unsigned Invoices YYYYMMDD” in the curernt directory.

^!c::
Send !d
Send ^c
Destin = %Clipboard%
PrefixName = Unsigned Invoices
FormatTime, DatedDir, , yyyyMMdd
FileCreateDir, %Destin%\%PrefixName% %DatedDir%

Move PDFs to New Dated Sub-Folder

This creates a new dated directory and moves all PDFs in current directory into it. Saves a lot of scrolling to select a few hundred files and then back to dump them to appropriate directory.

^!m::
Send !d
Send ^c
Destin = %Clipboard%
FormatTime, DatedDir, , yyyyMMdd
FileCreateDir, %Destin%\%DatedDir%
FileMove, %Destin%\*.pdf, %Destin%\%DatedDir%

Run Program

Pretty straightforward.

^!n::
Run C:\Program Files (x86)\Notepad++\notepad++.exe
wiki/windows/auto_hotkey/auto_hoykey.txt · Last modified: 2016/09/13 15:54 (external edit)