goto cmd use

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
chuckles
Newbie
Posts: 12
Joined: Tue Oct 11, 2005 5:15 pm

goto cmd use

Post by chuckles » Thu Dec 29, 2005 6:15 pm

Hi i'm trying to figure out if this script will work with the goto command. could someone quickly take a look at this and see if this makes sense?

CapsOff
Wait>3
SetFocus>my application*
\\WaitWindowChanged>1
Wait>15
Label>loop
Let>count=0
Let>max=100
Repeat>count
Let>count=count+1
SetFocus>my application *
Press CTRL
Wait>1.11
Send>g
Wait>1.11
Release CTRL
Wait>1.11
Press Down * %count%
Wait>1.11
Press Enter
Wait>50.11
Until>count,max
SetFocus>my application *
Wait>10
Press F3
Wait>3.11
Send>ibm
Wait>3.11 loop
Goto>end
SetFocus>Performance *
Wait>3.7
Press ALT
Wait>0.9
Send>a
Wait>0.86
Press Down
Wait>0.28
Press Enter
Wait>2.99
Label>end

chuckles
Newbie
Posts: 12
Joined: Tue Oct 11, 2005 5:15 pm

Post by chuckles » Thu Dec 29, 2005 6:39 pm

when i use this script, it will constantly redo everything in a loop but it will never end..

this part never gets executed with the script:
Goto>end
SetFocus>Performance *
Wait>3.7
Press ALT
Wait>0.9
Send>a
Wait>0.86
Press Down
Wait>0.28
Press Enter
Wait>2.99
Label>end


how can i stop the loop and make it end? thank you

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

Post by Marcus Tettmar » Thu Dec 29, 2005 7:32 pm

No, the first part will loop forever because you have told it to. How many times do you want the first part to loop?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

chuckles
Newbie
Posts: 12
Joined: Tue Oct 11, 2005 5:15 pm

Post by chuckles » Thu Dec 29, 2005 7:58 pm

i would just like the first part to loop once, thats it..

thank you for your help.

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

Post by Marcus Tettmar » Thu Dec 29, 2005 9:41 pm

Ok, try this:

CapsOff
Wait>3
SetFocus>my application*
\\WaitWindowChanged>1
Wait>15
Let>numloops=0
Label>loop
Let>numloops=numloops+1
Let>count=0
Let>max=100
Repeat>count
Let>count=count+1
SetFocus>my application *
Press CTRL
Wait>1.11
Send>g
Wait>1.11
Release CTRL
Wait>1.11
Press Down * %count%
Wait>1.11
Press Enter
Wait>50.11
Until>count,max
SetFocus>my application *
Wait>10
Press F3
Wait>3.11
Send>ibm
Wait>3.11 numloopsloop
Goto>end
SetFocus>Performance *
Wait>3.7
Press ALT
Wait>0.9
Send>a
Wait>0.86
Press Down
Wait>0.28
Press Enter
Wait>2.99
Label>end

The first part will now only run twice. Modify the If>numloops<3,loop line for the number of iterations required.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

chuckles
Newbie
Posts: 12
Joined: Tue Oct 11, 2005 5:15 pm

Post by chuckles » Thu Dec 29, 2005 10:00 pm

thanks again for your help...it seems like after this part the script just stops..it does NOT redo the top part one more time.


script stops after here. before that it hits F3, then enters ibm which is correct
Wait>3.11 numloopsloop
Goto>end
SetFocus>Performance *
Wait>3.7
Press ALT
Wait>0.9
Send>a
Wait>0.86
Press Down
Wait>0.28
Press Enter
Wait>2.99
Label>end

chuckles
Newbie
Posts: 12
Joined: Tue Oct 11, 2005 5:15 pm

Post by chuckles » Thu Dec 29, 2005 10:02 pm

one more thing i added this.

Wait>10
Press F3
Wait>3.11
Send>ibm
Wait>3.11
Press Enter
wait>2.11

the Press Enter line doesn't seem to work, the macro doesn't press the keyboard "enter".

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

Post by Marcus Tettmar » Thu Dec 29, 2005 11:11 pm

Yes it does. If you issue "Press Enter" then Enter is most certainly being pressed. What you really mean is that you saw no effect. Perhaps the wrong window was focused or the Press Enter command is issued too early or too late. Insert a SetFocus line before the key sends and make sure the Press Enter occurs at the right time.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

chuckles
Newbie
Posts: 12
Joined: Tue Oct 11, 2005 5:15 pm

Post by chuckles » Tue Jan 03, 2006 4:20 pm

marcus
thank you for your help on this script, it works perfectly.

i'm not sure if this is possible but if i can trouble you for one more thing.

for this line:
Press F3
Wait>3.11
Send>ibm
Wait>3.11
Press Enter
wait>2.11

i would like to add something after it does the first loop "send>ibm"
and it goes to the top, after that is done i would like it to perform another SYMBOL change

so instead of send>ibm i like it to do

Press F3
Wait>3.11
Send>csco
Wait>3.11
Press Enter
wait>2.11

"csco" and then go back to the top again and redo all the other script..then finally goto end...

thank you.

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

Post by Marcus Tettmar » Tue Jan 03, 2006 4:28 pm

Use the numloops counter to make a decision. Something like:

If>numloops=1
Send>ibm
Endif
If>numloops=2
Send>csco
EndIf
If>numloops ..... etc
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

chuckles
Newbie
Posts: 12
Joined: Tue Oct 11, 2005 5:15 pm

Post by chuckles » Tue Jan 03, 2006 5:48 pm

looks like i broke the loop,

the script doesn't go back to the top and perform the maxcount part. i like it to use Send>csco, then go back to the top "Label>loop" when its finished go and do Send>ibm then go to the top and perform the maxcount part and then finally just finish script.

//Recorded Events
CapsOff
Wait>3
SetFocus>TOne*
\\WaitWindowChanged>1
Wait>7
Let>numloops=0
Label>loop
Let>numloops=numloops+1
Let>count=0
Let>max=3
Repeat>count
Let>count=count+1
SetFocus>TOne *
Press CTRL
Wait>1.11
Send>g
Wait>1.11
Release CTRL
Wait>1.11
Press Down * %count%
Wait>1.11
Press Enter
Wait>10.11
Until>count,max
Wait>4
Press F3
Wait>1.11
Press F3
If>numloops=1
Wait>2.11
Send>csco
Wait>1.11
SetFocus>TOne*
Wait>2.11
Press Enter
wait>2.11
EndIf
Wait>4
Press F3
Wait>1.11
Press F3
If>numloops=2
Wait>2.11
Send>ibm
Wait>1.11
SetFocus>TOne*
Wait>2.11
Press Enter
wait>2.11
EndIf
If>numloopsloop
Goto>end
Label>end
SetFocus>Performance *
Wait>3.7
Press ALT
Wait>0.9
Send>a
Wait>0.86
Press Down
Wait>0.28
Press Enter
Wait>2.99

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Wed Jan 04, 2006 7:02 pm

The script presented as above loops multiple times (I tested it with the debugger).

It starts
does the down / ctrl+G thing three times
F3 and sends csco, does the 3 x ctrl+g thing again
F3 and sends ibm, does the 3 x ctrl + g thing again
Then it does the alt+a thing at the end (you forgot to release ALT).

(and here's something where you may not want it to do)
maxloops=2, so it starts the loop again...
At the top of the loop, it increases it to 3, but there is no if maxloops=3 routine, so it does the ctrl+g thing three times again.

Also, I don't know if you intended to do this or not, but inbetween the if maxloops=1 and if maxloops=2 sections, you hit F3 again twice.

So the loop's working fine, but I don't know if the minor things (like pressing F3 twice again) are causing your actions or windows to change and not be in the state you expect them to be.

Also, check the end of each line to make sure you don't have a hidden space, especially on the repeat and until lines. When pasting code here, you should use the CODE button so it surrounds your code in the tags.. and sometimes any characters will get interprated as HTML code and we won't see it (or we'll see it differently).

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