Strange: I am trying to get a plotting program called Origin to print from a MS script. Pressing ALT fp is recorded as:
Press ALT
Wait>0.25
Send>f
Wait>0.06
Release ALT
Wait>0.41
Press ALT
WaitWindowOpen>Print
MoveWindow>Print,213,288
ResizeWindow>Print,438,386
Wait>0.09
Release ALT
NO P after the F!
Pasting that code into my script doesn't work. Nothing happens, as I would expect.
And writing the code from scratch in the macro doesn't work.
Has anyone seen this before? MSched works so well but this program seems to be throwing it/me for a loop.
Thanks in advance for any suggestions.
Rob
Recorded keystrokes missing
Moderators: Dorian (MJT support), JRL
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Some menus on some programs are Case Sensitive.
You said you added the missing "P", but perhaps you need "p"?
Try one of the following two samples.
Press>ALT
Send>fp
Release>ALT
or
Press>ALT
Send>f
Release>ALT
Wait>.1
Press>ALT
Send>p
Release>ALT
======================
You also must be sure the the correct window has focus and is ready to accept input before using Press/Send/Mouse types of commands.
If you provide Code samples here (best way for us to help you), be sure to Cut/Past vs. typing in what think you see.
You said you added the missing "P", but perhaps you need "p"?
Try one of the following two samples.
Press>ALT
Send>fp
Release>ALT
or
Press>ALT
Send>f
Release>ALT
Wait>.1
Press>ALT
Send>p
Release>ALT
======================
You also must be sure the the correct window has focus and is ready to accept input before using Press/Send/Mouse types of commands.
If you provide Code samples here (best way for us to help you), be sure to Cut/Past vs. typing in what think you see.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
but the recorded keystrokes don't show a p
Bob,
I've read dozens of our posts so I know you're an AI+++ expert.
I had the code as you have written it.
Press ALT
Send>fp
Release ALT
tried Waits from 0.05 to 5 seconds--no difference
BUT please also note that this is a wierd situation where the RECORDED macro does NOT record the p (I made it uppercase for emphasis after two hours of goofing with this). I recorded four different examples of alt-fp and every time only ALT, send>f release ALT was not recorded.
press alt
send>fi
release alt
works fine in same code.
here is the code, with notes about what works and what doesn't:
//open file import dialog box
Press ALT
Wait>0.08
Send>fii
Release ALT
Wait>0.08
Press Enter * 2
WaitWindowOpen>Import Wizard - Source
MoveWindow>Import Wizard - Source,612,172
ResizeWindow>Import Wizard - Source,627,444
wait>1
//enter file name
Press Tab * 3
Send>file_names_%k%
wait>1
Press Tab * 10
Press Enter
wait>6
//switch from data view to chart window
Press CTRL
Press Tab
Wait>0.2
Wait>1
// Focus the app
SetFocus>Origin 7.5*
//print the chart
//everything works fine to this point
Press ALT
Wait>1
Send>fp
Wait>1
Release ALT
Wait>1
Press Enter
//program does nothing on above section form last comment to here
Ideas?
TIA<
Rob
I've read dozens of our posts so I know you're an AI+++ expert.
I had the code as you have written it.
Press ALT
Send>fp
Release ALT
tried Waits from 0.05 to 5 seconds--no difference
BUT please also note that this is a wierd situation where the RECORDED macro does NOT record the p (I made it uppercase for emphasis after two hours of goofing with this). I recorded four different examples of alt-fp and every time only ALT, send>f release ALT was not recorded.
press alt
send>fi
release alt
works fine in same code.
here is the code, with notes about what works and what doesn't:
//open file import dialog box
Press ALT
Wait>0.08
Send>fii
Release ALT
Wait>0.08
Press Enter * 2
WaitWindowOpen>Import Wizard - Source
MoveWindow>Import Wizard - Source,612,172
ResizeWindow>Import Wizard - Source,627,444
wait>1
//enter file name
Press Tab * 3
Send>file_names_%k%
wait>1
Press Tab * 10
Press Enter
wait>6
//switch from data view to chart window
Press CTRL
Press Tab
Wait>0.2
Wait>1
// Focus the app
SetFocus>Origin 7.5*
//print the chart
//everything works fine to this point
Press ALT
Wait>1
Send>fp
Wait>1
Release ALT
Wait>1
Press Enter
//program does nothing on above section form last comment to here
Ideas?
TIA<
Rob
still not working
I tried the suggestion of
Press ALT
send>f
wait>1
send>p
Release ALT
Still not working.
Suggestions?
Press ALT
send>f
wait>1
send>p
Release ALT
Still not working.
Suggestions?
Just a thought.
Perhaps the menu doesn't like the ALT + p combination. Have you tried:
Press ALT
Send>f
Release ALT
//To open the menu
Send>p
//To activate the print process
Another thought is that the menu might have a different window name. Have you used Tools > View System Windows to see what window names are being used by the program?
Good luck,
Dick
Perhaps the menu doesn't like the ALT + p combination. Have you tried:
Press ALT
Send>f
Release ALT
//To open the menu
Send>p
//To activate the print process
Another thought is that the menu might have a different window name. Have you used Tools > View System Windows to see what window names are being used by the program?
Good luck,
Dick
fixed print, now trying SAVE to no avail!
JRL's tip to take the p out of the ALT-fp and put in on a line by itself works for printing.
But the next part should save the file with a new file name. But nothing seems to happen. The keystrokes work in the sense that I can do all these steps exactly this way manually and the program does what I want. It will not, however, save a darn file.
My suspicion is that focus is awry. How do I find out what has the focus, and how do I find out the name of the active window--see below, I tried but got nonsense back.
// Focus the app
SetFocus>Origin 7.5*
//code to read file list
GetFileList>D:\AOK_5_1_06_CHART\test\*.txt,files
............
//open file import dialog box
............
//switch from data view to chart window
Press CTRL
Press Tab
Wait>.5
//macro works to here (thanks to JRL!)
//log files don't reveal much interesting
//save the file
Let>filename=file_names_%k%
Let>filename={copy(%filename%,1,length(%filename%)-4)}
//marcus helped me get the above two lines right, works fine, returns fn w/out .txt
wait>.5
Press>ALT
Wait>.5
Send>f
Wait>.5
Release>ALT
Send>a
wait>10
Send>filename
Wait>1
Press Tab * 2
Press Enter
wait>2
//my impression is that the main program windows does not have focus
//if I do all these steps manually, they work, and they work in the order I have laid them out
//tried following
/GetActiveWindow>window_title
/Message>window_title
//returned msg: 179
//tried setting focus to '179' but error said no such window found
How to test GetActiveWindow so I can understand how it is working?
tried a script from the arhives and it returns:
Origin 7.5 - D:\AOK_5_1_06_CHART\test\test - [zzzzzzz - zzzzzzz.txt]
as the active window
So why doesn't it take the focus, and respond to the ALT-f command??????
Tools View System Windows run at point where I cannot seem to get focus reveal the following when I search for Originâ€â€
But the next part should save the file with a new file name. But nothing seems to happen. The keystrokes work in the sense that I can do all these steps exactly this way manually and the program does what I want. It will not, however, save a darn file.
My suspicion is that focus is awry. How do I find out what has the focus, and how do I find out the name of the active window--see below, I tried but got nonsense back.
// Focus the app
SetFocus>Origin 7.5*
//code to read file list
GetFileList>D:\AOK_5_1_06_CHART\test\*.txt,files
............
//open file import dialog box
............
//switch from data view to chart window
Press CTRL
Press Tab
Wait>.5
//macro works to here (thanks to JRL!)
//log files don't reveal much interesting
//save the file
Let>filename=file_names_%k%
Let>filename={copy(%filename%,1,length(%filename%)-4)}
//marcus helped me get the above two lines right, works fine, returns fn w/out .txt
wait>.5
Press>ALT
Wait>.5
Send>f
Wait>.5
Release>ALT
Send>a
wait>10
Send>filename
Wait>1
Press Tab * 2
Press Enter
wait>2
//my impression is that the main program windows does not have focus
//if I do all these steps manually, they work, and they work in the order I have laid them out
//tried following
/GetActiveWindow>window_title
/Message>window_title
//returned msg: 179
//tried setting focus to '179' but error said no such window found
How to test GetActiveWindow so I can understand how it is working?
tried a script from the arhives and it returns:
Origin 7.5 - D:\AOK_5_1_06_CHART\test\test - [zzzzzzz - zzzzzzz.txt]
as the active window
So why doesn't it take the focus, and respond to the ALT-f command??????
Tools View System Windows run at point where I cannot seem to get focus reveal the following when I search for Originâ€â€
A possible significant problem. You have press CTRL but have no release CTRL. Later in your code when you press ALT you're actually pressing CTLR + ALT which may not register with your application.//open file import dialog box
............
//switch from data view to chart window
Press CTRL
Press Tab
Wait>.5
Later,
Dick
ohmygosh!
we just watched a movie called Prime. funny. this guy has an image of his grandmother hitting herself on the head with a pan every time he misbehaves.
I NEED A VERY BIG POT for my dumb head.
Press Ctrl
Press Tab
Release CTRL--that did it!
Not as insane as I thought it was. Though not as easy as some other pro I've kludged together for well behaving programs. Thanks a bunch!!!!!
I NEED A VERY BIG POT for my dumb head.
Press Ctrl
Press Tab
Release CTRL--that did it!
Not as insane as I thought it was. Though not as easy as some other pro I've kludged together for well behaving programs. Thanks a bunch!!!!!