Posts: 24
Threads: 11
Joined: Jan 2018
08-06-2018, 05:02 PM
(This post was last modified: 08-06-2018, 05:03 PM by Leeroll.)
Hi,
I'm not sure if this is possible but the macro im trying to do is,
Whenever i press my hotkey for the macro, lets say in this case NUMBER 4,
I want this hotkey to start the code inside and run a specific macro ONLY if the next key will be left mouseclick, and if Number 4 is ever pressed but NOT followed by left mouse click, it will do nothing and just reset without running that macro inside the code.
Does this make sense? sorry if it sounds confusing..
Posts: 1,337
Threads: 61
Joined: Jul 2006
if i understood you correctly
try this
Function
StartMacroIf
Trigger
4
wait(5 ML); err int leftClick=1
if(leftClick =1)
,out "function will now end because no left click within 5 seconds"
,ret;;no left click end function
if(leftClick=0)
,out "starting code because left click was within 5 seconds"
,;mac "Macro9";example add code to do whatever you want since condition is true
Posts: 24
Threads: 11
Joined: Jan 2018
Sir this was really awesome.. Thanks a bunch!
Although this solved my problem,
It would be even better if we could remove the countdown and just have the function reset if the following key is NOT leftclick but something else, like a Rightclick.
Posts: 1,337
Threads: 61
Joined: Jul 2006
08-06-2018, 06:24 PM
(This post was last modified: 08-06-2018, 06:40 PM by Kevin.)
can always change the wait time to whatever
Function
StartMacroIf
Trigger
4
wait(1 ML); err int leftClick=1
if(leftClick =1)
,out "function will now end because no left click within 1 seconds"
,ret;;no left click end function
else
,out "starting code because left click was within 1 second"
,;mac "Macro9";example add code to do whatever you want since condition is true
;or less
wait(0.5 ML); err int leftClick=1
if(leftClick =1)
,out "function will now end because no left click within .5 seconds"
,ret;;no left click end function
else
,out "starting code because left click was within .5 seconds"
,;mac "Macro9";example add code to do whatever you want since condition is true
for right click use this
Function
StartMacroIf
Trigger
4
wait(1 MR); err int RighClick=1
if(RightClick =1)
,out "function will now end because no Right click within 1 second"
,ret;;no left click end function
else
,out "starting code because Right click was within 1 second"
,;mac "Macro9";example add code to do whatever you want since condition is true
can use left click right click or middle click
wait 1 MM
; err int Mclick
=1;;middle click
wait 1 ML
; err int Lclick
=1;; leftclick
wait 1 MR
; err int Rclick
=1;; right click
here i changed the int variable name for explanation purposes
Posts: 24
Threads: 11
Joined: Jan 2018
08-07-2018, 06:34 AM
(This post was last modified: 08-07-2018, 06:36 AM by Leeroll.)
Thanks a bunch,
Another question about this,
How would I make the code reset to the start of code for every time I press the hotkey? Currently it doesnt do that before those 5 seconds of waiting for the leftclick is done
Posts: 1,337
Threads: 61
Joined: Jul 2006
08-07-2018, 08:33 AM
(This post was last modified: 08-07-2018, 08:37 AM by Kevin.)
not sure i follow you exactly. Did you put the example code i gave you into a Function or a Macro? If you made a function it will trigger each time you press the hotkey. If you made it a macro it will wait till it ends. the code i gave you should be a function. Functions can be executed more than once at a time.
code should be in
Function StartMacroIf
not
Macro StartMacroIf
other than that will need to post your code also remember can change the time in the wait function to less
read here for instructions on copying code to and from the forums
http://www.quickmacros.com/forum/showthr...56#pid2956
Posts: 24
Threads: 11
Joined: Jan 2018
ah okay, thanks! I put it as a macro, I will do the function!