mIRC Home    About    Download    Register    News    Help

Print Thread
#272761 03/07/24 02:45 PM
Joined: Dec 2022
Posts: 15
M
Pikka bird
OP Offline
Pikka bird
M
Joined: Dec 2022
Posts: 15
I created a simple script that open a query window every time someone on my notify list enters IRC.

Code
on *:NOTIFY: {
  ; Keep the current window active
  var %active_window = $active

  ; Open a query window for the user
  query $nick
  .echo -q $nick $timestamp $+ :: $nick has entered IRC.

  ; Keep the current window active
  ;echo ' $+ %active_window $+ '
  window -a %active_window
}

The first part works. The query window is created, and the echo message written.
But when it goes to activate the previous active window, it throws the following error:

* /window: invalid parameters (line 11, FileName.ini)

I don't know what I'm doing wrong.

Joined: Jul 2006
Posts: 4,187
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,187
Events trigger with the status window as the active window, so it's likely that $active has the value "status window", breaking the number of parameter passed to /window.

The workaround is to use a timer if I recall correctly.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Feb 2011
Posts: 462
K
Pan-dimensional mouse
Offline
Pan-dimensional mouse
K
Joined: Feb 2011
Posts: 462
Some windows have a space in them like "Status Window", so place a quotes around them for the /window command.
Code
  ; Keep the current window active, and place quotes around them.
  var %active_window = $qt($active)

Not related, but I am curious about this section:

The ".echo -q" prevents the echo command from showing. Is that intended?
You might also be interested in the -n switch for the /query command to minimize the window.
Code
  ; Open a query window for the user
  query $nick
  .echo -q $nick $timestamp $+ :: $nick has entered IRC.

Joined: Dec 2002
Posts: 2,033
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,033
Why not just use the -n switch with the /query command to open the query window, but minimize it?

Is the active window the status window? Try using /window -a $qt(%active_window)

Joined: Dec 2022
Posts: 15
M
Pikka bird
OP Offline
Pikka bird
M
Joined: Dec 2022
Posts: 15
The
Code
.echo -q
was not on purpose. Honestly, I was a bit lazy when I wanted that script, so I asked GPT to write and he used “.echo -q” I didn't check it.
It's corrected now.


Link Copied to Clipboard