1. system_exec fun :(
- Posted by Alan Oxley <fizzpop at icon.co.za> Jan 28, 2003
- 429 views
Gents and Ladies, After many hours of puzzlement, code butchering and fighting with delimiters, I discovered that you cannot call a program directly via system_exec if the program name is not the msdos 8.3 format. While the difficulties with the "C:\\progra~1\\" etc are mentioned in the mailing list, the program name restriction does not appear to be. example: system_exec("PatrolCli",2) -- fails with -1, no other info while system_exec("PATROL~1",2) -- works ok. What took so long, was the fact that if you type the "PatrolCli" yourself, it works! The workaround is to do a dos "dir /X" and trap the output - this shows both the long and shortened name. Grab the short version and away you go. Also, system_exec is a function that returns -1 if the command failed. You can't redirect output, so you are in the dark as to the failure. Anybody know a sane way of discovering the problem when you get -1 ?. Tried system() but I get invalid command; I have a convoluted argument that is not acceptible to system(). Over 100 chars long in fact. I've fixed it now, but what about next time? Finally, you can't stack win2k (dos) commands with an ampersand - you get "invalid continuation" from Euphoria. IMHO some better feedback from system_exec would be very welcome! HTH other strugglers with system_exec. Cheers Alan
2. Re: system_exec fun :(
- Posted by Juergen Luethje <eu.lue at gmx.de> Jan 29, 2003
- 415 views
Hi Alan, you wrote: ^^^^^^^^^^^ Either, this message riped almost 2 years, before you sent it, or you have a "time saving" PC clock. > > Gents and Ladies, > After many hours of puzzlement, code butchering and fighting with > delimiters, > I discovered that you cannot call a program directly via system_exec if the > program name is not the msdos 8.3 format. That depends. From a Eu *Windows* program (.exw), I *can* do so. At least it works on Win 98. If the command contains spaces, it must be enclosed in double quotes (inside the other double quotes), e.g.: ? system_exec("\"C:\\Programme\\Windows Media Player\\mplayer2.exe\"", 2) works for me on Win 98/1st ed. Calling 'system_exec' from a Eu *DOS* program (.ex), I can confirm what you wrote also for Win 98/1st ed. What operating system do *you* use? Interestingly, with *system()* it works in a Eu DOS program on Win 98. > While the difficulties with the > "C:\\progra~1\\" etc are mentioned in the mailing list, the program name > restriction does not appear to be. > example: system_exec("PatrolCli",2) -- fails with -1, no other info > while system_exec("PATROL~1",2) -- works ok. > What took so long, was the fact that if you type the "PatrolCli" yourself, > it works! > > The workaround is to do a dos "dir /X" and trap the output - this shows both > the long and shortened name. Grab the short version and away you go. Another workaround IMNSHO is better: - Get my lib 'http://www.rapideuphoria.com/lfn.zip'. - In your program include 'file_ln.e' (or 'Lfn.e'). - Then instead of 'system_exec("PATROL~1", 2)', call 'system_exec(short_name("Patrol on the highway or whatever long name"))'. Please note that for short_name(), the command must not be enclosed in double quotes inside the other double quotes. I didn't notice that before myself, and I'll probably change this in the next version of 'lfn.zip', so that it will not matter, whether the whole command is enclosed in double quotes or not. > Also, system_exec is a function that returns -1 if the command failed. > You can't redirect output, so you are in the dark as to the failure. > Anybody know a sane way of discovering the problem when you get -1 ?. > Tried system() but I get invalid command; I have a convoluted argument > that is not acceptible to system(). Over 100 chars long in fact. > I've fixed it now, but what about next time? Maybe short_name() helps here, too? > Finally, you can't stack win2k (dos) commands with an ampersand - > you get "invalid continuation" from Euphoria. I'm afraid I don't understand what you mean. Can you please give an example? > IMHO some better feedback from system_exec would be very welcome! > > HTH other strugglers with system_exec. > > Cheers > Alan Regards, Juergen -- /"\ ASCII ribbon campain | \ / against HTML in | Superstition brings bad luck. X e-mail and news, | / \ and unneeded MIME |
3. Re: system_exec fun :(
- Posted by jbrown1050 at hotpop.com Jan 30, 2003
- 426 views
On Sun, Apr 22, 2001 at 03:11:17AM +0200, Alan Oxley wrote: > > Gents and Ladies, > After many hours of puzzlement, code butchering and fighting with > delimiters, > I discovered that you cannot call a program directly via system_exec if the > program name is not the msdos 8.3 format. While the difficulties with the > "C:\\progra~1\\" etc are mentioned in the mailing list, the program name > restriction does not appear to be. > example: system_exec("PatrolCli",2) -- fails with -1, no other info > while system_exec("PATROL~1",2) -- works ok. Its not suprising, unless your calling system_exec() from exw.exe (ex.exe being a dos program, can't see long filenames at all.) > What took so long, was the fact that if you type the "PatrolCli" yourself, > it works! > > The workaround is to do a dos "dir /X" and trap the output - this shows both > the > long and shortened name. Grab the short version and away you go. try Juergen's lfn.e, it can give you long filename support (it has a function, you can use it to file the short filename of a file, given its long filename, iirc that is). > > Also, system_exec is a function that returns -1 if the command failed. > You can't redirect output, so you are in the dark as to the failure. > Anybody know a sane way of discovering the problem when you get -1 ?. Its probably a "Command not found" type of thing ... odds are good that its looking for a command named "patrolcl" but not finding it, in this case. > Tried system() but I get invalid command; I have a convoluted argument > that is not acceptible to system(). Over 100 chars long in fact. > I've fixed it now, but what about next time? Could you be more specific about this? > > Finally, you can't stack win2k (dos) commands with an ampersand - > you get "invalid continuation" from Euphoria. Huh? Show us the line where you use the '&' w/ the commands. > > IMHO some better feedback from system_exec would be very welcome! > > HTH other strugglers with system_exec. > > Cheers > Alan > jbrown > > > TOPICA - Start your own email discussion group. FREE! -- /"\ ASCII ribbon | \ / campain against | Linux User:190064 X HTML in e-mail and | Linux Machine:84163 /*\ news, and unneeded MIME |