Arrays

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ldevito
Newbie
Posts: 10
Joined: Tue Dec 24, 2002 3:16 pm
Location: Long Island, New York

Arrays

Post by ldevito » Fri Mar 14, 2003 4:17 pm

I'm sure this is a simple feat to accomplish and I'm hoping someone can point me in the right direction.

At the start of a macro, I am looking to prompt a user for the number of days to run a report and then to enter each date. I would then print a report for day1, loop back and print the report for day2, etc...until the final days report is run.

I was looking to enter the info into an array format but can't seem to get it to work in MacroScheduler. For example:

NumberOfDays=3
Date[1]=010103
Date[2]=010203
Date[3]=010303

Each time the report would run, it would plug in the date corresponding to the run. NumberOf Days=2, Date[2]=010203.

I have a variable A=1 that increments for each day to run. I have another variable date%A% that I thought would store each date but when I try to Send Character/Text=date%A%, it does not work. I can't seem to get the right combination of % to work with the variables so that the proper date is inputted.


Any suggestions on how to program this? I'd really appreciate the help.

Thanks, Larry

mrh32
Newbie
Posts: 13
Joined: Thu Feb 20, 2003 3:06 pm

Post by mrh32 » Fri Mar 14, 2003 4:38 pm

I think your problem is date%A%, you should use date[%A%] instead. I tested out this code and it seems to work fine. I hope it solves your problem.

--Matt

let>NumberOfDays=3
let>Date[1]=010103
let>Date[2]=010203
let>Date[3]=010303

let>A=0
repeat>A
let>A=A+1
let>day=date[%A%]
messagemodal>%day% %A%
until>A,NumberOfDays

ldevito
Newbie
Posts: 10
Joined: Tue Dec 24, 2002 3:16 pm
Location: Long Island, New York

Still Won't Work

Post by ldevito » Fri Mar 14, 2003 5:46 pm

Matt, thanks for the help but it did not work. Here is the code I am using. I know the Send Character/Text>Date[%B%] line is wrong but I don't know how to fix it. I want to get all of the dates at the beginning of the macro so the user does not have to wait and enter the report date each time it comes up in the process. Any other suggestions will be appreciated.


//Create a macro that asks how many days to run the EOD report.//
//Loop the macro that number of times to get the dates and print the reports//
Let>A=1
Let>B=1
Input>num,How many days will you be printing?
Label>GetDates
If>A>num,Print
Input>date[%A%],Enter Date %A% in the following format (mmddyy i.e. 021403):
Wait>1
Let>A=A+1
GoTo>GetDates
// Now that the dates are entered, we will print each report individually.
// We loop through the procedure until all reports are printed.
Label>Print
If>B>num,End
Wait>1
Send Character/Text>X
Press Enter
Wait>1
Send Character/Text>P
Press Enter
Wait>1
Send Character/Text>D
Press Enter
Wait>1
Send Character/Text>date[%B%]
Wait>1
MessageModal>When the Pharmacy End of Day Report for date[%B%] has completed printing, hit the ENTER key or click OK.
MouseMove>385,10
LClick
Wait>1
Send Character/Text>0
Press Enter
Wait>1
Let>B=B+1
// Print the next day //
GoTo>Print
Label>End
//When all printing is completed, run macro X-EOD to exit
Macro>X-EOD

mrh32
Newbie
Posts: 13
Joined: Thu Feb 20, 2003 3:06 pm

Post by mrh32 » Fri Mar 14, 2003 6:24 pm

Sorry I should have been more clear. Not only do you need the brackets but you also need the let statement. MacroSceduler seems to only interpret the value of the date[%somevariable%] in a let statement, so you just put one of those before your message and print it out as I did with the variable day. I've changed my code a little to better explain this, try running the following code and everything should become clear.

--Matt

let>NumberOfDays=3
let>Date[1]=010103
let>Date[2]=010203
let>Date[3]=010303

let>A=0
repeat>A
let>A=A+1
let>day=date[%A%]
messagemodal>%day% %A% date[%A%]
until>A,NumberOfDays

ldevito
Newbie
Posts: 10
Joined: Tue Dec 24, 2002 3:16 pm
Location: Long Island, New York

Thanks

Post by ldevito » Fri Mar 14, 2003 8:56 pm

Thanks Matt, I got it to work. The syntax I needed was:

...

Input>date%A%, Enter date ...
Let>d[%A%]=date%A%
...
Send Character/Text>d[%B%]
...

I appreciate your help.
Larry

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