Page 1 of 1 1
Topic Options
#188598 - 2008-07-08 12:29 AM Closing a kixscript logs me out
RachidH Offline
Fresh Scripter

Registered: 2006-05-04
Posts: 18
Loc: The Netherlands
i have a test environment with batchfile that calls a kix-script.
like so: kix32.exe test.kix /f

it's a pretty long script and sometimes i just want to abort it, so i close the window.
but then i get logged out of windows xp !

anyone knows why this is happening or how to prevent it ?
have had it on multiple computers, and cant find it on the forums...

Top
#188599 - 2008-07-08 12:38 AM Re: Closing a kixscript logs me out [Re: RachidH]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Put the code below at the top of your script. This will prevent you from getting logged off when you abort the script when testing. It will log you off when it runs at logon.

 Code:
If NOT @LOGONMODE
	Break on
EndIf
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#188600 - 2008-07-08 04:08 AM Re: Closing a kixscript logs me out [Re: Mart]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
From the manual
 Quote:

BREAK
Action


Enables (BREAK ON) or disables (BREAK OFF) the ctrl+c/break keys and the Close command. This effectively allows control over whether a script run by KiXtart can be interrupted or not.

Syntax


BREAK <ON | OFF>



Remarks


By default, to prevent users from inadvertently interrupting a script, KiXtart automatically disables the ctrl+c/break keys, removes the Close command in the System menu of the current command-prompt window, and hides the Please wait while your logon script executes message box on Windows 9x.



In a multi-tasking environment such as Windows NT, users cannot be fully prevented from interrupting a program. (Programs can be stopped by using the Task List, for example.) As an additional protection, on computers running Windows NT Workstation only, when BREAK is OFF (the default) KiXtart also installs a special event handler for the current console. The effect of this handler is that whenever a user forcibly terminates KiXtart, the user is automatically logged off. This also means that you must be careful when testing scripts.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#188603 - 2008-07-08 10:17 AM Re: Closing a kixscript logs me out [Re: Gargoyle]
RachidH Offline
Fresh Scripter

Registered: 2006-05-04
Posts: 18
Loc: The Netherlands
Aaaaaah, thanks !
Top
#188605 - 2008-07-08 12:34 PM Re: Closing a kixscript logs me out [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
 Originally Posted By: Mart

 Code:
If NOT @LOGONMODE
	Break on
EndIf


2 questions -
A. does this actually work? If so, in what version? Under what conditions? I've not been able to get @LOGONMODE to return a value other than 0. (which would make your logic be executed all the time.)

B. I question the need for the logic. If you have a login script, you generally want break off. If you have an admin script, you definitely want break on during dev, and possibly all the time (especially with KF apps where you can [X] close them). Most scripts are designed either as login scripts or not, so I can't (personally) justify the If @LOGONMODE logic in my mind. In the words of our fearless leader - "Edumacate me".

I do (try to) use @LOGONMODE in my login script (with BREAK OFF in the beginning and BREAK ON at the end if an error message appears). I try to use it to determine if the home share should be mapped or not. If a VPN user connects after logging into the PC, they can invoke the login script manually. Since the user didn't do a standard login, they don't have their home share, and the @LOGONMODE will be used to either display a message indicating the home share was (auto)mapped, or will map the home drive. This is the part that has never worked, and displaying @LOGONMODE in the login script always shows "0".

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#188606 - 2008-07-08 02:34 PM Re: Closing a kixscript logs me out [Re: Glenn Barnas]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Hmmm.... you are absolutely right Glenn. I just assumed that @logonmode was working but it looks like it's not doing what it should. At least not on 4.60 and WinXP Pro SP3.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#188612 - 2008-07-08 05:28 PM Re: Closing a kixscript logs me out [Re: RachidH]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
Or just use taskmgr to kill kix32.exe ;\)
Top
#188623 - 2008-07-09 01:41 AM Re: Closing a kixscript logs me out [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
I've had no success with it on any flavor of XP or Vista, including X64, since I first tried to use it back in 4.5x (pre 4.53). I've got a couple of login applications that would benefit from the functionality. I kept wondering if I was doing something wrong every time you'd post that. Glad to know that this isn't adding to my craziness. ;\)

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#188650 - 2008-07-09 11:30 PM Re: Closing a kixscript logs me out [Re: Glenn Barnas]
lundholmster Offline
Just in Town

Registered: 2008-07-09
Posts: 1
Nevermind...

Edited by lundholmster (2008-07-09 11:52 PM)

Top
#188658 - 2008-07-10 01:42 PM Re: Closing a kixscript logs me out [Re: lundholmster]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
Back when it first happened I tried to replicate the problem, when you press "x" you force the script to close which logs you out. The same happens when you kill the script in taskmgr. But if you kill kix32.exe in the taskmgr then the script is ended and you will not be logged out.

The reason you can close KF apps by clicking "x" is that the $form then seizes to exist and thus ends the loop ($form.visible) because the form isn't visible anymore. Kix32 then proceeds to run the rest of the script (usually the next line includes exit 0).

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
0 registered and 242 anonymous users online.
Newest Members
SERoyalty, mytar, Gabriel, Alex_Evos, Dansen
17869 Registered Users

Generated in 0.062 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.

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