Help with Script Dealing With Image That Repeats
Moderators: JRL, Dorian (MJT support)
Help with Script Dealing With Image That Repeats
Hello all!
I am new at this and I'm trying to create a script but I am having problems. I don't know how to make it run continuously without me having to keep clicking on run. I captured some screenshots already and tried to create a script but had no luck. Not sure if this is that hard or not but this is what I want to do:
1. When the program sees image0 (I took a screenshot of all the images and saved it as bitmap files) it will move the mouse to image0 and clicks on it. (Completed)
2. Then when the program sees image1, it will press 1 on the keyboard. (No clue at all)
3. If the program does not see image1, but sees image2 instead, it will press 2. (No clue at all)
4. If the program does not see image1, or image2, but sees image 3 instead, it will press 3. (No clue at all)
For steps 2-4 I want to make it run continuously since the images can repeat more than once. For example, image1 will show first, then image2, then image1, then image3, then image2, etc.
5. If the program does not see any of those 3 images anymore after lets say 5 seconds, it will move the mouse to image4 and click on it. (No clue at all)
6. Then it will go back to step 1 again and this program keeps repeating. (No clue at all)
Is this something that can easily be made? I wish I was a pro at this.
Thanks for your help!
I am new at this and I'm trying to create a script but I am having problems. I don't know how to make it run continuously without me having to keep clicking on run. I captured some screenshots already and tried to create a script but had no luck. Not sure if this is that hard or not but this is what I want to do:
1. When the program sees image0 (I took a screenshot of all the images and saved it as bitmap files) it will move the mouse to image0 and clicks on it. (Completed)
2. Then when the program sees image1, it will press 1 on the keyboard. (No clue at all)
3. If the program does not see image1, but sees image2 instead, it will press 2. (No clue at all)
4. If the program does not see image1, or image2, but sees image 3 instead, it will press 3. (No clue at all)
For steps 2-4 I want to make it run continuously since the images can repeat more than once. For example, image1 will show first, then image2, then image1, then image3, then image2, etc.
5. If the program does not see any of those 3 images anymore after lets say 5 seconds, it will move the mouse to image4 and click on it. (No clue at all)
6. Then it will go back to step 1 again and this program keeps repeating. (No clue at all)
Is this something that can easily be made? I wish I was a pro at this.
Thanks for your help!
Last edited by nycgirleo on Tue Mar 17, 2009 9:03 pm, edited 1 time in total.
William Ng
Thanks mmcbrien. I almost got it to work. The problem that I am having now is that when the program sees the image and it sends a text, the text does not type in the window I want it to. I even tried focusing it and it still doesn't work. If I used notepad it would work. But it is not working if I use a web browser. I want it to work in a flash game if that helps. How can I fix this problem?
William Ng
Try setting focus with mousemove and LClick
I'm guessing you tried using SetFocus.
Try setting focus by doing a mousemove to the coordinates found by FIP. Then LClick, or whatever you would do manually, then send the key strokes.
Does that help?
Gale
Try setting focus by doing a mousemove to the coordinates found by FIP. Then LClick, or whatever you would do manually, then send the key strokes.
Does that help?
Gale
Press or SendText
You mention pressing the numeric keys.
If you haven't already, try the SendText command instead of Press/Release. I don't know if Press works with all keys.
Gale
If you haven't already, try the SendText command instead of Press/Release. I don't know if Press works with all keys.
Gale
flash does not detect key presses
Hi Marcus,
I confirmed the problem on a web site with a flash demo. You must click on the movie clip area to activate flash, then press various keys to make an object move. The Press and Send> commands do not work. Neither does vbscript's sendkeys, though I may have used it incorrectly.
I tried activating the movie clip area with a mousemove and and LClick. Then I tried finding the window with View System Windows and doing SetFocus on the handle. SetFocus could not find the Window Title. None of that works.
The adobe documentation says Flash responds to keypress events. Does Macro Scheduler not produce a true keypress event?
Thanks,
Gale
I confirmed the problem on a web site with a flash demo. You must click on the movie clip area to activate flash, then press various keys to make an object move. The Press and Send> commands do not work. Neither does vbscript's sendkeys, though I may have used it incorrectly.
I tried activating the movie clip area with a mousemove and and LClick. Then I tried finding the window with View System Windows and doing SetFocus on the handle. SetFocus could not find the Window Title. None of that works.
The adobe documentation says Flash responds to keypress events. Does Macro Scheduler not produce a true keypress event?
Thanks,
Gale
Found answer: Press NP#
Hi,
I found a Flash example where you move an object around by clicking the arrow keys. My keyboard has 4 arrow keys in a cluster and 4 more arrow keys in the numeric keypad. Any of these eight keys will work provided Num Lock is turned off when you run the Flash example manually.
These Macro Scheduler commands do NOT work with Flash for me:
Gale
I found a Flash example where you move an object around by clicking the arrow keys. My keyboard has 4 arrow keys in a cluster and 4 more arrow keys in the numeric keypad. Any of these eight keys will work provided Num Lock is turned off when you run the Flash example manually.
These Macro Scheduler commands do NOT work with Flash for me:
These Macro Scheduler commands DO work with Flash for me:Press Left
Press Right
Press Down
Press Up
See if the Press NP# commands work for you.NumOff
Press NP4
Press NP6
Press NP2
Press NP8
Gale
Re: Found answer: Press NP#
Hi Gale,gdyvig wrote:I found a Flash example where you move an object around by clicking the arrow keys.
Please post the url to the flash example you tried... so we can try the same thing.
Thanks and take care
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -

Flash sites using Arrow Keys
Here is a site with a sample and a good explanation of key ascii codes vs key codes:
http://www.flash-creations.com/notes/asclass_key.php
The Numeric Keypad solution may not be such a good one if you do not have one.
Gale
http://www.flash-creations.com/notes/asclass_key.php
The Numeric Keypad solution may not be such a good one if you do not have one.
Gale
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Flash sites using Arrow Keys
Doesn't matter. Macro Scheduler can still send the keystrokes. Whether you have a physical key or not it still exists. Unplug your keyboard and then run a macro which sends keystrokes. It will work. NP keys are valid keys in Windows and the VK codes exist whether or not you have a numeric keypad on your keyboard!gdyvig wrote:The Numeric Keypad solution may not be such a good one if you do not have one.

Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Hi Gale,
Interesting. I used the following script to test:
Note that there are two separate "flash movies" on the web page at the link you sent.
The top one just under the heading Continuous checking and responding to keyboard activity responds fine to the MS macro.
However, the second one doesn't respond at all... the one located under the section that says:
In the second flash movie, the flash code is actively checking for a condition... the condition of the key being down. When our fingers tap a key, that key is down for a good long time so the flash code can pick it up. When the MS script simulates the key being down... the duration may be incredibly short therefore the flash code is not picking it up.
Another possibility is that maybe MS does not actually simulate the key down condition... and if so then the flash code will never see it. Perhaps MS just sends a code to the keyboard buffer.
Marcus, can you elaborate a bit on what may or may not be happening to cause the above?
Interesting. I used the following script to test:
I set F11 as a Hot Key in MS to the above script to make it easier to test.//http://www.mjtnet.com/forum/viewtopic.php?t=5402
//http://www.flash-creations.com/notes/asclass_key.php
//test - press arrow down key 10 times - does flash movie respond?
//add delay to be able to set focus back on the flash movie
Wait>10
Press Down * 10
Note that there are two separate "flash movies" on the web page at the link you sent.
The top one just under the heading Continuous checking and responding to keyboard activity responds fine to the MS macro.
However, the second one doesn't respond at all... the one located under the section that says:
- Using an onEnterFrame checker and looking for Key.isDown instead can produce a much more responsive result (including response to multiple keys). Here is the same movie running at 21fps (same as above) using an onEnterFrame loop to check and respond (code follows):
In the second flash movie, the flash code is actively checking for a condition... the condition of the key being down. When our fingers tap a key, that key is down for a good long time so the flash code can pick it up. When the MS script simulates the key being down... the duration may be incredibly short therefore the flash code is not picking it up.
Another possibility is that maybe MS does not actually simulate the key down condition... and if so then the flash code will never see it. Perhaps MS just sends a code to the keyboard buffer.
Marcus, can you elaborate a bit on what may or may not be happening to cause the above?
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -

More flash demos
My first test was against a demo found on the Adobe site.
I tried Press Left, Send>4 with no success.
Then I logged off.
Next I added Press NP4 to the script, leaving the other commands in.
I could not find that Adobe site, but found the another - the one referenced in a previous post.
The script worked, so I thought it was the Press NP4 that did it.
Actually it was the Press Left.
Now I found another Adobe demo, neither Press NP4 nor Press Left works. Perhaps the same issue that JRL brought up on demo2 in the previous post.
http://www.adobe.com/support/flash/inte ... keyobject/
Pressing the spacebar does not work either.
JRL said it may have to do with how long (or whether) the key is pressed before it is released. Perhaps a couple of new system variables like SK_PRESS_TIME and PRESS_TIME could specify that.
Gale
I tried Press Left, Send>4 with no success.
Then I logged off.
Next I added Press NP4 to the script, leaving the other commands in.
I could not find that Adobe site, but found the another - the one referenced in a previous post.
The script worked, so I thought it was the Press NP4 that did it.
Actually it was the Press Left.
Now I found another Adobe demo, neither Press NP4 nor Press Left works. Perhaps the same issue that JRL brought up on demo2 in the previous post.
http://www.adobe.com/support/flash/inte ... keyobject/
Pressing the spacebar does not work either.
JRL said it may have to do with how long (or whether) the key is pressed before it is released. Perhaps a couple of new system variables like SK_PRESS_TIME and PRESS_TIME could specify that.
Gale