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