How to make a macro reacts differently depending on the key
Moderators: JRL, Dorian (MJT support)
-
- Newbie
- Posts: 18
- Joined: Sun Dec 22, 2002 2:41 am
How to make a macro reacts differently depending on the key
First, I must say that I'm really impressed by Macro Scheduler so far. However, I can't figure out how to do something, so I hope you will be able to help me.
I want my macro to reacts depending on the key pressed. The macro must looks like this : If "k" is pressed go somewhere, elseif "g" is pressed go somewhere else. I also want the user to be able to move the mouse around before pressing a key ( i.e I think the program must be waiting ). If it can't be done with keys then I hope it can be with mouse clicks ( ex : If "LeftMouse" is pressed go somewhere, elseif "RightMouse" is pressed go somewhere else. I suspect I will need some VBscript to accomplish that, but I'm not used to the Macro Scheduler integration of VBscript.
I want my macro to reacts depending on the key pressed. The macro must looks like this : If "k" is pressed go somewhere, elseif "g" is pressed go somewhere else. I also want the user to be able to move the mouse around before pressing a key ( i.e I think the program must be waiting ). If it can't be done with keys then I hope it can be with mouse clicks ( ex : If "LeftMouse" is pressed go somewhere, elseif "RightMouse" is pressed go somewhere else. I suspect I will need some VBscript to accomplish that, but I'm not used to the Macro Scheduler integration of VBscript.
Guillaume777,
Macro Scheduler is designed for substitution of repetitious manual keystrokes. It assumes:
1. You have a targe application such as Microsoft Office XP, AutoCAD and CorelDraw;
2. You know perfectly a pre-defined keystroke sequence and its approximate timing.
Please let us know whether it's exactly what you want.
Macro Scheduler is designed for substitution of repetitious manual keystrokes. It assumes:
1. You have a targe application such as Microsoft Office XP, AutoCAD and CorelDraw;
2. You know perfectly a pre-defined keystroke sequence and its approximate timing.
Please let us know whether it's exactly what you want.
What I wanted is some kind of command/VBscrit like the KeyPress event of Visual Basic, but it doesn't matter now because I found a way around it. However I now have problem with the "WaitKeyDown" command : I can't find the corrects virtual key code since the http://msdn.microsoft.com/library/psdk/ ... s_529f.htm link is down.
-
- Newbie
- Posts: 18
- Joined: Sun Dec 22, 2002 2:41 am
-
- Newbie
- Posts: 18
- Joined: Sun Dec 22, 2002 2:41 am
this web site also says that the virtual key code of Numpad 5 is 101, so I guess thoses are the correct codes :
http://www.eonreality.com/support/manua ... KCodes.htm
http://www.eonreality.com/support/manua ... KCodes.htm
-
- Newbie
- Posts: 18
- Joined: Sun Dec 22, 2002 2:41 am
-
- Newbie
- Posts: 18
- Joined: Sun Dec 22, 2002 2:41 am
-
- Newbie
- Posts: 18
- Joined: Sun Dec 22, 2002 2:41 am
-
- Newbie
- Posts: 18
- Joined: Sun Dec 22, 2002 2:41 am
Hi Guillaume777
Mr Gullaume was Swiss physicist. He won a 1920 Nobel Prize for his discovery of a steel-nickel alloy.
VBSTART
Function IsMouseClick()
if MouseClick Then
IsMouseClick = 1
else
IsMouseClick = 0
end if
End Function
VBEND
VBeval>IsMouseClick(),Logic
If>Logic=1,doClickMethod
Goto>End
Label>doClickMethod
........
Label>End
Bear in mind, the above code was never tested.
Please keep us posted about your wonderful experiences with Macro Scheduler scripting.
Mr Gullaume was Swiss physicist. He won a 1920 Nobel Prize for his discovery of a steel-nickel alloy.
Assuming you have the onMouseClick object, you may contemplate the following the hypothetical code:hum.... I wonder if its possible to create a macro with VBscript that waits for a mouse click ...
VBSTART
Function IsMouseClick()
if MouseClick Then
IsMouseClick = 1
else
IsMouseClick = 0
end if
End Function
VBEND
VBeval>IsMouseClick(),Logic
If>Logic=1,doClickMethod
Goto>End
Label>doClickMethod
........
Label>End
Bear in mind, the above code was never tested.
Please keep us posted about your wonderful experiences with Macro Scheduler scripting.
-
- Newbie
- Posts: 18
- Joined: Sun Dec 22, 2002 2:41 am
-
- Newbie
- Posts: 18
- Joined: Sun Dec 22, 2002 2:41 am
Guillaume777,
Please remove "wonderful" from my previous email if you won't concur it's a wonderful experience in trying out new programming technuiques.
Please keep us posted about your latest discovery of coding VBscript functions/commands/objects in Macro Scheduler script. Many thanks.
Wish you a Merry Christmas and a Happy New Year.
Please remove "wonderful" from my previous email if you won't concur it's a wonderful experience in trying out new programming technuiques.
Please keep us posted about your latest discovery of coding VBscript functions/commands/objects in Macro Scheduler script. Many thanks.
Wish you a Merry Christmas and a Happy New Year.
-
- Newbie
- Posts: 18
- Joined: Sun Dec 22, 2002 2:41 am
armsys :
Yes, I have wonderful experiences in trying out new programming techniques with Macro Scheduler. However, what I posted here is
more like a search for the Virtual Key Codes rather then some real programming. To me, searching for the Virtual Key Codes wasn't wonderful, especially because I failed to do what I wanted..... Still, I find Macro Scheduler very fun to use.
Yes, I have wonderful experiences in trying out new programming techniques with Macro Scheduler. However, what I posted here is
more like a search for the Virtual Key Codes rather then some real programming. To me, searching for the Virtual Key Codes wasn't wonderful, especially because I failed to do what I wanted..... Still, I find Macro Scheduler very fun to use.