Re: system_exec fun :(

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi Alan, you wrote:

             ^^^^^^^^^^^
Either, this message riped almost 2 years, before you sent it,
or you have a "time saving" PC clock. smile

>
> 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     |

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu