[plt-scheme] call an external program

From: Jepri (jepri at alphacomplex.org)
Date: Tue Aug 8 02:07:55 EDT 2006

Hi Ivanka,
I had terrible troubles getting external calls to work under windows.  
Most of my problems turned out to be figuring out when to use \ and when 
to use \\, because the \\ are needed to make it through the scheme 
reader before being passed to the sub program.  I think sometimes I 
needed to use \\\\.

If you use "process" or "system" your odds of success are very low 
because those commands launch a command shell with args, which then 
attempts to call your program.  The args usualy get mangled.

I found it better to use system* and process*, which launch your program 
directly without the command shell.  The downside is you don't get 
automatic path lookups so you will have to track down the precise 
location of your program yourself.

I have had success using process*, like this:

(let ((command (list rsync-path "--recursive" "--compress" "/Documents 
and Settings")))
(apply process* command))

I don't know why but I get issues writing to ports if I don't use 
apply.  *shrug*

There is also a separate issue with process termination if you use 
"system"  or "process".

Ivanka Iordanova wrote:

> Hello,
>  
> I am trying to call an external programme form a Scheme file. Here is 
> the command-prompt script that does what I would like to do:
>  
> "C:\Program Files\IrfanView\i_view32.exe" c:\ec-ref\referents\*.jpg 
> /resample=(0,100) /aspectratio /convert=c:\ec-ref\ref-thumbs\*.jpg 
> /killmesoftly
>  
> In Scheme, I tried with "process" and "shell-execute" but I could only 
> succede to open a file with the external programme. I am unable to 
> pass the parameters (  /resample=(0,100) /aspectratio 
> /convert=c:\ec-ref\ref-thumbs\*.jpg /killmesoftly   )  
>  
> I would be grateful for any suggestions!
> Thank you!
> Ivanka
>
>------------------------------------------------------------------------
>
>_________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>  
>



Posted on the users mailing list.