I have created a script that copies the contents of an email to the clipboard and then searches through the email for some specific text. The code works when I use a hot key, but fails when I try to run the compiled version. The text doesn't seem to go the clipboard. I get an error related to the position command sometimes (error in position command). Here is the code.
Press CTRL
Send>a
Release CTRL
Wait>0.5
Press CTRL
Send>c
Release CTRL
Wait>0.5
GetClipBoard>output_text
Let>TheMethod=0
Position>rder n,output_text,1,p
If>p>0,Method4
Position>rder E,output_text,1,p
If>p>0,Method3
Position>#,output_text,1,p
If>p>0,Method2
Position>Order #:,output_text,1,p
If>p>0,Method1
If>TheMethod=0,Quit
Press CTRL
Press Home
Release CTRL
If>TheMethod=4,M4Find
If>TheMethod=3,M3Find
If>TheMethod=2,M2Find
If>TheMethod=1,M1Find
Press CTRL
Send>c
Release CTRL
Wait>0.5
SetFocus>Session1
Send>5
Press Enter
Wait>0.5
Send>1
Press Enter
Wait>0.5
Press CTRL
Send>v
Release CTRL
//Press Enter
SRT>Method4
let>TheMethod=4
END>Method4
SRT>Method3
let>TheMethod=3
END>Method3
SRT>Method2
let>TheMethod=2
END>Method2
SRT>Method1
let>TheMethod=1
END>Method1
SRT>M4Find
Press F4
Send>rder n
Press Enter
Press Right
Press Right
Press CTRL
Press Right
Release CTRL
Press Shift
Press CTRL
Press Right
Release Shift
Release CTRL
END>M4Find
SRT>M3Find
Press F4
Send>rder E
Press Enter
Press Right
Press Left
Press Shift
Press CTRL
Press Right
Release Shift
Release CTRL
END>M3Find
SRT>M2Find
Press F4
Send>#
Press Enter
Press CTRL
Press Right
Release CTRL
Press Shift
Press CTRL
Press Right
Release Shift
Release CTRL
END>M2Find
SRT>M1Find
Press F4
Send>Order #:
Press Enter
Press Right
Press CTRL
Press Right
Release CTRL
Press Shift
Press Right
Press End
Release Shift
END>M1Find
SRT>Quit
MessageModal>"Could not find an Order Number"
Exit
END>Quit
Problem with a compiled script
Moderators: JRL, Dorian (MJT support)
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Just a quick thought:
May not be related tp problem, but aren't you quitting Macro Scheduler before you are finishing your subroutine?
May not be related tp problem, but aren't you quitting Macro Scheduler before you are finishing your subroutine?
Since a compiled version does not need Macro Scheduler, perhaps the Exit command is causing a problem? With the compiled version running, there might be some type of error code coming back that says Macro Scheduler not found, cannot close?SRT>Quit
MessageModal>"Could not find an Order Number"
Exit
END>Quit
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Problem with Compiled Script
Bob-I removed the Quit portion and it still failed. It says "Error in Position command." Nothing is in the Clipboard after running the script, wo I think the Control A - C commands are failing. I am running the exe from the ststem tray, so when I click on it, the last Window should be the one that is active (which is the one that I am copying from). Any other ideas?
Thanks,
Cedric
Thanks,
Cedric
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
(Sorry, no time to test now, just coming up with ideas........)
If clicking from the tray, then the last active window will be the desktop. Try adding a SetFocus> at the beginning for the window you really want to be active..
so when I click on it, the last Window should be the one that is active

Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Problem with a compiled script
THe solution is to find and set the focus to the right window.
FindWindowWithText>Message,1,w
If>w=NOT FOUND,exit
SetFocus>w
FindWindowWithText>Message,1,w
If>w=NOT FOUND,exit
SetFocus>w