On Sat, 4 Dec 2021, Ekkehart Schlicht wrote:
I am running Gretl 2021d for Windows. If I place a PDF file Test.pdf
in
C:/temp,define the string
string command = "C:/temp/Test.pdf"and run the command
! "@command"
the PDF will correctly open, but it takes a long time.
If I run the command
launch "@command"
I get [an error message]
I take it from the manual that both commands should do the same, the first
one asynchronously, the second synchronously.
If I use a text file Test.txt, it opens without delay in the first case but
gives the error message in the second.
The "launch" command is the asynchronous one, intended for starting
an interactive executable. Gretl issues the call then goes about its
business, not waiting for the third-party program to exit. It's not
surprising that this fails if the argument is not an executable.
The "! <cmdline>" command is the synchronous one: it expects a call
to an executable program or "shell" (on Windows, cmd.exe) command.
It blocks until the command is completed. As Sven says, if it
happens to work when the argument is the name of a PDF or plain text
file -- and the OS interprets that as a call to open the file using
a default application -- that's (from gretl's point of view) an
unexpected bonus.
The time taken to open your PDF file is nothing to do with gretl. I
guess in that case Windows has to think hard about what it's going
to use to open the file ;-)
Allin