How can i bypass the macro when i pess uparrow key?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
luca1974wow
Newbie
Posts: 15
Joined: Sat Dec 12, 2009 11:20 pm

How can i bypass the macro when i pess uparrow key?

Post by luca1974wow » Mon Jan 31, 2011 11:21 pm

this is my macro
--------------------------------------------
.OnEvent>Key_Down,VK118,0,MainMacro
.SRT>MainMacro
.GetPixelColor>1370,0,BLACK
.If>BLACKA
.endif
.END>MainMacro
.Label>IdleLoop
.Wait>0.1
.Goto>IdleLoop
---------------------------------------------
i want don't send key A when i press uparrow

(sorry for may english)


OnEvent>Key_Down,VK118,0,MainMacro
SRT>MainMacro
GetPixelColor>1370,0,BLACK
If>BLACKA
endif
label>bypassmacro
END>MainMacro
Label>IdleLoop
Wait>0.1
Goto>IdleLoop

luca1974wow
Newbie
Posts: 15
Joined: Sat Dec 12, 2009 11:20 pm

Post by luca1974wow » Tue Feb 01, 2011 2:17 pm

i'm sorry for the post, but when i push submin the program change my word
i try to rewrite my post

this is my macro
--------------------------------------------
OnEvent>Key_Down,VK118,0,MainMacro
SRT>MainMacro
GetPixelColor>1370,0,BLACK
If>BLACK=0
send>A
endif
END>MainMacro
Label>IdleLoop
Wait>0.1
Goto>IdleLoop


i want don't send key A when i press uparrow
OnEvent>Key_Down,VK118,0,MainMacro
SRT>MainMacro
GetPixelColor>1370,0,BLACK
If>BLACK=300
send>A
******* if UPARROW is pressed goto>bypassmacro********
endif
label>bypassmacro
END>MainMacro
Label>IdleLoop
Wait>0.1
Goto>IdleLoop

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue Feb 01, 2011 3:06 pm

This should work for you. You will probably have to press the up arrow key first then press the F7 key in order to have any chance of being fast enough to stop the Send>A line.

Code: Select all

//i want don't send key A when i press uparrow
//VK118 = F7 key
OnEvent>Key_Down,VK118,0,MainMacro
//VK38 = Up Arrow key
OnEvent>Key_Down,VK38,0,UpArrow

//Set The up arrow control flag to zero
Let>Up_arrow_flag=0

SRT>MainMacro
  GetPixelColor>1370,0,BLACK
  //******* if UPARROW is pressed 
  //Up_arrow_flag will be set to 1 and 
  //the script will not send A********
  If>{(%BLACK%=300)and(%Up_arrow_flag%=0)}
    send>A
  endif
END>MainMacro

SRT>UpArrow
  Let>Up_arrow_flag=1
END>UpArrow

Label>IdleLoop
  Wait>0.1
  //When up arrow key is released,  10 passes of
  //the IdleLoop will cause the Up_arrow_flag variable
  //to be reset to zero
  If>Up_arrow_flag>0
    Add>Up_arrow_flag,1
    If>Up_arrow_flag>10
      Let>Up_arrow_flag=0
    EndIf
  EndIf
Goto>IdleLoop

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts