Launching files with commas or spaces in file path

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
montanan
Junior Coder
Posts: 49
Joined: Mon Jul 09, 2007 3:44 pm
Location: San Jose, CA

Launching files with commas or spaces in file path

Post by montanan » Wed Dec 08, 2010 4:56 am

I have a very simple test that I am trying to run in Windows 7

Code: Select all

Let>path=C:\test, inc\file.txt
executefile>%path%
I get an error every time. I have tried putting single quotes and double quotes at both ends of the "path" but I have not been able to get it to run.

Any workarounds others have come up with are appreciated!

-Richard
[/code]

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

Post by JRL » Wed Dec 08, 2010 1:57 pm

After doing a little testing, it appears that ExecuteFile> is not behaving the same as other functions when it comes to a comma wrapped in a variable. The behavior I see is consistent with the ExecuteFile> function detecting the comma then terminating the first parameter at the comma and using everything after the comma as a second parameter. Other functions pass commas wrapped in variables on and do not treat them as parameter delimiters. For example if you remark out the ExecuteFile> and add a Writeln> the Writeln> function will work properly with the "path" variable.

WriteLn>%path%,wres,Text to be added

As a workaround you could use the RunProgram> function.

Code: Select all

Let>path=C:\test, inc\file.txt
//executefile>%path%
Run>notepad %path%

montanan
Junior Coder
Posts: 49
Joined: Mon Jul 09, 2007 3:44 pm
Location: San Jose, CA

Post by montanan » Wed Dec 08, 2010 2:47 pm

Thank you, JRL.

While it is certainly not convenient to determine the source application for each file type in order to run it, at least what you proposed will work.

I sure hope the the ExecuteFile command syntax can be changed so that it will work more seamlessly in these situations.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Dec 08, 2010 3:35 pm

Do this:

Executefile>C:\test, inc\file.txt,

Or:

Let>path=C:\test, inc\file.txt
Executefile>%path%,
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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

Post by JRL » Wed Dec 08, 2010 4:05 pm

Thanks Marcus. That works.

So... in an attempt to understand: The trailing comma supersedes the comma embedded in the variable and negates the use of the post comma portion of the variable value being used as the "optional parameter" ?

montanan
Junior Coder
Posts: 49
Joined: Mon Jul 09, 2007 3:44 pm
Location: San Jose, CA

Post by montanan » Thu Dec 09, 2010 9:47 pm

Thank you, Marcus.

A big help!

Adding some very clear instructions to the Help file / Command instructions would also make this much more clear.

-Richard

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

Post by jpuziano » Fri Dec 10, 2010 3:24 am

montanan wrote:Adding some very clear instructions to the Help file / Command instructions would also make this much more clear.
Yes perhaps it would.

What do you think Marcus? Is this an example of something that could/should be covered off with a narritive or example?

How do you decide whether to include something related to a command in the Help File or not?
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 - :-)

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Dec 10, 2010 10:19 am

I've already replied to an email from the OP saying that it will be sorted. It should work like all other functions. So was surprised to see the suggestion to change the help file given I'd already told the OP that we'd look at improving the command. Could change the help file, but I think would be best to fix to work as documented and as all other commands do.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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

Post by jpuziano » Fri Dec 10, 2010 9:56 pm

mtettmar wrote:I've already replied to an email from the OP saying that it will be sorted.
Ahh... sorry, I had no way of knowing that as your one post on this thread only offered workarounds.
mtettmar wrote:It should work like all other functions.
Absolutely...
mtettmar wrote:So was surprised to see the suggestion to change the help file given I'd already told the OP that we'd look at improving the command.
Maybe the OP thought it would take a long time to get the command improved? Maybe they forgot about (or didn't see) your email?
mtettmar wrote:Could change the help file, but I think would be best to fix to work as documented and as all other commands do.
Again, absolutely agree. No need to document workarounds in the Help File when soon the command will be improved and the workarounds not needed... Carry on then and thanks for all you do.
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 - :-)

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