Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
atapper
- Newbie
- Posts: 18
- Joined: Wed Dec 17, 2008 2:10 pm
- Location: Minnesota,USA
Post
by atapper » Thu Apr 16, 2009 9:24 pm
This code used to work in MS11.0. Now there seems to be a problem with the Separate command on line were I am trying to split the line into multiple columns. The problem is that the Separate command isn't taking the %r% as a variable, but as a literal.
BTW the datafile being read is a simple CSV that has some unnecessary quotation marks in it.
Anyone know if I got away with something before that now I can't or did 11.1.08a break the Separate command?
Code: Select all
ReadFile>file_name,data_file
Separate>data_file,%CRLF%,rw
//Seperate the data into individual lines called rw_'linenum'
Let>comma=,
Let>r=1
Repeat>r
Separate>rw_%r%,comma,col_%r%
//Seperate the data further into individual fields called col_'linenum'_'columnnum'
Let>k=1
Repeat>k
StringReplace>col_%r%_%k%,",,temp
Let>col_%r%_%k%=temp
Let>k=k+1
Until>k>col_%r%_count
//Take out the " in the data
Let>r=r+1
Until>r=rw_count
Andrew Tapper
Engineering Manager
Forward Technology
Cokato, MN
-
JRL
- Automation Wizard
- Posts: 3532
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Thu Apr 16, 2009 10:14 pm
I agree. Something changed. I ran your code in 11.1.05 and it worked. I installed the latest 11.1.08a and when I ran your code again, it failed.
-
Me_again
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Post
by Me_again » Thu Apr 16, 2009 11:13 pm
I note that 11.1.06 has a related change:
"Fixed: Separate failing to work if delimiter a variable in % symbols "
-
jpuziano
- Automation Wizard
- Posts: 1085
- Joined: Sat Oct 30, 2004 12:00 am
Post
by jpuziano » Thu Apr 16, 2009 11:36 pm
Me_again wrote:I note that 11.1.06 has a related change:
"Fixed: Separate failing to work if delimiter a variable in % symbols "
Actually, that fix is listed as part of 11.1.07 here...
http://www.mjtnet.com/mswhatsnew.htm wrote:Version 11.1.07 27/03/2009
Fixed: Separate failing to work if delimiter a variable in % symbols
Fixed: WebRecorder/VBScript web automation issues with IE8+Vista+UAC
Fixed: Added ' (apostrophe), Rem and Remark as valid comment tokens to syntax highlighter in editor
Fixed: Syntax parser highlighting recognised command names inside other commands
Fixed: Empty ("") variable names can no longer be created. Any empty names ignored.
Fixed: SOWriteLn not adding line break
Added: Code folding support for For..Next, While..Wend, Do..Loop in VBScript
But maybe it is broken again in the latest version: 11.1.08a
Marcus, can you reproduce the problem in 11.1.08a and if so... provide a maintenance release?
Thanks and take care
-
Me_again
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Post
by Me_again » Fri Apr 17, 2009 12:23 am
You're right, a slip of the keyboard

-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Fri Apr 17, 2009 7:09 am
You were benefiting from a side effect of a bug. Now that bug has been fixed you need to do things as you would any other command. This is what you should do and what you need to do in any other command and is what I always show in all my code and examples:
Let>this=rw_%r%
Sepate>this,comma,this
You will note if you look at ANY of my code on this forum that where I use variables I always convert to a simple variable first.
Due to a bug in the way that Separate was being parsed it prevented it from working where a variable contained a comma if that var was individually contained in % symbols. I.e. It stopped designed behaviour and meant it did not work in the same way as all other commands. It just so happens this uniqueness allowed you to do what you did, though it is not consistent with other functions. Now that it is, I'm afraid you need to switch to normal use.
-
atapper
- Newbie
- Posts: 18
- Joined: Wed Dec 17, 2008 2:10 pm
- Location: Minnesota,USA
Post
by atapper » Fri Apr 17, 2009 1:55 pm
OK, but as you see in the code, the StringReplace command could handle the % in the source variable but not the destination variable. Is no longer true as well?
Can Separate not handle the % in either source or destination variable locations?
Or is doing this kind of indirect addressing directly in a command line a bad idea in general?
Thanks for the help.
Andrew Tapper
Engineering Manager
Forward Technology
Cokato, MN
-
atapper
- Newbie
- Posts: 18
- Joined: Wed Dec 17, 2008 2:10 pm
- Location: Minnesota,USA
Post
by atapper » Fri Apr 17, 2009 3:29 pm
FYI, I tried this out and you CAN use % in the source variable but NOT the destination variable. Means I had to second loop to build the second dimension in my array, but so be it.
Marcus, is this right or is the fact that I can use % in the source variable another hole that you fill later?
My feeling is that by "fixing" this "bug", you have actually reduced the power of the command. Maybe as a future enhancement you could make this work again.
Andrew Tapper
Engineering Manager
Forward Technology
Cokato, MN
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Fri Apr 17, 2009 3:43 pm
This is correct behaviour. You cannot have a composite variable as a destination variable. Only "Let" supports that and this should be consistent with all other commands and is as intended. We fixed a potentially fatal bug with Separate which you were able to exploit but which should not be possible and is not possible with other commands. If you prefer the broken version you are quite at liberty to downgrade but we certainly will not be reinstating this bug.