Script Controls A Temperture Recorder Via Ethernet

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
AllTemp
Newbie
Posts: 13
Joined: Sat Oct 23, 2004 5:21 am
Location: Southern California
Contact:

Script Controls A Temperture Recorder Via Ethernet

Post by AllTemp » Sun Jun 12, 2005 8:18 am

New eroor when macro executes. If I click on ignore it completes okay. Bu of course this needs to run seemlessly without user intervention. What has changed that would cause this.

here's the error screen Image

And a copy of my script.
// C:\Program Files\MJT Net Ltd\Macro Scheduler\Cold Storage Coolers.scp
// Recorded on Saturday, June 11, 2005, at 11:26 PM

// Run program and wait for it to be active
Change Directory>C:\Program Files\MadgeTech 2.00
Run Program>C:\Program Files\MadgeTech 2.00\MadgeTech2.exe
WaitWindowOpen>MadgeTech

// Ensure it always opens with the same dimensions
MoveWindow>MadgeTech,-4,-4
ResizeWindow>MadgeTech,1032,746

// Focus the app
SetFocus>MadgeTech

//Recorded Events
Let>WW_TIMEOUT=5
CapsOff
MouseMove>435,527
WaitWindowOpen>MadgeTech - [Graph]
MoveWindow>MadgeTech - [Graph],-4,-4
ResizeWindow>MadgeTech - [Graph],1032,746
Wait>7.8
Press CTRL
Wait>0.66
Send>r
Wait>0.34
Release CTRL
Wait>945.44
Press CTRL
Wait>0.52
Send>s
WaitWindowOpen>MadgeTech
MoveWindow>MadgeTech,392,335
ResizeWindow>MadgeTech,248,126
Wait>0.25
Release CTRL
Wait>2.31
Press Enter
WaitWindowOpen>Save Data File...
MoveWindow>Save Data File...,0,0
ResizeWindow>Save Data File...,563,419
Wait>5.86
Year>yyyy
Month>mm
Day>dd
Send>ColdStorage_%yyyy%%mm%%dd%
Wait>7.55
Press Enter
WaitWindowOpen>Save Data File...
MoveWindow>Save Data File...,359,335
ResizeWindow>Save Data File...,314,126
Wait>5.2
Press Tab
Wait>0.73
Press Enter
WaitWindowOpen>MadgeTech - [Graph - (Unsaved)]
MoveWindow>MadgeTech - [Graph - (Unsaved)],-4,-4
ResizeWindow>MadgeTech - [Graph - (Unsaved)],1032,746
Wait>0.05
MouseMove>261,32
Wait>17.13
LClick
Wait>0.39
MouseMove>312,313
Wait>1.84
LClick
WaitWindowOpen>Microsoft Excel
MoveWindow>Microsoft Excel,-4,-4
ResizeWindow>Microsoft Excel,1032,746
Wait>0.14
MouseMove>37,40
Wait>8.44
LClick
Wait>0.89
MouseMove>57,147
Wait>1.52
LClick
WaitWindowOpen>Save As
MoveWindow>Save As,209,169
ResizeWindow>Save As,582,291
Wait>0.08
MouseMove>63,168
Wait>3.12
Press Shift * 3
Year>yyyy
Month>mm
Day>dd
Send>ColdStorage_%yyyy%%mm%%dd%
Wait>2.08
MouseMove>471,215
Wait>2.73
LClick
Wait>0.16
MouseMove>400,374
Wait>2.29
LClick
Wait>0.16
MouseMove>432,345
Wait>3.87
LDblClick
Wait>2.31
MouseMove>262,242
Wait>1.5
LDblClick
Wait>1.65
MouseMove>712,244
Wait>1.59
LClick
WaitWindowOpen>Microsoft Excel
MoveWindow>Microsoft Excel,203,354
ResizeWindow>Microsoft Excel,623,115
Wait>0.08
MouseMove>478,447
Wait>3.01
LClick
WaitWindowOpen>Save As
MoveWindow>Save As,209,169
ResizeWindow>Save As,582,291
WaitWindowOpen>Microsoft Excel - Book1
MoveWindow>Microsoft Excel - Book1,-4,-4
ResizeWindow>Microsoft Excel - Book1,1032,746
Wait>0.05
MouseMove>38,36
Wait>7.7
LClick
Wait>0.96
MouseMove>71,99
Wait>4.04
LClick
Wait>0.22
MouseMove>20,39
Wait>2
LClick
Wait>0.47
MouseMove>76,413
Wait>1.85
LClick
WaitWindowOpen>MadgeTech - [S
MoveWindow>MadgeTech - [S,\Data recorder\ColdStorage.csv],1028
ResizeWindow>MadgeTech - [S,4294967292,4294966268
MouseMove>171,258
Wait>13.91
Press CTRL
Wait>0.78
Send>q
Wait>0.61
Release CTRL
Wait>6.56
Press ALT
Wait>0.05
Press CTRL
________
PC50
Last edited by AllTemp on Wed Feb 02, 2011 11:00 pm, edited 1 time in total.

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

Post by support » Sun Jun 12, 2005 9:02 am

This error is caused by the SetFocus command which is not detecting the window and doesn't think it exists. Probably because the window title is now something other then just MadgeTech - it has changed since the recording was made. If the script works anyway you could just remove the SetFocus line (line 14) or change it to:

SetFocus>MadgeTech*

By adding the asterisk it will find any window title containing the word MadgeTech which your screen shot shows is the case - the window title contains the word MadgeTech.
MJT Net Support
[email protected]

AllTemp
Newbie
Posts: 13
Joined: Sat Oct 23, 2004 5:21 am
Location: Southern California
Contact:

Still Errors

Post by AllTemp » Sun Jun 12, 2005 9:26 am

ried adding the * and then removing line 14 still getting the same error message...
________
vaporizer
Last edited by AllTemp on Wed Feb 02, 2011 11:00 pm, edited 1 time in total.

AllTemp
Newbie
Posts: 13
Joined: Sat Oct 23, 2004 5:21 am
Location: Southern California
Contact:

Update

Post by AllTemp » Sun Jun 12, 2005 9:35 am

This all started after I had upgaded Macro Schdeuler.

I tried adding the * and also deleting the focus line ...

What appears to work is I see Madge Tech windows named in the script MadgTech -[Graph] by adding this instead of the * every where I see MadgeTech called out the script is running. Any comments.
// C:\Program Files\MJT Net Ltd\Macro Scheduler\Cold Storage Coolers.scp
// Recorded on Saturday, June 11, 2005, at 11:26 PM

// Run program and wait for it to be active
Change Directory>C:\Program Files\MadgeTech 2.00
Run Program>C:\Program Files\MadgeTech 2.00\MadgeTech2.exe
WaitWindowOpen>MadgeTech - [Graph]

// Ensure it always opens with the same dimensions
MoveWindow>MadgeTech - [Graph],-4,-4
ResizeWindow>MadgeTech - [Graph],1032,746
// Focus the app
SetFocus>MadgeTech - [Graph]
//Recorded Events
Let>WW_TIMEOUT=5
CapsOff
MouseMove>435,527
WaitWindowOpen>MadgeTech - [Graph]
MoveWindow>MadgeTech - [Graph],-4,-4
ResizeWindow>MadgeTech - [Graph],1032,746
Wait>7.8
Press CTRL
Wait>0.66
Send>r
Wait>0.34
Release CTRL
Wait>945.44
Press CTRL
Wait>0.52
Send>s
WaitWindowOpen>MadgeTech
MoveWindow>MadgeTech,392,335
ResizeWindow>MadgeTech,248,126
Wait>0.25
Release CTRL
Wait>2.31
Press Enter
WaitWindowOpen>Save Data File...
MoveWindow>Save Data File...,0,0
ResizeWindow>Save Data File...,563,419
Wait>5.86
Year>yyyy
Month>mm
Day>dd
Send>ColdStorage_%yyyy%%mm%%dd%
Wait>7.55
Press Enter
WaitWindowOpen>Save Data File...
MoveWindow>Save Data File...,359,335
ResizeWindow>Save Data File...,314,126
Wait>5.2
Press Tab
Wait>0.73
Press Enter
WaitWindowOpen>MadgeTech - [Graph - (Unsaved)]
MoveWindow>MadgeTech - [Graph - (Unsaved)],-4,-4
ResizeWindow>MadgeTech - [Graph - (Unsaved)],1032,746
Wait>0.05
MouseMove>261,32
Wait>17.13
LClick
Wait>0.39
MouseMove>312,313
Wait>1.84
LClick
WaitWindowOpen>Microsoft Excel
MoveWindow>Microsoft Excel,-4,-4
ResizeWindow>Microsoft Excel,1032,746
Wait>0.14
MouseMove>37,40
Wait>8.44
LClick
Wait>0.89
MouseMove>57,147
Wait>1.52
LClick
WaitWindowOpen>Save As
MoveWindow>Save As,209,169
ResizeWindow>Save As,582,291
Wait>0.08
MouseMove>63,168
Wait>3.12
Press Shift * 3
Year>yyyy
Month>mm
Day>dd
Send>ColdStorage_%yyyy%%mm%%dd%
Wait>2.08
MouseMove>471,215
Wait>2.73
LClick
Wait>0.16
MouseMove>400,374
Wait>2.29
LClick
Wait>0.16
MouseMove>432,345
Wait>3.87
LDblClick
Wait>2.31
MouseMove>262,242
Wait>1.5
LDblClick
Wait>1.65
MouseMove>712,244
Wait>1.59
LClick
WaitWindowOpen>Microsoft Excel
MoveWindow>Microsoft Excel,203,354
ResizeWindow>Microsoft Excel,623,115
Wait>0.08
MouseMove>478,447
Wait>3.01
LClick
WaitWindowOpen>Save As
MoveWindow>Save As,209,169
ResizeWindow>Save As,582,291
WaitWindowOpen>Microsoft Excel - Book1
MoveWindow>Microsoft Excel - Book1,-4,-4
ResizeWindow>Microsoft Excel - Book1,1032,746
Wait>0.05
MouseMove>38,36
Wait>7.7
LClick
Wait>0.96
MouseMove>71,99
Wait>4.04
LClick
Wait>0.22
MouseMove>20,39
Wait>2
LClick
Wait>0.47
MouseMove>76,413
Wait>1.85
LClick
WaitWindowOpen>MadgeTech - [S
MoveWindow>MadgeTech - [S,\Data recorder\ColdStorage.csv],1028
ResizeWindow>MadgeTech - [S,4294967292,4294966268
MouseMove>171,258
Wait>13.91
Press CTRL
Wait>0.78
Send>q
Wait>0.61
Release CTRL
Wait>6.56
Press ALT
Wait>0.05
Press CTRL
________
ultimate fighters
Last edited by AllTemp on Wed Feb 02, 2011 11:00 pm, edited 1 time in total.

AllTemp
Newbie
Posts: 13
Joined: Sat Oct 23, 2004 5:21 am
Location: Southern California
Contact:

Correction

Post by AllTemp » Sun Jun 12, 2005 9:39 am

I was mistaken I mus thave ran the macro with the window already pen I am getting the same erros here, thank you.
________
Ford Model K picture
Last edited by AllTemp on Wed Feb 02, 2011 11:00 pm, edited 1 time in total.

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

Post by support » Sun Jun 12, 2005 10:57 am

To help further we need to know which line causes the error. To do that you will need to step through the script with the debugger and let us know at which line the error occurs. Or enable logging and grab a copy of the log at the point the error happens (open the log file before OKing the error message).
MJT Net Support
[email protected]

AllTemp
Newbie
Posts: 13
Joined: Sat Oct 23, 2004 5:21 am
Location: Southern California
Contact:

Debugger/Errors

Post by AllTemp » Wed Jun 15, 2005 1:49 pm

It appears that this error only occurs at random and when the error is occuring you may not look at the log or change screens, the computer beeps... You must abort the error to proceed. No log is recorded.

I can manual start the script it runs fine, but to leave the script to runon it's on it fails, or if you do a quick lunch it fails.

I need an explanation on running debugger. When executing debugger F8 steps thru each line. If it fails what would I look for ?
________
Ferrari 312B
Last edited by AllTemp on Wed Feb 02, 2011 11:01 pm, edited 1 time in total.

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 Jun 15, 2005 3:35 pm

When doing Single Step, turn on Debug/Show Watch List. This will enable you to see the values of the variables as the script is processed.

No log is generated unless you enable logging. Go to Script Properties, and select Logging Tab. Put a checkmark in box to Log Progress of Macro. Probably put in a check to Empty before each run, (at least for the copy that you might submit here). There are three log levels, I usually use the second one, "Log Entry BEFORE Running Step".

It is also useful to enclose all variables in % if writing to logs. That will show you the value of the variable vs. just the variable name.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

AllTemp
Newbie
Posts: 13
Joined: Sat Oct 23, 2004 5:21 am
Location: Southern California
Contact:

Script Is Set to Log

Post by AllTemp » Thu Jun 16, 2005 4:12 am

Logging is enabled however when this error occurs there is no log generated or if there it deletes when you click on the error abort/retry...

You cannot view the log during the errors.

You guys forget were not all at this every day... I don't knwo what to look for if I saw and error if debugg revealed one.... Lookign at the variabels menas greek to me and I don't speak it..
________
herbalaire reviews
Last edited by AllTemp on Wed Feb 02, 2011 11:01 pm, edited 1 time in total.

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 Jun 16, 2005 4:54 am

SKIP - Double posted in error
Last edited by Bob Hansen on Thu Jun 16, 2005 2:14 pm, edited 2 times in total.

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 Jun 16, 2005 5:00 am

A number of observations:

1. Since your log is "being deleted", remove the check mark that I suggested in earlier posting:
Probably put in a check to Empty before each run,
2. This entire macro was not just recorded. It has been edited manually also. The following lines are creating variables:

Code: Select all

Year>yyyy
Month>mm
Day>dd
Any Let> statement creates a variable.

And this line is using the variables yyyy,mm,dd.

Code: Select all

Send>ColdStorage_%yyyy%%mm%%dd% 
3. Any Let> statement is creating a variable. Any command that has a "result" parameter is creating a variable named "result"

4. Even if "variables" mean nothing to you, you should still be able to Single Step through macro and let us know what line you get the error with.

5. Be sure that you have done Edit/Remove Trailing Spaces and saved the file.

6. Suggestion by Support to add the "*" in WindowName should happen on every command that uses a WindowName, not just on the SetFocus> command.

This is confusing to me:

Code: Select all

WaitWindowOpen>MadgeTech - [S
MoveWindow>MadgeTech - [S,\Data recorder\ColdStorage.csv],1028
ResizeWindow>MadgeTech - [S,4294967292,4294966268 
I would have expected all three lines to have the same window name. I normally would have thought that "MadgeTech*" would do the trick for you.

7. You are doing some Send> values but have not repeated SetFocus> to make sure the correct window will receive the commands. You are moving and resizing windows but may need a delay or WaitReady>1 commands to make sure system is ready to accept CTRL, Press, Send and other keystrokes, mouse clicks, etc. It may be helpful to do a WaitWindowOpen>, SetFocus, WaitRead> string of commands before every set of Send/Press/MouseMoveRel> type of commands. And may sometimes need a Wait> between some of them.

We can only diagnose a problem when you provide more specific explanation of exactly when "it fails", on which line, what are the symptoms. The picture you provide is great, but what was the line in your script that triggered it? It is possible that none of the suggestions in last paragraph are needed, or maybe a combination of some of them. Still do not have enough information about what line triggers the error. Try again to record and review a log file. And/or Single Step through the script. This can be resolved with the right input from you.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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

Post by support » Thu Jun 16, 2005 2:33 pm

Next time the error message is on the screen do the following:

1. Leave the error box there, don't touch it.
2. Open Windows Explorer
3. Locate the log file (You've probably put it in the Macro Scheduler folder)
4. Attach the log file to an email and send it to support or post it here.

Then we can see how far the script has got and therefore at which line the error occurs.

However, I'm quite sure the error has occured at this line:

SetFocus>MadgeTech

The reason is that the window title is not "MadgeTech". No such window exists. Change this line to:

SetFocus>MadgeTech*
MJT Net Support
[email protected]

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

Post by support » Thu Jun 16, 2005 2:41 pm

Looking at your recorded macro I expect a window called MadgeTech opens briefly after running the application, but the window changes almost instantly to MadgeTech - [Graph] as shown by the subesequent lines of code after the Run Program. This could be happening so fast that the SetFocus line fails. Try changing your script to the following:

// C:\Program Files\MJT Net Ltd\Macro Scheduler\Cold Storage Coolers.scp
// Recorded on Saturday, June 11, 2005, at 11:26 PM

// Run program and wait for it to be active
Change Directory>C:\Program Files\MadgeTech 2.00
Run Program>C:\Program Files\MadgeTech 2.00\MadgeTech2.exe

//Recorded Events
Let>WW_TIMEOUT=5
CapsOff
MouseMove>435,527
WaitWindowOpen>MadgeTech - [Graph]
MoveWindow>MadgeTech - [Graph],-4,-4
ResizeWindow>MadgeTech - [Graph],1032,746
SetFocus>MadgeTech - [Graph]
Wait>7.8
Press CTRL
Wait>0.66
Send>r
Wait>0.34
Release CTRL
etc
etc
MJT Net Support
[email protected]

AllTemp
Newbie
Posts: 13
Joined: Sat Oct 23, 2004 5:21 am
Location: Southern California
Contact:

Edited Script

Post by AllTemp » Fri Jun 17, 2005 3:34 am

edite dthe script Support as you sugegsted and it has ot error ... We'll keep an eye on it.

Question:

When the script sends the ctrl&r command it is reaching out on a serial port to an iServer and starts receiving data packets, each time the program runs these packets increase. For example it is currently reading 1031 bytes ofr a toal of 115+ packets. Thsi is why the wait time is so long.

On the wait line where it reads Press CTRL
Wait>0.45
Send>r
Wait>0.28
Release CTRL
Wait>941.71

This is fine for the current packets but as they increase in numbers I need somehting here to reconize this and wait . How would I do this?

Thanks :D
________
vaporizer

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