New, can't seem to get this simple script to work.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Stormakov
Posts: 4
Joined: 02 Feb 2016, 07:03

New, can't seem to get this simple script to work.

02 Feb 2016, 07:08

So, basically what I'm trying to do is simulate a left mouse button click, a short delay (300ms or so) and then a keyboard button press input (in this case 1)

I've tried a whole whack of different variations on this I can can't seem to get any to work, any help would be awesome - thank you.


Variations I tried were, there were a bunch of others too just to give you an idea.

#IfWinActive, ESO
1::
BlockInput On
SendInput {Click}{1}
BlockInput Off
Return

#IfWinActive, ESO
1::
BlockInput On
Click
Delay 300
SendInput {1}
BlockInput Off
Return

#IfWinActive, ESO
1::
BlockInput On
sendinput {LButton down}
KeyWait, LButton
sendinput {LButton up}
Sleep 300
SendInput {1}
BlockInput Off
Return
User avatar
boiler
Posts: 16954
Joined: 21 Dec 2014, 02:44

Re: New, can't seem to get this simple script to work.

02 Feb 2016, 07:30

Remove the braces around the 1.
Stormakov
Posts: 4
Joined: 02 Feb 2016, 07:03

Re: New, can't seem to get this simple script to work.

02 Feb 2016, 07:58

That doesn't seem to work either.

The problem is I only seem to be able to either get the mouse click OR the button press to work, I can't seem to get them to both happen one after the other.
User avatar
IRBaboon
Posts: 27
Joined: 11 Aug 2014, 07:48

Re: New, can't seem to get this simple script to work.

02 Feb 2016, 08:59

Code: Select all

!1::
SendInput {LButton}
Sleep 300
SendInput {1}
Return
i changed ^1 to !1 (altkey+1) cause ^1 is blocked from another hotkey for me
Stormakov
Posts: 4
Joined: 02 Feb 2016, 07:03

Re: New, can't seem to get this simple script to work.

02 Feb 2016, 09:11

Ya, I can't use the alt key because it activates something else (just the way the game is designed)

And just taking out the alt key indicator (!) and just using 1 has the same problem I was having before, where the mouse click will go off but the button press doesn't happen.
User avatar
boiler
Posts: 16954
Joined: 21 Dec 2014, 02:44

Re: New, can't seem to get this simple script to work.

02 Feb 2016, 09:48

The issue when you were using just 1 as the hotkey may be fixed by changing your hotkey definition to $1:: to keep the hotkey routine from calling itself.
wizardzedd
Posts: 319
Joined: 23 Jan 2016, 23:03

Re: New, can't seem to get this simple script to work.

02 Feb 2016, 13:03

boiler wrote:The issue when you were using just 1 as the hotkey may be fixed by changing your hotkey definition to $1:: to keep the hotkey routine from calling itself.
Boiler is right. Currently the line sendinput {1} is going to trigger the hotkey itself. This should do the trick:

Code: Select all

$1::
BlockInput On
sendinput {LButton}
Sleep 300 
SendInput {1}
BlockInput Off
Return
Stormakov
Posts: 4
Joined: 02 Feb 2016, 07:03

Re: New, can't seem to get this simple script to work.

02 Feb 2016, 18:59

Thanks guys, putting the $ in front of the 1 made it work out beautifully - appreciate the help, you rock.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: downstairs, Google [Bot], OrangeCat and 180 guests