We need a way to return the status of the 2nd editbox
See the full report here

Problem: mIRC 6.12 has no direct way to check if the 2nd editbox is open. Therefore a /editbox -o command will generate an error message if the 2nd editbox does not exist, and there is no way to stop it from generating this error.

Solution By using the $readini in conjunction mirc.INI file you can use the configuration settings from the [editbox] header to see whether the editbox SHOULD be active. Note firstly that this does not necessarily mean that the 2nd editbox IS active, but it must be assumed that mIRC is functioning correctly (which is a fair assumption), and that the editbox is properly opened.

Note: The mirc.INI file seems to be updated right away without having to /saveini (with regards to the 2nd editbox). So using the ini file to return the configuration values in the case of the 2nd editbox is a reliable solution.

Bugs & Limitations: While mIRC updates the ini file if the user changes the settings via the editbox options dialog, it does not update the ini file if the user presses ALT-Q in the target window to toggle the 2nd editbox on/off. There is no known way to fix this except for Khaled to add an internal identifier for the 2nd editbox's status in the next version of mIRC.

Conclusion: While this workaround is more or less reliable, it is not fool-proof, and therefore the best method to fix this problem is to have Khaled include an internal identifier that can return the actual status of the 2nd editbox, as mentioned above.

The implementation:
Usage: $editbox2open(#channel)

Code:
alias editbox2open {
  var %chan = $$1

  ; I'm not even on the channel, return false.
  if ($me !ison %chan) return $false
  
  ; Get the 2nd editbox setting assuming there is one for the channel
  var %line = $readini(mirc.ini, editbox, %chan)
  if (%line == $null) {
    ; There is no setting for the channel, use default
    %line = $readini(mirc.ini, editbox, default)
  }

  ; The configuration line is written as comma delimited tokens
  tokenize 44 %line
  
  ; If the 1st parameter is 1, it means the 2nd editbox is "Always on", return true.
  if ($1 == 1) return $true
  else {

    ; If the 2nd parameter is 1 and our channel mode is accurate it should also be on.
    if (($1 == 0) && ($2 == 1) && ($nick(%chan, $me).pnick == $remove($3, "))) {
      return $true
    }

    ; Neither of these cases are true.
    return $false
  }
  return $false
}



See the full report here


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"