Macro not adhering to wait commands...

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
DaveKofo
Newbie
Posts: 2
Joined: Sat May 28, 2005 6:29 am

Macro not adhering to wait commands...

Post by DaveKofo » Sat May 28, 2005 6:33 am

Hello,

This macro won't listen to wait commands and INPUT_PASSWORD for some reason... Can you help me out? Sorry if it's pretty messy, I'm a bit new to all of this.
-----------------------------------------------------------------------------------
CAPSOFF
READINIFILE>c:\program files\ERAlink\login.ini,SETUP,true,setupvar
if>setupvar=0,passchange,setup
label>setup
deletefile>c:\program files\ERAlink\login.ini
WRITELN>c:\program files\ERAlink\login.ini,1,[SETUP]
WRITELN>c:\program files\ERAlink\login.ini,2,[PORTLOGIN]
WRITELN>c:\program files\ERAlink\login.ini,3,[USERLOGIN]
let>msg_stayontop=1
let>msg_centered=1
messagemodal>Welcome to ERA Login manager. As this is the first time you have used the login manager, we need to setup your connection. Please answer the following 4 questions in order to begin.
input>alpha,What is your port login?,era123
if>alpha=,end
LET>INPUT_PASSWORD=1
input>bravo,What is your port password?
if>bravo=,end
LET>INPUT_PASSWORD=0
input>charlie,What is your login name?
if>charlie=,end
LET>INPUT_PASSWORD=1
input>delta,What is your login password?
if>delta=,end
LET>INPUT_PASSWORD=0
LET>ISTRUE=1
editinifile>c:\program files\ERAlink\login.ini,SETUP,true,ISTRUE
editinifile>c:\program files\ERAlink\login.ini,PORTLOGIN,alogin,alpha
editinifile>c:\program files\ERAlink\login.ini,PORTLOGIN,portpasse,bravo
editinifile>c:\program files\ERAlink\login.ini,USERLOGIN,blogin,charlie
editinifile>c:\program files\ERAlink\login.ini,USERLOGIN,passs,delta
let>msg_stayontop=1
let>msg_centered=1
messagemodal>Thank you for completing the setup process.
goto>goahead
label>passchange
ask>Have you changed your password?,apassword
if>apassword=NO,goahead
let>INPUT_PASSWORD=1
input>writepass,Please enter your new password:
if>writepass=,end
input>writepass2,Please confirm new password:
if>writepass2=,end
if>writepass=writepass2,update,error
label>error
let>MSG_STAYONTOP=1
LET>MSG_CENTERED=1
MESSAGEMODAL>ERROR, passwords do not match, please try again...
Passwords do not match,
please retype...
goto>passchange
label>update
editinifile>c:\program files\ERAlink\login.ini,USERLOGIN,passs,writepass2
label>goahead
Let>RP_WINDOWMODE=3
Run Program>C:\Program Files\ERALink\wInteg.exe "C:\Program Files\ERALink\Session\ERALink17.wic"
wait>4
setfocus>ERA Port*
capsoff
readinifile>c:\program files\ERAlink\login.ini,PORTLOGIN,alogin,user
send>user
press enter
wait>2
readinifile>c:\program files\ERAlink\login.ini,PORTLOGIN,portpasse,portpass
send>portpass
press enter
wait>2
CAPSOFF
readinifile>c:\program files\ERAlink\login.ini,USERLOGIN,blogin,user2
send>user2
press enter
wait>2
readinifile>c:\program files\ERAlink\login.ini,USERLOGIN,passs,pass2
send>pass2
press enter
label>end
----------------------------------------------------------------------------------

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 » Sat May 28, 2005 6:53 am

Just a quick look and saw need for a few suggestions

When using Run Program, also use Let>RP_WAIT=1 vs. using Wait>
It is not usually possible to always have Wait> with the correct value. Using the variable RP_WAIT will halt macro from running until the Run Program> program has completed.
----------------------------------
Don't need to repeat variable settings like msg centering, CAPSOFF, etc.. Once they are defined they will remain until you toggle the value.

-------------------------------------------
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

DaveKofo
Newbie
Posts: 2
Joined: Sat May 28, 2005 6:29 am

Wait commands ignored

Post by DaveKofo » Tue May 31, 2005 2:06 am

Appreciate the reply Bob,

But do you think that less toggling of values like capsoff, MSG_CENTERED etc, could have a bearing on why my wait commands are being ignored in the second half of my script?

As far as the RP_WAIT goes I did try that but the application loads a kind of telnet interface inside inside the main program which is why rp_wait is unusable... or is it? You're probably more qualified to answer that one.


Cheers

Dave

Brearley
Newbie
Posts: 4
Joined: Fri Jun 10, 2005 4:26 am

RP_WAIT

Post by Brearley » Fri Jun 10, 2005 4:50 am

I am an apsolute beginner, so be kind.

I am trying to apply a wait comand in my script simply to allow one program to finish before starting the next. RP_WAIT=1 doesn't seem to work for me.

I think the PR_WAIT is working but the second part of my script executefile does not execute.

If I remove the first two line then the excutefile works fine. It seems that the macro just ends after the wait command.

Any suggestions

(Item1.exe is script made into an executable file to display a a Mpeg file full screen)

I am wanting to then run a screensaver immediately after the Mpeg finishes playing.

Example

Run Program>C:\test\Item1.exe
let>RP_WAIT=1
Executefile>c:\windows\system32\ssmypics.scr

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Fri Jun 10, 2005 5:55 am

Hello Brearley,

Assuming That The Program Your Are Executing In Your Script Has The Window Title Item1.exe

Try Something Like This
Run Program>C:\test\Item1.exe
WaitWindowClosed>Item1.exe
Executefile>c:\windows\system32\ssmypics.scr

Example Script
Run Program>winver
WaitWindowClosed>About Windows
Executefile>c:\windows\system32\ssmypics.scr

The Above Script Will Open The Windows Version Information. As Soon As You Close It, It Will Load Your ssmypics.scr Note If You Copy It From The Forum Make Sure You Remove The Trailing Spaces.

Hope It Helps.
FIREFIGHTER

Brearley
Newbie
Posts: 4
Joined: Fri Jun 10, 2005 4:26 am

Post by Brearley » Fri Jun 10, 2005 6:18 am

Thanks Mate

I will give it a try and let you know how I get on. Cheers

Brearley
Newbie
Posts: 4
Joined: Fri Jun 10, 2005 4:26 am

Post by Brearley » Fri Jun 10, 2005 7:04 am

Unfortunately this made no difference.

I had tried the "waitwindowclosed" command before without any luck.

If I have no wait command at all, then it jumps straight into the screen saver, but if i move the mouse and stop the screen saver the mpeg will still be running in the background.

To give you an idea of what i am trying to do.

The purpose of this sheduled task is so that I can have advertising material running on a big screen contected to the computer.

Might be a series of Jpegs associated to the screen saver, then every 5 minutes or so I want to play a MPEG to attract attention, then as soon as the Mpeg finishes playing jump back to the Jpeg screen saver.

I have this working now using normal windows screen saver but I am trying to get away from the 1 minute delay before screen saver kicks in.

I would appreciate any futher advice Thanks

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri Jun 10, 2005 7:50 am

CyberCitizen missed out an important step. Before waiting for the window to not be there you must wait for to be there. Without waiting for it to exist the script will move on to the waitwindowclosed so quickly that it will almost certainly pass as the window has not yet been fully created. So CyberCitizen's example should really be like this:

Run Program>C:\test\Item1.exe
WaitWindowOpen>Item1's Window Title
WaitWindowClosed>Item1's Window Title
Executefile>c:\windows\system32\ssmypics.scr

Note also that WaitWindowOpen/Closed take the window title as the parameter not the executable name. Can also take a partial window title followed by an asterisk.
MJT Net Support
[email protected]

Brearley
Newbie
Posts: 4
Joined: Fri Jun 10, 2005 4:26 am

Post by Brearley » Fri Jun 10, 2005 7:58 am

Thanks for that, I was just about to give up.

Yes that works fine.

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Jun 10, 2005 1:37 pm

DaveKofo,

It looks to me like you are opening an application, then answering questions within that application, if that is the case RP_WAIT=1 will not work. Having RP_WAIT set to 1 will cause the macro to pause until the application is closed. What will work is to use WaitWindowOpen and maybe a short wait after that, something like:

Run Program>C:\Program Files\ERALink\wInteg.exe "C:\Program Files\ERALink\Session\ERALink17.wic"
WaitWindowOpen>ERA Port*
wait>4
setfocus>ERA Port*

As for your waits not working later on in the script: Are you sure they're not working? I've never had a wait not work. Test them by making them excessively long. Make them 30 seconds and see if you detect them. Also, make sure you don't have any trailing spaces.

Good Luck.

=======================================

For Brearley,

Hopefully CyberCitizen and Support got you working again. For future reference, the sample you submitted wouldn't work because the RP_WAIT =1 needs to be placed ahead of the Run Program statement. Like this:

let>RP_WAIT=1
Run Program>C:\test\Item1.exe
Executefile>c:\windows\system32\ssmypics.scr

Also RP_WAIT has no effect on Executefile, it only pauses the macro when you use Run Program.

Hope this was helpful,
Dick

macrunning
Pro Scripter
Posts: 68
Joined: Wed May 04, 2005 10:24 pm

Post by macrunning » Fri Jun 10, 2005 3:23 pm

DaveKoro,
I was wondering why your using all the Eralink ini files for your login. I too use EraLink for my auto dealers and executing the Eralink.exe file and logging in as you normally would works very easy. You just need to use keyboard shortcuts to login and using wait>sometime has always worked for me. The only trouble I've run into is WaitWindowOpen>sometime seems to run to fast when you need to SEND>text afterward so I usually place an additional wait>time after the waitwindowopen>time command. If you need any help with EraLink let me know I've been working on scripts to interface with it for the last couple of months. Saves so much time downloading dealer inventories. Good luck!

macrunning
Pro Scripter
Posts: 68
Joined: Wed May 04, 2005 10:24 pm

Post by macrunning » Fri Jun 10, 2005 4:12 pm

In Regards to the program DaveKoro is using I was wondering, since it is a sort of telnet program is there a way to figure out what the screen reads back to you. For instance the program is used to dial into another system and when doing such it will spit back a reading of 'CONNECT 28800' to you on the screen if it was able to successfully connect to the remote system. I'm just wondering if there is a way to read this variable so that if it reads back something other than 'CONNECT 28800' then I can tell the script to do something else. Hope that made sense

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Jun 10, 2005 4:46 pm

Macrunning,

If the telnet is occuring in a DOS screen you can retreive the screen info with something like this:

SetFocus>WindowName*
MouseMoveRelative>10,10
LClick
Wait>1
Send>e
Wait>1
Send>s
Wait>1
Press Enter
Wait>1
GetClipBoard>result
MDL>%result%

If it is some sort of message window you might try using "GetWindowText"

Hope this helps,
Dick

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