Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem abut twapi::creat_process

88 views
Skip to first unread message

xi...@163.com

unread,
May 23, 2007, 11:22:53 PM5/23/07
to
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.

xi...@163.com

unread,
May 23, 2007, 11:26:31 PM5/23/07
to

> 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

unread,
May 24, 2007, 5:15:17 AM5/24/07
to
> > C0E6E25330D1} -copen.conf -d- Hide quoted text -
>
> - 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

xi...@163.com

unread,
May 24, 2007, 10:15:15 PM5/24/07
to

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.

xi...@163.com

unread,
May 24, 2007, 10:18:30 PM5/24/07
to
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

unread,
May 25, 2007, 3:54:26 AM5/25/07
to

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

unread,
May 25, 2007, 4:01:24 AM5/25/07
to
> 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


0 new messages