WriteLn doesnt seem to recognise arrays

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
CatBreath
Junior Coder
Posts: 32
Joined: Fri Jul 08, 2005 6:12 pm

WriteLn doesnt seem to recognise arrays

Post by CatBreath » Wed Jul 20, 2005 4:35 pm

i used an array that goes something like this:

Let>a=0
Label>Loop
Let>a=a+1
GetClipBoard>k_%a%
Writeln>c:\txtfile.txt,result,k_%a%
Goto>Loop

the output i got was:
k_1
k_2
k_3
k_4
....

when i used the Message command to display the k_%a%'s it did it just fine, what made me think that the problem lies in the WriteLn command.

Help please!

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Jul 20, 2005 4:45 pm

CatBreath,

Recently discussed this topic here:
http://www.mjtnet.com/usergroup/viewtopic.php?t=2067

Basically, in certain circumstances using Macro Scheduler, you need to pass the arrayed value to a more static variable before you can use it. I don't know any hard and fast rules for determining those "certain circumstances" but this is one of them. Typically I create the second variable any time I use an array. Prevents hair pulling.

Try something like:

Let>a=0
Label>Loop
Let>a=a+1
GetClipBoard>k_%a%
Let>FromClipBoard=k_%a%
Writeln>c:\txtfile.txt,result,%FromClipBoard%
Goto>Loop

Hope this helps,
Dick

CatBreath
Junior Coder
Posts: 32
Joined: Fri Jul 08, 2005 6:12 pm

Post by CatBreath » Wed Jul 20, 2005 5:07 pm

Thanks, but is there another way around it?
and is this considered a bug in the program?

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Jul 20, 2005 6:55 pm

is there another way around it?
Don't know.... but its a pretty simple fix. Only one line. When solutions are that easy I don't usually waste much energy looking for alternatives.
is this considered a bug in the program?
Again, Don't know... bug vs feature must be one of the oldest arguments in software development. If you think its a bug, put it into the bug tracker and see what comes of it. It seems to me that your original script should work with the arrayed variable. But there might be a good reason for it to work the way it does.

Wish I had a better answer for you. Perhaps someone else can shed some light on the subject?

Later,
Dick

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 » Wed Jul 20, 2005 8:03 pm

JRL's solution, as usual, is perfect.

One simple line of script to make it work is not worth distracting development time from more important issues and features.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

CatBreath
Junior Coder
Posts: 32
Joined: Fri Jul 08, 2005 6:12 pm

Post by CatBreath » Wed Jul 20, 2005 11:57 pm

the solution was indeed simple and marvelous, thank you! :D

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