Page 1 of 1 1
Topic Options
#198349 - 2010-04-07 06:28 PM Any chance we could get a command line switch added to turn BREAK ON?
IanDubbelboer Offline
Fresh Scripter

Registered: 2004-06-25
Posts: 24
I understand the need to have the default mode BREAK OFF, but I just gave myself and unexpected log off by exiting out of a script I was debugging before I had evaluated BREAK ON.

I was thinking if we could add a command line switch to turn BREAK ON it would be much easier to avoid screwing yourself up.

Top
#198353 - 2010-04-07 07:02 PM Re: Any chance we could get a command line switch added to turn BREAK ON? [Re: IanDubbelboer]
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
make another script on your desktop
 Code:
break on
call "scriptname.kix"
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#198356 - 2010-04-07 08:09 PM Re: Any chance we could get a command line switch added to turn BREAK ON? [Re: Radimus]
IanDubbelboer Offline
Fresh Scripter

Registered: 2004-06-25
Posts: 24
Ya I could do that. The time it gets me is usually when I create something quick. Still a pain in the backside.
Top
#198370 - 2010-04-08 11:19 AM Re: Any chance we could get a command line switch added to turn BREAK ON? [Re: IanDubbelboer]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4945
Loc: Leatherhead, Surrey, UK
You can use a command line switch (kind of):
 Code:
If Not IsDeclared($BREAK) $BREAK="OFF" EndIf
"Switching BREAK "+$BREAK+@CRLF
$=Execute("BREAK "+$BREAK)

"Try and break me in the next 5 seconds!"
Sleep 5


Now call the script witth the option:
 Quote:
kix32 myscript.kix $BREAK=ON


If you don't want to specify the state you can simplify it:
 Code:
If IsDeclared($BREAK) BREAK ON EndIf

"Try and break me in the next 5 seconds!"
Sleep 5


Now just call the script with $BREAK to enable it:
 Quote:
kix32 myscript.kix $BREAK


If you want BREAK enabled by default unless you specifically disable it when the script goes into production, just change the logic slightly and include it in all your scripts:

 Code:
BREAK ON
If IsDeclared($NOBREAK) BREAK OFF EndIf

"Try and break me in the next 5 seconds!"
Sleep 5


When you run the script from the command line break is enabled, when you push it into production just make sure that $NOBREAK is specified on the command line.

Finally, how about deciding the break state based on group membership or login?
 Code:
BREAK OFF
If InGroup("DOMAIN\Give me a break")
   "Break enabled for support staff"+@CRLF
   BREAK ON
EndIf

Top
#198372 - 2010-04-08 04:27 PM Re: Any chance we could get a command line switch added to turn BREAK ON? [Re: Richard H.]
IanDubbelboer Offline
Fresh Scripter

Registered: 2004-06-25
Posts: 24
Thanks guys, I think I am just in the minority for what I want.

I got into writing full applications in Kix using Kixforms for the GUI. These are "scripts" that are some 4000 lines long. Typically, that is just too big to easily debug with -d and stepping through the script. I got into what might be the bad habit of dumping a problem function into a seperate script and debuging it there with known inputs.

I probably should just use DEBUG ON, heck I should be using a different language, but the seperate script always made it easier to edit just that part of the script without losing my spot.

The problem with doing this is the classic.
1. Copy the code into a brand new script
2. "Lets fire it up and see what is wrong."
3. "Oh look, there it is. *muddle with code* Guess I don't need to debug."
4. Close the window without geting past BREAK ON
5. Scream "NOT AGAIN!" as I log myself off.

Top
#198373 - 2010-04-08 04:46 PM Re: Any chance we could get a command line switch added to turn BREAK ON? [Re: IanDubbelboer]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4464
Loc: USA
If its any comfort to you, I've always wished Break was on by default. In fact I'm sure we've had discussions of this in past, but there was no consensus.
Top
#198375 - 2010-04-08 05:05 PM Re: Any chance we could get a command line switch added to turn BREAK ON? [Re: Allen]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4945
Loc: Leatherhead, Surrey, UK
Get into the habit of pulling a template header into the top of every script you create, no matter how small or ephemeral it might be.

Your template will have placeholders for documentation, standard functions and basic settings that you need - including things like turning BREAK off for yourself, setting WrapAtEOL and Explicit and so-on.

The same advice applies for any coding language, not just KiXtart, and will save you a bit of self-cursing in the long run.

Top
#198376 - 2010-04-08 05:18 PM Re: Any chance we could get a command line switch added to turn BREAK ON? [Re: Richard H.]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4642
Loc: The Netherlands
Changing kix to have break on by default might break a lot of scripts imho.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#198377 - 2010-04-08 11:25 PM Re: Any chance we could get a command line switch added to turn BREAK ON? [Re: Mart]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4464
Loc: USA
I don't think it would break anything, but it would definately require turning it on when needed... alas it don't matter \:\)
Top
#198380 - 2010-04-09 04:06 AM Re: Any chance we could get a command line switch added to turn BREAK ON? [Re: Allen]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11573
Loc: CA
And many want and run WKIX32 which has no console output and thus nothing to break on
Top
#198449 - 2010-04-24 08:14 PM Re: Any chance we could get a command line switch added to turn BREAK ON? [Re: NTDOC]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4642
Loc: The Netherlands
Reply from John_Ross has been moved to: http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=198448 because it had nothing to do with the original post.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#212019 - 2016-10-10 09:04 AM Re: Any chance we could get a command line switch added to turn BREAK ON? [Re: Mart]
Ruud van Velsen Offline
Developer
*****

Registered: 1999-05-06
Posts: 359
Loc: Amsterdam, The Netherlands
As yu may have seen, 4.67 now has a commandline option to start with BREAK ON...
Top
Page 1 of 1 1


Moderator:  Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 161 anonymous users online.
Newest Members
diefnet, Arogya, gkustra, emnipetro, Hirze
17644 Registered Users

Generated in 0.035 seconds in which 0.011 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