Problem with a compiled script

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Cedric Fairweather

Problem with a compiled script

Post by Cedric Fairweather » Wed Feb 11, 2004 9:14 pm

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

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Feb 11, 2004 10:40 pm

Just a quick thought:

May not be related tp problem, but aren't you quitting Macro Scheduler before you are finishing your subroutine?
SRT>Quit
MessageModal>"Could not find an Order Number"
Exit
END>Quit
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?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Cedric Fairweather

Problem with Compiled Script

Post by Cedric Fairweather » Thu Feb 12, 2004 2:55 pm

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

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Feb 12, 2004 4:34 pm

(Sorry, no time to test now, just coming up with ideas........)
so when I click on it, the last Window should be the one that is active
:idea: 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..
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Cedric Fairweather

Problem with a compiled script

Post by Cedric Fairweather » Thu Feb 12, 2004 6:54 pm

THe solution is to find and set the focus to the right window.
FindWindowWithText>Message,1,w
If>w=NOT FOUND,exit
SetFocus>w

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts