mIRC Home    About    Download    Register    News    Help

Print Thread
/writeini : insufficient parameters -> remove item #187880 14/10/07 04:49 PM
Joined: Jun 2004
Posts: 55
C
Chrisi Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Jun 2004
Posts: 55
If I use
/writeini file.ini topic item
with no value, the command should remove the item in the file.ini.

If it doesn't do this, I need a if (value) { writeini... } and a else { remini... }
And if I forget it one time, my script gets buggy, because the editbox in the dialog cannot get empty.

Maybe adding a swith would help.
/writeini -r checks if there is a value. If not, it uses remini instead.

Last edited by Chrisi; 14/10/07 05:15 PM.

Gamers.IRC - The best way to use mIRC
Re: /writeini : insufficient parameters -> remove [Re: Chrisi] #187886 14/10/07 05:23 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Well it's useful to have that error when the last parameter is missing to help catch coding problems. For your purposes you can use "" for the last parameter instead. This will actually insert "" into the INI file but surrounding quotes are ignored by $readini().

Code:
/writeini file.ini topic item $qt(value)

should work fine.

Use $+(",value,") instead of $qt(value) if you need to support mIRC versions older than 6.17.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: /writeini : insufficient parameters -> remove [Re: Chrisi] #187918 15/10/07 03:03 AM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
You could script your own "routine" for this purpose, like:
Code:
alias pushini {
  if ($3) {
    $iif((!$4),remini,writeini) $1-
  }
}

/pushini file.ini topic item [data]

Last edited by Horstl; 15/10/07 03:08 AM.