For Programmers: Free Programming Magazines  


Home > Archive > Tcl > May 2007 > Problem abut twapi::creat_process









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problem abut twapi::creat_process
xin97@163.com

2007-05-24, 8:08 am

Dear all:
I have create a tcl file to run a program wpa_supplicant.exe.
the script is as following:

twapi:: create_process c:\katexie\wpa_supplicant.exe -cmdline -
i{2165EB16-49D0-A553-C0E6E25330D1} -cmdline -copen.conf -cmdline -d

but the returned message tell me the file cann't be found.
but if i enter it in DOS command window:
c:\katexie\wpa_supplicant.exe -i{2165EB16-49D0-A553-
C0E6E25330D1} -copen.conf -cmdline -d

the program can run.

So I don't know how to use create_process to run this program?
Could you please give me a hand? thanks.

xin97@163.com

2007-05-24, 8:08 am


> Dear all:
> I have create a tcl file to run a program wpa_supplicant.exe.

sorry, the command in DOS command window is:
> c:\katexie\wpa_supplicant.exe -i{2165EB16-49D0-A553-
> C0E6E25330D1} -copen.conf -d


Mark Janssen

2007-05-24, 8:08 am

On May 24, 5:26 am, x...@163.com wrote:
>
> sorry, the command in DOS command window is:
>
>
>
>
> - Show quoted text -


You are having two problems:

1) The backslaches in the executable name are substituted by Tcl to:
c:katexiewpa_supplicant.exe which indeed cannot be found.
2) -cmdline of create_process (probably) requires a single argument.
Try this instead:

twapi:: create_process {c:\katexie\wpa_supplicant.exe} -cmdline {-
i{2165EB16-49D0-A553-C0E6E25330D1} -cmdline -copen.conf -d}

Mark

Mark



xin97@163.com

2007-05-24, 10:08 pm

On 5 24 , 5 15 , Mark Janssen <mpc.jans...@gmail.com> wrote:
> On May 24, 5:26 am, x...@163.com wrote:
>
>
>
>
>
> You are having two problems:
>
> 1) The backslaches in the executable name are substituted by Tcl to:
> c:katexiewpa_supplicant.exe which indeed cannot be found.
> 2) -cmdline of create_process (probably) requires a single argument.
> Try this instead:
>
> twapi:: create_process {c:\katexie\wpa_supplicant.exe} -cmdline {-
> i{2165EB16-49D0-A553-C0E6E25330D1} -cmdline -copen.conf -d}
>
> Mark
>
> Mark


thank you, Mark.

I have tried the modified command,
twapi::create_process {c:\katexie\wpa_supplicant.exe} -cmdline {-
i{2165EB16-49D0-A553-C0E6E25330D1} -copen.conf -d}


this time, the program can be found.
but the TCL think the argment is not correct. why?
thanks.

xin97@163.com

2007-05-24, 10:08 pm

hi Mark,
I use create_process not exec for I can control the program if I
want to stop it.
and if i use exec, tcl cann't stop the program.

Mark Janssen

2007-05-25, 4:22 am

On May 25, 4:18 am, x...@163.com wrote:
> hi Mark,
> I use create_process not exec for I can control the program if I
> want to stop it.
> and if i use exec, tcl cann't stop the program.


If you use exec with a & appended, exec will return the PID of the
created process which you can use with twapi::end_process to close the
application. For example:

set pid [exec c:/katexie/wpa_supplicant.exe -i{2165EB16-49D0-A553-
C0E6E25330D1} -copen.conf -d &]

and later

::twapi::end_process $pid

Mark

Mark Janssen

2007-05-25, 4:22 am

On May 25, 4:15 am, x...@163.com wrote:
> On 5 24 , 5 15 , Mark Janssen <mpc.jans...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> thank you, Mark.
>
> I have tried the modified command,
> twapi::create_process {c:\katexie\wpa_supplicant.exe} -cmdline {-
> i{2165EB16-49D0-A553-C0E6E25330D1} -copen.conf -d}
>
> this time, the program can be found.
> but the TCL think the argment is not correct. why?
> thanks.- Hide quoted text -
>
> - Show quoted text -


First of all, when reporting back issues, it is very useful to include
the exact error you are getting as Tcl generally has very instructive
error messages. Secondly, the TWAPI create_process manual at
http://twapi.sourceforge.net/process.html states:
This generally includes the program being executed as the first
token in CMDLINE.

So try:

twapi::create_process {} -cmdline {c:\katexie\wpa_supplicant.exe -
i{2165EB16-49D0-A553-C0E6E25330D1} -copen.conf -d}

instead. If the PROGRAM argument is {} the -cmdline parameter will be
used instead.

Mark


Taunto

2007-05-27, 1:50 pm

http://Britney-Spears-jerking.info/...p?movie=1673286
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com