OT: How does Windows handle spaces in program names?

Graham Samuel livfoss at mac.com
Sun May 22 13:51:17 EDT 2011


Excuse me for repeating myself, but I put the essentials of this message to the list already under another subject heading - this one reflects what I'm really trying to find out.

Mike Bonner has been helping me on this list with a little VB script that launches a Windows program from within a LiveCode standalone cleverly enough to avoid multiple instances. As an example, he wrote a script that launches Firefox. One of the lines looked like this:

WshShell.Run "firefox.exe"

I was able to make this work, and to show that it works with **any** program on the PC that doesn't have a space in its name - you just have to replace 'firefox' with the new program name. But it doesn't work if the name contains a space, and I have to invoke just such a program. This prog already has thousands of users, so I can't change the name to avoid the problem.

The question is, what is happening when the launch fails, apart from a VB error (to the effect that it can't find the file, but it doesn't tell me the name of the file it can't find, which may be a clue). I just don't know how to track down the error or how to avoid it - maybe I have to substitute something for the space character, or maybe there is a shadow name that I can't see... I am hoping a Windows / VB savvy person can help me.

It would be helpful of course if I could see the process list in the PC - then I could launch the prog from outside my LC app and just look at the list to see what Windows calls it, but I don't know how to do that on XP since 'tasklist' isn't recognised and I don't know how to display things from a VB script. It's sad to be so ignorant, but the charm of LiveCode is that you don't normally have to know this kind of stuff about your target OS.

Any help greatly appreciated.

TIA

Graham

On Fri, 20 May 2011 08:24:12 -0600, Mike Bonner <bonnmike at gmail.com> wrote:
To: How to use LiveCode <use-livecode at lists.runrev.com>




More information about the use-livecode mailing list