Runs on one computer, but not on another
Moderators: JRL, Dorian (MJT support)
Runs on one computer, but not on another
Hi,
I have successfully written a script that works on my computer. However, when I use it on another computer (also Windows XP) I find that though most of it works, SHift Del, and Shift Ins are not working. The log file records them as having been 'used' - but nothing actually happens. I have had a similar problem on more than one machine.
I have tried using Ctrl C, Ctrl V, and that does not work either
Can you tell me what might be causing it?
I have successfully written a script that works on my computer. However, when I use it on another computer (also Windows XP) I find that though most of it works, SHift Del, and Shift Ins are not working. The log file records them as having been 'used' - but nothing actually happens. I have had a similar problem on more than one machine.
I have tried using Ctrl C, Ctrl V, and that does not work either
Can you tell me what might be causing it?
Bill_no_expert
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
You need to post your script for us really. Otherwise we have nothing to go on.
But:
1. Make sure you use lower case:
Press CTRL
Send>c
Release CTRL
2. 99.9% of issues like this are timing related. The script might work fine on yours, but may need more time on the other machine. You need to code your script to try not to use static wait times but intelligently wait for events to complete before trying to issue the next. The keysends could be happening too early. Might be fine on your PC but not on another. Make sure you are using commands like WaitWindowOpen/WaitWindowClosed etc. If you don't have any of this and only static waits then it will be unreliable.
3. Which OS is it? Could try setting SK_LEGACY to 1.
But post your script and we can then make recommendations for improvements.
But:
1. Make sure you use lower case:
Press CTRL
Send>c
Release CTRL
2. 99.9% of issues like this are timing related. The script might work fine on yours, but may need more time on the other machine. You need to code your script to try not to use static wait times but intelligently wait for events to complete before trying to issue the next. The keysends could be happening too early. Might be fine on your PC but not on another. Make sure you are using commands like WaitWindowOpen/WaitWindowClosed etc. If you don't have any of this and only static waits then it will be unreliable.
3. Which OS is it? Could try setting SK_LEGACY to 1.
But post your script and we can then make recommendations for improvements.
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?
Marcus,
Thanks for the reply. I do think I am in the 0.1%!
The OS in both cases is windows XP.
I have written a short macro for Notepad, and even with no waits at all it works perfectly, as expected, on both computers. The second computer is a lot faster as well.
I know the code is not brilliant - but it does work on the slow laptop - but not on the fast desktop.
So the code is:
The application it is being used in is a viewing/editing app for security video recordings. It is not a 'standard looking' windows app.
Thanks,
Thanks for the reply. I do think I am in the 0.1%!
The OS in both cases is windows XP.
I have written a short macro for Notepad, and even with no waits at all it works perfectly, as expected, on both computers. The second computer is a lot faster as well.
I know the code is not brilliant - but it does work on the slow laptop - but not on the fast desktop.
So the code is:
Code: Select all
label>Setfolder
//enter folder to save to: Browse, copy filename, write folder, pastefilename, save
Wait>1
MouseMove>792,573
Wait>1
LClick
Wait>1
MouseMove>528,541
wait>1
LDblClick
wait>1
Let>SK_LEGACY=1
Press Shift
Wait>1
Let>SK_LEGACY=1
Press Del
Wait>1
Release Shift
Wait>1
if>c=1
Wait>1
Send Character/Text>%outputfolder%\cam01\
Wait>1
endif
Wait>1
if>c=2
Wait>1
Send Character/Text>%outputfolder%\cam02\
Wait>1
endif
Wait>1
if>c=3
Wait>1
Send Character/Text>%outputfolder%\cam03\
Wait>1
endif
Wait>1
if>c=4
Wait>1
Send Character/Text>%outputfolder%\cam04\
Wait>1
endif
Wait>1
Let>SK_LEGACY=1
Press Shift
Wait>1
Let>SK_LEGACY=1
Press Ins
Wait>1
Release Shift
The application it is being used in is a viewing/editing app for security video recordings. It is not a 'standard looking' windows app.
Thanks,
Bill_no_expert
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Humour me. Add this line to the top of the script:
Let>SCRIPT_DELAY=2000
It will slow the script down no end. So what. Let's just see if it makes any difference on this other machine. If it does we know we need to work on the timing somewhere and we can then narrow it down.
Have you watched the script run? Are you certain the correct window/s is/are focused? Is the window always in the same position? You are relying on absolute mouse positions so this is important. Is the resolution the same on the target computer to yours? If not, use MouseMoveRel or try to avoid using mouse events altogether. You have no SetFocus commands before sending keystrokes. How can you be sure the correct window is focused?
Let>SCRIPT_DELAY=2000
It will slow the script down no end. So what. Let's just see if it makes any difference on this other machine. If it does we know we need to work on the timing somewhere and we can then narrow it down.
Have you watched the script run? Are you certain the correct window/s is/are focused? Is the window always in the same position? You are relying on absolute mouse positions so this is important. Is the resolution the same on the target computer to yours? If not, use MouseMoveRel or try to avoid using mouse events altogether. You have no SetFocus commands before sending keystrokes. How can you be sure the correct window is focused?
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?
I've tried that. No success.
I have watched the script run - the cursor is blinking with the text highlighted that I want to copy - and nothing happens! The window is always in the same position. I have even tried manually reselecting the text using mouse movements - that works, but still the copy paste sequence (and even the Send) does not work. I have just tried with a setfocus command - but this did did not work.
The macro begins by checking the resolution of the screen, and will only run at 1024 x 768.
I did most of this work months ago, and have a vague recollection of loading some software - I would say version 7 - on my computer to help scripts run... (my recollection is very vague...) But I do have a file in the folder I keep the original macroscheduer software in called MSSETup.exe - should I run this on the other machine?
I am clutching at straws (I do think it is one of the 0.1%!!
Thanks,
I have watched the script run - the cursor is blinking with the text highlighted that I want to copy - and nothing happens! The window is always in the same position. I have even tried manually reselecting the text using mouse movements - that works, but still the copy paste sequence (and even the Send) does not work. I have just tried with a setfocus command - but this did did not work.
The macro begins by checking the resolution of the screen, and will only run at 1024 x 768.
I did most of this work months ago, and have a vague recollection of loading some software - I would say version 7 - on my computer to help scripts run... (my recollection is very vague...) But I do have a file in the folder I keep the original macroscheduer software in called MSSETup.exe - should I run this on the other machine?
I am clutching at straws (I do think it is one of the 0.1%!!
Thanks,
Bill_no_expert
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Which is the code that you think should be doing a copy and paste? I don't see code that would do that.
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?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Have you tried CTRL+X and CTRL+V instead?
Press CTRL
Send>x
Release CTRL
Press CTRL
Send>v
Release CTRL
Press CTRL
Send>x
Release CTRL
Press CTRL
Send>v
Release CTRL
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?
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Hi BillB,
Old Keyboard Shortcuts:
Also, as Marcus recommended, why not use the newer Keyboard Shortcuts to accomplish these editting functions instead of the old? They do not make use of the SHIFT key so this eliminates any possible problems due to the unknown state of the Caps Lock key.
Hope this helps, take care.
Old Keyboard Shortcuts:
- SHIFT-Delete = Cut
CTRL-Insert = Copy
SHIFT-Insert = Paste
- CTRL-x = Cut
CTRL-c = Copy
CTRL-v = Paste
Also, as Marcus recommended, why not use the newer Keyboard Shortcuts to accomplish these editting functions instead of the old? They do not make use of the SHIFT key so this eliminates any possible problems due to the unknown state of the Caps Lock key.
Hope this helps, 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 -

That's odd, CTRL-x should perform a cut operation in Notepad. This is notepad.exe from Microsoft yes? Are you saying it does not work via the script or that it doesn't even work when you do it manually? If it doesn't even work manually, you may have bigger problems. Here's some further thoughts:BillB wrote:CTRL x does not seem to work on my computer, let alone the faster desktop (though control V does - whatever I had last stored).
- Try CTRL-x in Notepad on another PC to prove to yourself that it does indeed work.
- Can you borrow another similar keyboard? If you can, swap it out with the problem machine to see if that makes a difference.
- Re-write your script using CTRL-c (copy) instead of CTRL-X (cut). Both will get the selected characters into the clipboard. If you actually need to delete the text after it has been copied into the clipboard, just add a separate Delete operation after copying (simulate a press of the Delete key).
- Unlikely but perhaps your notepad.exe file is damaged? Get a new copy from Microsoft's website and install.
By the way, what happens when you do CTRL-x or CTRL-c on the problem machine in Notepad? Are you getting an error message at all or is just "nothing" happening (i.e. the selected text is just not going into the clipboard)?
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 -

Sorry - again I am being too brief!
Control c and x work fine on my computer when I use them manually in the application I want to control, and in notepad. They also work in a macro in Notepad. However control c does not work in the application when run by a macro - but control v does work. However shift del, and shift Ins do work on my computer in the application, even from a script. However they do not work on another desktop PC (when running in the macro - they are fine outside the macro).
The Capslock key is not on on either PC.
I have just tried ctrl c and it does not work in a script in the application on my PC.
Any more ideas??
Control c and x work fine on my computer when I use them manually in the application I want to control, and in notepad. They also work in a macro in Notepad. However control c does not work in the application when run by a macro - but control v does work. However shift del, and shift Ins do work on my computer in the application, even from a script. However they do not work on another desktop PC (when running in the macro - they are fine outside the macro).
The Capslock key is not on on either PC.
I have just tried ctrl c and it does not work in a script in the application on my PC.
Any more ideas??
Bill_no_expert
Looking at your script you are using single letter characters as variables. Specifically you are setting "c" to a value, therefore when you press ctrl then send "c" you are actually pressing ctrl plus the value of "c". Make your variables longer and more descriptive words and this might resolve some of your problems.