AutoHotkey scripts for keyboard shortcuts

Written by pmd - - no comments

How do I put my hotkeys and hotstrings into effect automatically every time I start my PC?

There are several ways to make a script (or any program) launch automatically every time you start your PC. The easiest is to place a shortcut to the script in the Startup folder:

  1. Find the script file, select it, and press Ctrl + C.
  2. Press Win + R to open the Run dialog, then enter shell:startup and click OK or Enter. This will open the Startup folder for the current user. To instead open the folder for all users, enter shell:common startup (however, in that case you must be an administrator to proceed).
  3. Right click inside the window, and click "Paste Shortcut". The shortcut to the script should now be in the Startup folder.

Source

Activate a AutoHotkey script

Double-click to run *.ahk script. It will show up in the notification area.

Script #1: Insert Date in Any Program Using Keyboard Hotkey

^!d::                                               ; CTRL + ALT + D
    KeyWait, d                                      ; wait for d to be released
    KeyWait, d, D T0.2                              ; and pressed again within 0.2 seconds
    If ErrorLevel {                                 ; if timed-out (only a single press)
        FormatTime, CurrentDateTime,, yyyy_MM_dd_
        SendInput, %CurrentDateTime%
    }
    Else {                                          ; if not timed-out (double press)
        FormatTime, CurrentDateTime,, dd/MM/yyyy
        SendInput, %CurrentDateTime%
    }
return

Press Ctrl + Alt + D and it will print a date in this format: « 2022_01_14_ »
Press Ctrl + Alt + D + D and it will print a date in this format: « 14/01/2022 »

Source + FormatTime - Syntax & Usage | AutoHotkey

 

Classified in : Office - Tags : none

Comments are closed.