Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help creating a macro!
#1
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..
#2
if i understood you correctly 
try this
Function StartMacroIf
Trigger 4     Help - how to add the trigger to the macro
Code:
Copy      Help
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
#3
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.
#4
can always change the wait time to whatever 

Function StartMacroIf
Trigger 4     Help - how to add the trigger to the macro
Code:
Copy      Help
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     Help - how to add the trigger to the macro
Code:
Copy      Help
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
#5
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
#6
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
#7
ah okay, thanks! I put it as a macro, I will do the function!


Forum Jump:


Users browsing this thread: 2 Guest(s)