Page 1 of 1 1
Topic Options
#163184 - 2006-06-13 11:20 AM Run external program
dzulkeply Offline
Lurker

Registered: 2006-06-13
Posts: 3
Hi,
What I want to do is like this:
1) Read user login name
2) Pass this user login name to external program as parameter
3) Run the external program and wait for it completion
4) The external program will return either -1 or 0
5) If 0, continue login process else log off

Can kixtart script do this?

Top
#163185 - 2006-06-13 11:21 AM Re: Run external program
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Yes it can, no problem.
Top
#163186 - 2006-06-13 11:41 AM Re: Run external program
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Some (most) apps set error codes that can be used in a script. It all depends on how the external app returns the error codes and how it wants the parameters (-parameter, /parameter, \parameter, etc...) some extra info would be nice.

The error code can be taken from @error, the username can be taken from @userid, logoff if error can be done by LogOff() and the external app (and let the script wait until the app exits) can be done by Shell.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#163187 - 2006-06-13 11:58 AM Re: Run external program
dzulkeply Offline
Lurker

Registered: 2006-06-13
Posts: 3
Thanks a lot!!!!!
Any example script?

Top
#163188 - 2006-06-13 12:22 PM Re: Run external program
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Untested.

Code:

$line = "%compspec% /c c:\someapp.exe /" + @userid

Shell $line

If @error <> 0
?"External app returned an error."
?@ERROR
Sleep 5
LogOff(1)
Else
;do other script stuff here.
EndIf

_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#163189 - 2006-06-14 02:38 AM Re: Run external program
dzulkeply Offline
Lurker

Registered: 2006-06-13
Posts: 3
Thanks a lot again!!!!!
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1334 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.073 seconds in which 0.011 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org