Search code examples
autoit

How to Make any Words into Autoit Commands - Hotstringset Alternative


How can i Make any words into Autoit Commands?

This Code Works only if i type a Keyboard Hotkey combination, (but i want to type a word to execute the Autoit code.)

HotKeySet Example:

HotKeySet (“{F1}”, “calc”)

Func calc()
Local $iPID = ShellExecute (“calc.exe”)
EndFunc

Is there a Hotstringset Alternative.

i now in autohotkey you can make any words into Commands.

Autohotkey Languages example:

if i type calc it will execute the Autohotkey code.

:*:calc::
run calc.exe
return

Solution

  • With this you can make any words into Autoit Commands.

    Step 1 - You can Download the HotStringSet.zip File Here. (included with the HotString.au3) HotKeySet vs HotStringSet

    Step 2 - Unzip it + Copy manually the HotString.au3 to path C:\Program Files (x86)\AutoIt3\Include

    Step 3 - Now your are ready to use HotStringSet in any Autoit Script.

    enter image description here

    You can Type on your keyboard any text, for example in Wordpad : Type calc+Space and it will run the Calculator and if you Type kbc+Space it will replace the text kbc into keyboard control and if you Type pi+Space it will replace the text pi into Symbol pi.

    Write this Autoit Code.

    #include <HotString.au3>
    
    HotKeySet ('{F1}', 'quit')
    
    HotStringSet('kbc{SPACE}', replace1)
    HotStringSet('pi{SPACE}', replace2)
    HotStringSet('calc{SPACE}', replace3)
    
    Func quit()
    Exit
    EndFunc
    
    Func replace1()
    ;MsgBox(0,'','You did typed kbc! :)')
    send ('{BS 4}keyboard control ') ; replace [kbc] into [keyboard control]
    EndFunc
    
    Func replace2()
    ;MsgBox(0,'','You did typed pi! :)')
    send ('{BS 3}{ASC 960} ') ; replace [pi] into [symbol p]
    EndFunc
    
    Func replace3()
    ;MsgBox(0,'','You did typed calc! :)')
    Local $iPID = ShellExecute ('calc.exe') ; If you type calc it wil run the application calculator.
    EndFunc
    
    While 1
    Sleep(10)
    WEnd