Auto Hot Key ...... AutoHotKey Forum


The Automator


  • Let's get Started
    1. Open Scite Editor and click file new.
    2. Save the new file

    For Help Click Windows Start > AutoHotKey > AutoHotKey Help File

    Special keys

    Date format

    Progress Bar

    Keywait

    Trim Left & Right

    If VAR Length = 11

    #Include


    InputBox,x,Enter your Name

    MyFunc1(x)

    return
    ^x:: ExitApp

    === The Function ===

    MyFunc1(Var)
    {
    global
    MsgBox, Hello %var% lets open Google
    Run,www.google.com
    }
    return

    All Scripts should Start and End with:

    AHK Choose a Printer

    CapsLock

    Close all open programs, and put the Computer to Sleep or Turn it Off

    msgbox

    !2::
    msgbox, Print 4x4 Logo ; this
    Logo = 1
    gosub, template
    return

    !3::
    MsgBox, Generic text
    logo=2
    gosub, template
    return


    template:
    MsgBox, 4, 4x4logos,Would you like to print a 4x4?,5
    IfMsgBox no
    return
    IfMsgBox Timeout
    return

    IfEqual,logo, 1
    run,4x4wLogo.txt - Notepad
    else IfEqual,logo,2
    run, 4x4Generic.txt - Notepad
    else IfGreater,logo,2
    goto, LrowV return

    ;~Enter your code here


    Lrow:
    return


    The Golf Swing

    Link to usable Commands


    Gui with background & Transparent Text box

    Gui,add,picture,w375 h425,rdr2.jpg ;The picture should be in the same folder as the AHK
    Gui, Add, Text, backgroundtrans x20 y40 gBrave, Brave ; This will keep the text box transparent

    Gui Add horizontal and veritcal lines

    Drop Down List

    AHK Reads and Writes to and Reads from Excel

    Open/Close Excel w/AHK

    Open/Close Add Data to the next open cell in column "A" in Excel w/AHK

    Form (Basic Form)

    Open Printer

    Run, control printers
    WinWaitActive, Devices and Printers,
    Sleep, 500


    Sending Text and Key Strokes

    Change icon for AutoHotKey script

    Use the AHK "Convert.ahk to .exe" rather than the Script editor to change the Icon.
    The Icon is done during the compiling of the script. Once it is done the .exe file can be pinned to the task bar.

     

    Icons? Click here.

    CapsLocks

    #NoEnv
    #SingleInstance,force
    CoordMode,Window

    SetStoreCapsLockMode, Off
    state := GetKeyState("CapsLock", "T") ; True if CapsLock is ON, false otherwise.

    if (state = True)
    SENDINPUT,{CAPSLOCK} ... (This line will presses the Capslock key only if capslock is True (ON))
    return

    ^X::ExitApp

    Move or Skip to another line in script

    GoSub (Calls a sub routine by Label name.

    Loops

    i = i + 1 in VBA would look like this in AHK

    Winwait (Waits for window to open. Rather than guessing a Sleep time)

    Coordmode

    Close the GUI from the "X" in the upper right corner

    "MouseClick" or " Click" or "ControlClick"

    Pasting from the Clipboard. Which is faster that sending individual keys

    Variables - Var Name:= text or numbers

    InputBox

    Commenting Code

    Error Level

    The Basic GUI

    #NoEnv
    #SingleInstance,force
    gui, +Alwaysontop
    gui,Color,BB4500 ; This is the Gui background color
    Gui,font,S15 cdbdad5 bold ;Sets Font size & color

    Gui, Add, Text, x10 y30,Switch - Cisco 3400
    Gui,font,S10
    Gui, Add, Text, x30 y55 cffe6b3 gGoogle, Click here to launch Google.
    Gui, Add, Radio, x30 y75 cffe6b3 gNote, Click here to launch Notepad.
    Gui, Add, Checkbox, x30 y105 cffe6b3 gGoogle, Click here to launch Google. (Note that this will toggle a check mark where as the Radio will only show the last radio button clicked
    Gui, Add, Button, x30 y125 cffe6b3 gGoogle, Click here to launch Google.

    gui,show,x1450 y100 w400 h300, Dans Text and Links
    return

    ;---------------Labels-------------------------------------------------

    Note:
    Run, Notepad
    WinWait, Untitled - Notepad
    send,Dan
    return

    Google:
    Run,www.google.com
    return

    ;-----This will close the GUI Using the "X" in the upper right courner---

    GuiClose:
    *ESC::
    ExitApp


    Build a GUI Menu

      #SingleInstance force
      Gui,color,000000 -Sets background color
      Gui,font, s11 cffffff - Sets Font Size and color
       
      Gui, +AlwaysOnTop - Keeps Gui on top
       
       
      Gui,Add,Text, x10 y10, Hello I need help. This is line 1 - Sets Text and Location of text
      Gui,Add,Text, x+10 y10, Hello I need help. This is line 2
      Gui,Add,Button, X Y, W H, gFirstButton , Text on Button
      Gui,Add,Radio, X Y, W H, gFirstButton , Text on Button
       
      Gui,show, x100 y220 w 500 h300,PuTTY - Show Gui box

      Explaination:

    GUI, Transparent background

    Gui Buttons (Create Sections)

    IF Window Exists make active Else Run Program

    Gui with Reload of Active mesagebox

    Windows Spy



    Pause



    "Key Wait" for Space bar before continuing


    Sleep,1000


    Contains