I need to repeat my script to remove records

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
yankey11215
Newbie
Posts: 2
Joined: Mon Sep 14, 2015 4:35 pm

I need to repeat my script to remove records

Post by yankey11215 » Mon Sep 14, 2015 4:42 pm

I took a shot at adding a link to repeat 500 times a deletion of data from a Software called Timberline. Of course it runs, but not fast enough and I don't think I have the repeat shown correctly. Can someone give me some advice?

Look for Let and Repeat...I put Let next to the actual task and repeat at the end of my script.

Notice that the macro shows me going from Macro Scheduler into the software and then should loop my removal of data. This is taking 6 hours or so and I know it's not perfect and I need to do more tonight.

Also how do I auto start and end my script....I tried control alt L , it does not stop the program, so I can trouble shoot.

// C:\Users\myankey\AppData\Local\Temp\msrC469.scp
// Recorded on Sunday, September 13, 2015, at 09:28 PM

//Recorded Events
Let>WW_TIMEOUT=1
CapsOff
MouseMove>484,741
Wait>0.100
//Clicking on:
//SnapShotFile>%BMP_DIR%snapshot_0.png
Wait>0.296
LClick
Wait>0.297
MouseMove>549,679
Wait>0.296
LClick
Wait>0.282
//Activating Window:
//SnapShotFile>%BMP_DIR%snapshot_1.png
WaitWindowOpen>Job Cost - xxx - \\Remote
MoveWindow>Job Cost - Fxxx - \\Remote,0,0
ResizeWindow>Job Cost - xxx- \\Remote,1280,728
Wait>0.031
MouseMove>669,614
Wait>0.296

//Clicking on:
//SnapShotFile>%BMP_DIR%snapshot_2.png
Wait>0.172
LClick
Wait>0.296
Press Enter * 3
Wait>0.296
MouseMove>692,609
Wait>0.296
//Clicking on:
//SnapShotFile>%BMP_DIR%snapshot_3.png
Wait>0.125
LClick
Wait>0.296
//Activating Window:
//SnapShotFile>%BMP_DIR%snapshot_4.png
WaitWindowOpen>Job Cost - \\Remote
MoveWindow>Job Cost - \\Remote,534,299
ResizeWindow>Job Cost - \\Remote,213,131
Wait>0.047
MouseMove>583,408
Wait>0.296
//Clicking on:
//SnapShotFile>%BMP_DIR%snapshot_5.png
Wait>0.25
LClick
Wait>0.125
Let>k=0
Repeat>k
Let>k=k+1[/b][/color]
//Activating Window:
//SnapShotFile>%BMP_DIR%snapshot_6.png
WaitWindowOpen>Job Cost - xxx - \\Remote
MoveWindow>Job Cost - xxx- \\Remote,0,0
ResizeWindow>Job Cost - Fxxx - \\Remote,1280,728
Wait>0.249
MouseMove>665,608
Wait>0.249
//Clicking on:
//SnapShotFile>%BMP_DIR%snapshot_7.png
Wait>0.249
LClick
Wait>0.249
Press Enter * 3
Wait>0.249
MouseMove>691,606
Wait>0.249
//Clicking on:
//SnapShotFile>%BMP_DIR%snapshot_8.png
Wait>0.047
LClick
Wait>0.141
MouseMove>636,490
Wait>0.204
//Activating Window:
//SnapShotFile>%BMP_DIR%snapshot_9.png
WaitWindowOpen>Job Cost - \\Remote
MoveWindow>Job Cost - \\Remote,534,299
ResizeWindow>Job Cost - \\Remote,213,131
Wait>0.016
MouseMove>582,405
Wait>0.249
//Clicking on:
//SnapShotFile>%BMP_DIR%snapshot_10.png
Wait>0.031
LClick
Wait>0.125
//Activating Window:
//SnapShotFile>%BMP_DIR%snapshot_11.png
WaitWindowOpen>Job Cost - Forest City Ratner Companies - \\Remote
MoveWindow>Job Cost - XXX- \\Remote,0,0
ResizeWindow>Job Cost - XXX- \\Remote,1280,728
Wait>0.296
MouseMove>537,752
Wait>0.6

Until>k=500

hagchr
Automation Wizard
Posts: 331
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

Re: I need to repeat my script to remove records

Post by hagchr » Mon Sep 14, 2015 5:44 pm

Hi,

Difficult to give details but some points:

You can eg use Let>k=k+1 or Add>k,1 for the loop.
There is a command WindowAction>1,windowtitle that you can use to maximize the window instead of moving to 0,0 and re-sizing manually (will not make it faster but shorter).
In some window names you have Fxxx in some xxx? Are the window names correct?
I note you have Wait> after most lines. Most of them are probably not needed (however depends on the other application)

Default for cancelling a running macro is Shift+Esc (you can set it under options - when you do not have a macro open)
For debugging you can insert breakpoints under the Debug menu. Also you can step through the code line-by-line by pressing F8

yankey11215
Newbie
Posts: 2
Joined: Mon Sep 14, 2015 4:35 pm

Re: I need to repeat my script to remove records

Post by yankey11215 » Mon Sep 14, 2015 10:29 pm

That helps somewhat, still confused as to where to put Let or loop items in my script....the xxx was to xxx out the company name since I am working with another companies data.

I'll do my best on your tips....I'm new to this and the program, appreciate your help... :D

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: I need to repeat my script to remove records

Post by Marcus Tettmar » Tue Sep 15, 2015 9:31 am

Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

hagchr
Automation Wizard
Posts: 331
Joined: Mon Jul 05, 2010 7:53 am
Location: Stockholm, Sweden

Re: I need to repeat my script to remove records

Post by hagchr » Tue Sep 15, 2015 9:36 am

Hi, if you look in help there are different options for looping and what you use is a matter of taste and what is easier to follow. (Example below - my brain works better with the second one). Key is to set it up before the loop so you just have the repetitive things in the loop and that at the end of the loop you position things so that things are ready for the next iteration.

One thing that struck me after the last post is that when you use WindowAction>1,WinTitle you maximize the window which is ok. However if you then resize WinTitle (when in maximum state) it seems you resize the maximum size, ie if you later use WindowAction>1,WinTitle again you do not get back to full screen. One way to deal with it is to use WindowAction>0,WinTitle (which is restore) before the resize so that you are not in maximum state.

So in your case it is probable easier to do what you are doing ie resizing and moving the window instead. Sorry if I confused you.

Code: Select all

//Set everything up for the loop and then eg one of these

Let>k=0
Repeat>k
  Let>k=k+1
  //your repetitive tasks
Until>k,500


Let>k=0
While>k<500
  Let>k=k+1
  //your repetitive tasks  
EndWhile

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