Using RegEx to search text file and create variable array

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Sun Jun 17, 2007 1:09 am

Hi clickfast,

In the final code you posted...
  • IF>URLS_COUNT>0
    LET>k=0
    Repeat>k
    Let>k=k+1
    Let>ThisURL=URLS_%k%
    //write it to file
    WriteLn>C:\urllist.txt
    Until>k,URLS_COUNT
    Endif
...your WriteLn> statement only has one parameter. You'll need three to make it work, something like this perhaps...
  • WriteLn>C:\urllist.txt,result,ThisURL
I'm glad its working for you now, however the Help File says the Until> command works the same way with either
the comma or the equals sign. I was curious so I wrote two macros to try to duplicate your findings:

Comma Test:

Code: Select all

Let>URLList=http://www.yahoo.com;http://www.google.com;http://www.mjtnet.com;http://www.microsoft.com;http://www.ebay.com
Separate>URLList,;,urls
If>urls_count=0,end
Let>k=0
Repeat>k
Let>k=k+1
MDL>urls_%k%
Until>k,urls_count
Label>end

//Now write the URLs to a file
//Test Until> command using a comma
IF>URLS_COUNT>0
LET>k=0
Repeat>k
Let>k=k+1
Let>ThisURL=URLS_%k%
//write it to file
WriteLn>C:\urllist-comma.txt,result,ThisURL
Until>k,URLS_COUNT
Endif
Equals Sign Test:

Code: Select all

Let>URLList=http://www.yahoo.com;http://www.google.com;http://www.mjtnet.com;http://www.microsoft.com;http://www.ebay.com
Separate>URLList,;,urls
If>urls_count=0,end
Let>k=0
Repeat>k
Let>k=k+1
MDL>urls_%k%
Until>k,urls_count
Label>end

//Now write the URLs to a file
//Test Until> command using a equals sign
IF>URLS_COUNT>0
LET>k=0
Repeat>k
Let>k=k+1
Let>ThisURL=URLS_%k%
//write it to file
WriteLn>C:\urllist-equals.txt,result,ThisURL
Until>k=URLS_COUNT
Endif
Both of the above test macros produce the exact same results in the files they create, all five URLs are written.

clickfast, can you please post your code so we can reproduce your findings. As far as I know,
using a comma or an equals sign in the Until> command should produce *exactly* the same results...
but if you can post an example that acts differently, just by changing that comma to an equals sign,
you may have uncovered a bug with the Until> command that I'm sure MJTNet would want to investigate.

Thanks and take care.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

clickfast
Pro Scripter
Posts: 58
Joined: Wed May 23, 2007 12:04 am

Post by clickfast » Sun Jun 17, 2007 5:30 pm

Ok... I'll go get the old code that skipped the first URL and repost. Thanks!

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Mon Jun 18, 2007 3:46 pm

clickfast wrote:Ok... I'll go get the old code that skipped the first URL and repost. Thanks!
That would be great, yes please post the code that exhibits the problem to this thread. If the problem can be fixed just by changing the = to a , in the Until> command, then we have something that should be investigated (because according to the documentation, it shouldn't make a difference).

Thanks again clickfast for taking the time to do this. Sometimes it takes a little more digging to get to the bottom of things, but when you do, you can end up improving the product which makes it better for us all...

Looking forward to seeing the code... take care.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Mon Jun 18, 2007 4:00 pm

Yes, please post it. In my testing I can't find any difference in the function of that command between using comma and equals.

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