Need help activating strings with 1 button

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Moonzo
Posts: 1
Joined: 20 May 2017, 14:12

Need help activating strings with 1 button

20 May 2017, 15:25

Hello, I am having trouble making multiple Strings run at separate times with only one button being pressed several times. I've spent days researching and rereading the tutorial, but I am still a noob so forgive me for that.. I have a bill acceptor that is connected to my computer and presses one keyboard button "g" for $1 "ggggg" for $5 "gggggggggg" for $10 and "gggggggggggggggggggg" for $20 (50msec on 300msec off).

I need 1 macro script to run for each series of g buttons being pressed. I wrote 4 scripts that activate each one, but when $20 is put in it presses the g button 20 times and activates the other 3 scripts (1g button, 5g button, 10g button)

Here is one of the scripts I made for the 5 g presses

:*:ggggg::
Run, buttonscript.dia, C:\Program Files (x86)\ Do It Again

Is there any way to make 1 of the 4 scripts to load when the correct amount of of g's is pressed by recognizing the pause time after their pressed? I tried to make a setkeydelay or sleep for few secs after, but it didn't recognize my script.
User avatar
TheDewd
Posts: 1510
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Need help activating strings with 1 button

30 May 2017, 15:25

Code: Select all

#SingleInstance, Force ; Allow only one running instance of script

Count := 0 ; Initialize variable

g::
    Count++ ; Increase count value
    Progress, m2 B zh0, % "$" Count ; Enable notification
    SetTimer, Timer1, -500 ; Run Timer1 label after 500 milliseconds
return

Timer1:
    Progress, Off ; Disable notification
    MsgBox, % "That will be $" Count ", sir!"
    Count := 0 ; Reset count value
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mcd, NullRefEx and 119 guests