Page 1 of 1 1
Topic Options
#214302 - 2025-06-29 06:04 PM GetKixOptions() - Ideas and Suggestions
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
I’ve been working on trying to find a strange little and inconsistent bug which has led me to creating GetKixOptions, which just gets all the SETOPTIONS from kix, into an array.

A couple of things about this…
I never noticed or forgot about ASCII and HideCursor
Is there any other Options you can think of that have been added to newer versions of Kix that are not in the list?
Can anyone think of a more direct way to create this list of values?

 Code:
$Vals=GetKixOptions()
? ubound($Vals)
for each $val in $vals
  ? $val
next


function GetKixOptions
  dim $KOptions[9],$i,$A[9]
  $KOptions="ASCII","CaseSensitivity","DisableDebugging","Explicit","HideCursor","NoVarsinStrings","NoMacrosinstrings",
            "WOW64AlternateRegView","Wow64FileRedirection","WrapAtEOL"
  for $i = 0 to ubound($KOptions)
    $A[$i]=$KOptions[$i]+ "=" + setoption($KOptions[$i] )
  next
  $GetKixOptions=$A
endfunction


Output
 Code:
ASCII=OFF
CaseSensitivity=OFF
DisableDebugging=OFF
Explicit=OFF
HideCursor=OFF
NoVarsinStrings=OFF
NoMacrosinstrings=OFF
WOW64AlternateRegView=OFF
Wow64FileRedirection=ON
WrapAtEOL=OFF

Top
#214308 - 2025-07-01 04:13 PM Re: GetKixOptions() - Ideas and Suggestions [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4400
Loc: New Jersey
Interesting function! I explicitly set Explicit, NoVarsIn***, WrapAtEOL, and the WOW64*** values in every application, I rarely use CaseSensitivity and never use ASCII. Completely forgot about DisableDebugging - will consider adding that to all apps moving forward. (Actually, it isn't needed for Tokenized scripts.)

Small changes:
  • Don't declare the array size, just the vars. Changing the list contents automatically sets the array size should this change in the future. Set the output array based on the size of the source array so they remain the same. This makes this logic concept applicable to other similar processes.
  • Added an optional argument to allow returning an array of arrays, making it easier to find a value programmatically instead of string parsing, which is good for reporting and logging. I'd more likely just run SetOption(Name) to query the specific value I'm interested in, but if I had a debug function or had an app that manipulated these settings often, this would be useful to validate current settings and ensure they were returned to the desired state.
 Code:
Function GetKixOptions(OPTIONAL $Array)
  Dim $aKOptions, $aResp
  Dim $I

  ; Set aKOptions to an array and auto-size to the list provided
   $aKOptions="ASCII","CaseSensitivity","DisableDebugging","Explicit","HideCursor","NoVarsinStrings","NoMacrosinstrings",
            "WOW64AlternateRegView","Wow64FileRedirection","WrapAtEOL"
  ; set aResp to the same size as the source
  ReDim Preserve ($aResp, UBound($aKOptions))
  ; Enumerate the list of options and set their name/value pairs
  For $I = 0 to UBound($aKOptions)
    If $Array
      $aResp[$I] = $aKOptions[$I], SetOption($KOptions[$I])        ; return array of arrays
    Else
      $aResp[$I] = $aKOptions[$I] + "=" + SetOption($KOptions[$I]) ; return array of strings
    EndIf
  Next
  $GetKixOptions = $aResp

  Exit 0

EndFunction


Edited by Glenn Barnas (2025-07-01 04:48 PM)
Edit Reason: updated for DisableDebugging
_________________________
Actually I am a Rocket Scientist! \:D

Top
#214310 - 2025-07-02 06:55 PM Re: GetKixOptions() - Ideas and Suggestions [Re: Glenn Barnas]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4557
Loc: USA
I like the changes.
Top
#214314 - 2025-08-06 11:29 AM Re: GetKixOptions() - Ideas and Suggestions [Re: Allen]
morganw Offline
Fresh Scripter

Registered: 2015-10-20
Posts: 15
Loc: UK
"NoNetwork" is missing from the list of values.
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 367 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.053 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