Loop with variable

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
scotthyde
Newbie
Posts: 4
Joined: Fri May 13, 2011 4:54 am

Loop with variable

Post by scotthyde » Fri May 13, 2011 5:00 am

Hi,
trialling software with some work already done by another tool - but his so far more functional - howver getting stuck here..

when x = 1 Bulkorder.scp uses array_1 OK and as input as expected
when x =2 it does not - BUT message modal tells me Array_2 is as expected.. ie same form/structure etc(just a different number)
Im confused!

While>xroutes_%x%routes_%x%
include>C:\scripts\Bulkorder.scp
else>
endif>
let>x=x+1
endwhile>

thanks for any help
if I get this going I think we can use this product from now on

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

Post by Marcus Tettmar » Fri May 13, 2011 9:18 am

I think you need to re-post your code. Use the CODE button to format it.

Also please clarify what you are trying to do.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

scotthyde
Newbie
Posts: 4
Joined: Fri May 13, 2011 4:54 am

Post by scotthyde » Fri May 13, 2011 1:40 pm

OK
Not sure about the CODE request
I am trying to loop through an array and pass each array element to the include script

it works OK on the first pass

and this shown by me using the message modal

on the second loop the message modal shows me the second element of the array as expected

but the script fails ands looks to use null?

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Fri May 13, 2011 5:18 pm

Ok, now please post your code (including the "include") so that
we can help you debug.


The only reason to use include this way, is if you use the exact same code in more than one macro file.... otherwise it might be better coded as a subroutine (see Gosub and SRT and End in the help file)


After you paste the code into the forum message box, highlight it with the mouse and then press the "Code" button. This adds some formatting tags which makes it easier to read.

The "Code" button is above the message box between the "Quote" and "List" buttons.

It also helps to check the boxes "Disable Smilies in this post" and "Disable HTML in this post"

scotthyde
Newbie
Posts: 4
Joined: Fri May 13, 2011 4:54 am

cheers

Post by scotthyde » Fri May 13, 2011 11:35 pm

I am using 1 include at moment to test the loop - but will trigger more when complete.

Code: Select all

let>routes_1=Route1
  let>routes_2=Route2
  let>routes_3=Route3
  let>routes_4=Route4
  let>routes_5=Route5

let>x=1
include>C:\scripts\PrepareSupervend.scp
blockinput>0
While>x<3
if>routes_%x%<>0
messagemodal>routes_%x%
include>C:\scripts\Bulkorder.scp
//include>Runsheet.scp
//include>dailyInvoice.scp
//include>deldocks.scp
else>
endif>
let>x=x+1
endwhile>

//Include>C:\scripts\exitSupervendfromreports.scp
BlockInput>0
//include>C:\scripts\pdfmerge.scp
//include>C:\scripts\emailPaperwork.scp
[/code]

scotthyde
Newbie
Posts: 4
Joined: Fri May 13, 2011 4:54 am

CLOSE

Post by scotthyde » Sat May 14, 2011 8:53 am

Guys pleas ignore and close ticket
there was a random
LCTRL key sent that was hanging on the loop
apologies

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