Pass parameters to VB Script (incl spaces)
I've currently got a .vbs script which I send 3 parameters to. This works great unless there is spaces in one of the parameters.
For example I'm passing First Name; Surname; and Template Name using the following code:
Execute external program --> "wscript.exe "
with commandline set to "PrintLabel.vbs"+" "+Edittext$( "firstname_edit" )+" "+Edittext$( "surname_edit" )+" "+badgesize+badgetemplate
If my Surname has a space in it (e.g "Jones Smith") the whole thing screws up as it treats "Jones" and "Smith" as two separate parameters.
Is there anyway to make it ignore the space??
Thanks in advance.
Marc
Re: Pass parameters to VB Script (incl spaces)
Maybe you can put " around them? To get a string like this in MMF2:
Hello " there!
It would look like this in the expression editor:
"Hello "" there!"
Thus, if you want a lone ", you would have to type """"
Re: Pass parameters to VB Script (incl spaces)
All the paramaters are coming from either Edit boxes or global variables so it's not possible to put " around them.
I think it might be the way I've structured the command line section of the execute external program??
Re: Pass parameters to VB Script (incl spaces)
Of course you can still add quotes - exactly the way LB described.
"PrintLabel.vbs"+" """+Edittext$( "firstname_edit" )+" "+Edittext$( "surname_edit" )+""" "+badgesize+badgetemplate
Whether or not adding quotes will solve the problem, I don't know - I haven't tried using this particular extension.
Re: Pass parameters to VB Script (incl spaces)
If the quotes method doesn't work, try using the URL encoder to encode special characters into valid characters, ie spaces going to %20 or +
Re: Pass parameters to VB Script (incl spaces)
Thanks All.
I quickly tried the quote method which has took me a step closer.
I think I just need to play around with the format of the command line too. Sleep got the better of me last night though :)
Re: Pass parameters to VB Script (incl spaces)
If you have MMF2 developer you could use the com+ object to code your vbs directly from the MMF app instead of calling an external file.
Re: Pass parameters to VB Script (incl spaces)
Or I believe he could use the .NET extension (doesn't require developer). I misread his first post, and just assumed that's what he was doing already.
Re: Pass parameters to VB Script (incl spaces)
Thanks for the suggestions.
I'll have to look into the com+ and .NET extensions.
Re: Pass parameters to VB Script (incl spaces)
The URL encoder does work but it inserts either a %20 or a + sign into the text. This text is printed out to a sticky label so it doesn't look too good :(
Re: Pass parameters to VB Script (incl spaces)
Thanks to everyone - I finally got it working :)
The quote method was the way to do it. A few adjustments to where the quotes where and the amount, sorted the problem out.
Many thanks again