Using MAcro Scheduler To Start Software...

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Lumumba

Post by Lumumba » Sun Oct 24, 2004 3:41 pm

Month>MM
Day>DD
YEAR>YYYY

WWO>Save Data File...
IfFileExists>C:\Datalogger\ColdStorage_%MM%%DD%%YYYY%.dat, Message

Let>MF_RENAME=1
MoveFile>C:\Datalogger\ColdStorage.dat,C:\Datalogger\ColdStorage_%MM%%DD%%YYYY%.dat
Let>MF_RENAME=0

//Maybe you need some tweaking so there's no access violation between the copy/move and the saving/replacing of ColdStorage.dat

SET>Save Data File...
Press TAB
Press ENTER
Goto>Exit

Label>Message
SET>Save Data File...
Press ENTER
MessageModal>ColdStorage_%MM%%DD%%YYYY%.dat%CRLF%already exists !

Label>Exit
MessageModal>Done.
Untested & pacifistic 8)

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

Programming Script

Post by AllTemp » Sun Oct 24, 2004 5:40 pm

I don't understand all this scripting code. What I need to do is find a programmer familar with Macro Scheduler to put this together for me.

What I have been able to do and figure out is by creating the process I need accomlished unattened by using a start macro, a download data from device macro, a save data macro and a end program macro it works.

But I don't know what complications may arise if any.

Looking at the script provided to save the data file, I don't have a clue as to hwo to insert it and tweak it.

I tried capturing a log but it seems to say the same thign as the script, showign no errors jsut start top end of the macro.

The macro stats by opening the program and ait's next command is a ctrl r which startsa the downloading from the data lgger. Thats where I there must be a problem. It take some time to fetch the data it is recived in packets 1-9 from a serial device on the end of a ethernet cable connected to the data recorder at 2400 baud. I uses a com port redirector that enables the serial port to see the device at it's ip address. It's made by Newport Electronic ( Micro Server)

Here is the script for eachrocess that is allowing the procedure to complete I have each macro starting seperately.

Start:
// C:\Program Files\MJT Net Ltd\Macro Scheduler\Recorder BackUp.scp
// Recorded on Sunday, October 24, 2004, at 03:09 AM

// 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>

// Ensure it always opens with the same dimensions
MoveWindow>,225,240
ResizeWindow>,574,287

// Focus the app
SetFocus>

//Recorded Events
Let>WW_TIMEOUT=5
CapsOff
MouseMove>422,504
Wait>3.03
Press CTRL
WaitWindowOpen>MadgeTech
MoveWindow>MadgeTech,-4,-4
ResizeWindow>MadgeTech,1032,742
Wait>0.86
Send>r
Wait>0.66
Release CTRL
WaitWindowOpen>MadgeTech - [Graph]
MoveWindow>MadgeTech - [Graph],-4,-4
ResizeWindow>MadgeTech - [Graph],1032,742
Wait>40.89
Press Enter
WaitWindowOpen>MadgeTech Data Recorder Software
MoveWindow>MadgeTech Data Recorder Software,330,194
ResizeWindow>MadgeTech Data Recorder Software,363,152
Wait>1.39

Fetch Data:
// C:\Program Files\MJT Net Ltd\Macro Scheduler\Recorder Download Data.scp
// Recorded on Sunday, October 24, 2004, at 03:00 AM

//Recorded Events
Let>WW_TIMEOUT=5
CapsOff
MouseMove>218,40
Wait>2.08
LClick
Wait>0.75
MouseMove>225,72
Wait>0.82
LClick
WaitWindowOpen>MadgeTech - [Graph]
MoveWindow>MadgeTech - [Graph],-4,-4
ResizeWindow>MadgeTech - [Graph],1032,742
Wait>65.94
Press CTRL
Wait>0.05
Press ALT
Wait>0.53
Press ALT

Save Data:
// C:\Program Files\MJT Net Ltd\Macro Scheduler\Recorder Data Save.scp
// Recorded on Sunday, October 24, 2004, at 03:00 AM

//Recorded Events
Let>WW_TIMEOUT=5
CapsOff
MouseMove>634,240
Wait>1.64
LClick
WaitWindowOpen>MadgeTech - [Graph - (Unsaved)]
MoveWindow>MadgeTech - [Graph - (Unsaved)],-4,-4
ResizeWindow>MadgeTech - [Graph - (Unsaved)],1032,742
Wait>0.73
MouseMove>67,59
Wait>4.28
LClick
WaitWindowOpen>MadgeTech
MoveWindow>MadgeTech,392,333
ResizeWindow>MadgeTech,248,126
Wait>0.02
MouseMove>496,435
Wait>2.07
LClick
WaitWindowOpen>Save Data File...
MoveWindow>Save Data File...,0,0
ResizeWindow>Save Data File...,563,419
Wait>5.46
Send>ColdStorage
Wait>1.72
MouseMove>508,340
Wait>1.15
LClick
WaitWindowOpen>Save Data File...
MoveWindow>Save Data File...,359,333
ResizeWindow>Save Data File...,314,126
MouseMove>471,430
Wait>2.59
LClick
WaitWindowOpen>MadgeTech - [Graph - (Unsaved)]
MoveWindow>MadgeTech - [Graph - (Unsaved)],-4,-4
ResizeWindow>MadgeTech - [Graph - (Unsaved)],1032,742
Wait>4.49
Press CTRL
Wait>0.03
Press ALT

The last macro I failed to save to display here is a CTRL-Q which closes the program.


Instead of having seperate macros can I copy and paste this code inorder of need thru the editor to creat a sincge macro?
________
marijuana vaporizer
Last edited by AllTemp on Wed Feb 02, 2011 11:00 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 » Sun Oct 24, 2004 7:22 pm

You asked:
Instead of having seperate macros can I copy and paste this code inorder of need thru the editor to creat a sincge macro?
YES,
Make a new macro with a new name, copy and paste the sections of each of the recorded macros into the new macro. Be sure to remove all Trailing Spaces. Use the Editor, Edit, Remove Trailing Spaces. And save it under its new name.

Good way to learn Macro Scheduler. Record the macros, pull them together, then edit them as needed using the online Help and Samples. Submit the script here identifying where you are having problems, using Log to help ID how/where it is failing.
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:

Trailing Strings

Post by AllTemp » Sun Oct 24, 2004 8:05 pm

See the Trailing Strings on the pull down menu but what exactly does that command invoke? Not sure what your talking about regaridng remove trailing spaces?
Image
________
easy vape vaporizer
Last edited by AllTemp on Wed Feb 02, 2011 11:00 pm, edited 1 time in total.

Lumumba

Post by Lumumba » Sun Oct 24, 2004 9:22 pm

Below I've shrinked your code. Well you've to fix it, test it, discuss it. :wink:

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

// Focus the app
SetFocus>MadgeTech
//Open one of its menu items via a KeyCombo
Press CTRL
Send>r
Release CTRL

WaitWindowOpen>MadgeTech - [Graph]
//Confirm whatever has appeared with pressing the ENTER key
Press Enter
WaitWindowOpen>MadgeTech Data Recorder Software

//Fetch Data
Let>WW_TIMEOUT=5
//I expect any MouseCoords won't work now unless you'd replace them with RelativeMouseCoords, or better
//you should replace any MouseClick with a KeyCombo (i.e. ALT+E).

MouseMove>218,40
LClick
MouseMove>225,72
LClick

WaitWindowOpen>MadgeTech - [Graph]
//Interesting KeyCombo, unfortunately no "closing" commands --> Release CTRL & Release ALT :!:
Press CTRL
Press ALT
Press ALT

//Get/set current day/month/year
Month>MM
Day>DD
YEAR>YYYY

//Call save option via its MenuItem ??? (check Mouse coords!)
MouseMove>634,240
LClick

WWO>Save Data File...
//Check if file has been already saved that day
IfFileExists>C:\Datalogger\ColdStorage_%MM%%DD%%YYYY%.dat, Message

//Name the outputfile
Send>C:\Datalogger\ColdStorage_%MM%%DD%%YYYY%.dat

//Confirm to Save the Data File via its Yes-Button
SET>Save Data File...
//Move from the default button (No) to the Yes button
Press TAB
Press ENTER
Goto>Exit

//Backup already exists, Press NO to abort
Label>Message
SET>Save Data File...
Press ENTER
MessageModal>ColdStorage_%MM%%DD%%YYYY%.dat%CRLF%already exists !

Label>Exit
//Close the app via its MenuItemKeyCombo CTRL+Q
Set>MadgeTech*
Press CTRL
Sen>Q
Release CTRL
MessageModal>Done.

AllTemp/Mel

Macros Ran All Every 30 OKAY...

Post by AllTemp/Mel » Sun Oct 24, 2004 9:41 pm

I was at the plant last night until 5:00 am watching and configuring the previous macros I posted... Just arrived to see they ran as scheduled every 30 minutes , last was at 2:20 PST, Grrrreat!

Now I am in need to combining them as instructed her by Bob & Lumumba... I am on a Lap Top currently wireless connection, slow...

Lumumba I am going to follow your script here and see what happens, thanks will let you know.

One important question ?

I don't see to see any errors in my logs, what settigns should the log file be in to correct this...

Thank , your a terrific group of people !

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 » Mon Oct 25, 2004 2:29 am

Thanks to Lumumba for providing you a compacted version of your script. I have added afew of my own comments in red


//Fetch Data
Let>WW_TIMEOUT=5
//I expect any MouseCoords won't work now unless you'd replace them with RelativeMouseCoords, or better
//you should replace any MouseClick with a KeyCombo (i.e. ALT+E).
//You may also want to consider maximizing your window with WindowAction>1 before using MouseMove or MouseMoveRel commands. //This can help to make sure the correct coordinates are being selected.//And as he has noted, using Key commands like CTPL/ALT-Keys, tabs, etc. are usually more reliable than mouse movements.
MouseMove>218,40
LClick
MouseMove>225,72
LClick

WWO>Save Data File...
//Check if file has been already saved that day
The next line appears to me to have a "space" character after the comma, before Message. That will be a problem if your label does not have the same "space" in front. I would suggest removing the "space" to be consistent with all other Macro Scheduler commands which also are very literal, and have no spaces after delimiters.
IfFileExists>C:\Datalogger\ColdStorage_%MM%%DD%%YYYY%.dat, Message


//Confirm to Save the Data File via its Yes-Button
//You could also consider using PushButton>window_title,button_caption here.
SET>Save Data File...
//Move from the default button (No) to the Yes button
Press TAB
Press ENTER
Goto>Exit

Lumumba has also used abbreviations for many Macro Scheduler commands. Although it is a bit more typing, you might want to use the full oommand names until you are more familiar with the commands and their syntax. EX: SET and WWO for SeyFocus> and WaitWindowOpen>

==============
And a final reminder, if your script "does not work" provide details about the symtoms, which line you think is failing. Copy of the log can be one of the best tools to diagnose and troubleshoot.
Last edited by Bob Hansen on Fri Oct 29, 2004 8:57 pm, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Mon Oct 25, 2004 6:34 am

Just arrived to see they ran as scheduled every 30 minutes
In this case (multiple savings a day) it looks like it would make sense to use a complete timestamp (YYYYMMDD-hhmmss_ColdStorage.dat) for the filenaming !? Or create a folder for (year\month\) each day, which helds hhmmss_ColdStorage.dat's. And finally, a scheduled archiving/backup/ to a drive (or burning to a CD).
appears to me to have a "space" character after the comma
As you know other scripting tools are not as sensitive as MSched about that. Swapping around those tools is a dangerous behaviour :oops: :roll: :wink: :D
has also used abbrebiations for many Macro Scheduler commands
For the first time ever. :)

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

Project A Success!

Post by AllTemp » Fri Oct 29, 2004 8:29 am

Thanks guys all of you that contributed to my solution...

The Temperture Controller program is up and running beautifully.

Not only do I have it downloading daily, it's saving in two diffrent formats and additionally printing a full report weekly...

Could have asked for better product support from the forum and MJTNET!

Great people at MJTNET!

I hope I find the time to learn more about these scripting commands...

Again thank you...

Mel Damorn, AllTemp Heating & Cooling
________
buy herbalaire 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:

Correction

Post by AllTemp » Fri Oct 29, 2004 8:31 am

COULD NOT HAVE ASKED FOR BETTER TECHNICAL SUPPORT FROM THE GROUP AND MJTNET!
________
full melt bubble hash
Last edited by AllTemp on Wed Feb 02, 2011 11:00 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 » Fri Oct 29, 2004 9:03 pm

Glad to hear all is well, AllTemp

And I thought I would mention that neither Lumumba nor myself work for MJT. Both of us are just enthusiastic end users like yourself. This is a great group on this forum, glad to be using a terrific product like Macro Scheduler from MJT.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

jalbt51
Junior Coder
Posts: 31
Joined: Sat Mar 06, 2004 4:40 pm

TAB Control vs MouseMove/Click

Post by jalbt51 » Sat Nov 20, 2004 3:00 am

When I started in MacroSch I learned from recording my own macroes. Having gone from the observed MouseMove/Click, method of pushing buttons, to TAB controls, I give a loud YES! :D to Bob Hansen's comment about it. They are more reliable and you dont have to worry about where the buttons are! No more need to mess with absolute versus relative coordinates. No need to exactly size and position or maximize the window.

Try fooling around in different windows by accomplishing tasks with: TAB, Shift TAB(don't forget to release the shift), Up/Down arrows, Right/Left arrows alone. (Find commands for these in help under the word "PRESS". You can push buttons by pressing enter or by "pressing the space bar" (Send>" "). Also look for help files in Windows, Mozilla, etc. under "keyboard shortcuts" and "accessibity". If You can do it on the keyboard, then Macsch can do it for you. :)

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