Video Screencast Help

Parse Variable

Created: 19 Jun 2013 • Updated: 19 Jun 2013 | 2 comments
This issue has been solved. See solution.

Hi,

I'm struggling to do what I thought might have been simple enough but I can't get it to work correctly so thought I'd ask here.

I'm using Wise Script Editor and I have a section in it that takes the %INST% variable as the source directory and I'm using that to replace some text in a RTF file. It works ok but I need to double up the backslashes to make it display correctly when the RTF file is viewed.

So something like this -  \\server_name\share\directory as %INST%

needs to become \\\\server_name\\share\\directoy as %INST%

Is there a way you can do this by using the Parse command in the wises script editor?

Hope that's enough information without going into too much detail.

Thanks

Paul

Operating Systems:

Comments 2 CommentsJump to latest comment

EdT's picture

Yes.

Basically, parse %INST% into LEFT and RIGHT using the \ as the token to split the string at.

Then  if RIGHT is not empty, set NEWVAR = NEWVAR + LEFT + \\

Then set INST = RIGHT and repeat the process until RIGHT is empty at which point you just end with NEWVAR=NEWVAR+LEFT.

Hope this makes sense.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

SOLUTION
Paul1977's picture

Excellent, that was what I was after, I can work with that, thank you EdT.