mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2003
Posts: 37
C
cgfiend Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Mar 2003
Posts: 37
I'm attempting to perform message functions from a @window to a channel when I click on something in the @window, but the focus of the formerly active channel is "lost" and the Status window becomes the focus. How do I bring back focus to the last channel I was in so I can perform /say or /me?

Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
In scripts it's better to use /msg #channel instead of /say and /describe #channel instead of /me. (change #channel with the name of your channel ofcourse).

Now for the second problem: I'm not aware of a $id that gives you the last active channel, you can get the current active window with $active, but on your custom window, it will show @windowname...

Joined: Mar 2003
Posts: 37
C
cgfiend Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Mar 2003
Posts: 37
Hmmm... might have to rethink this. I could always keep track of the rooms. /msg #channel mytext worked fine. But not knowing the last active channel is the problem. Hmm.. maybe I could do an ON trigger to store the channel name. I just hoped there was a better way. Thanks. Food for thought. smile

(edit)

I found a way. Use $chan(x) to find the name of each channel I'm in. Of course, it won't store the last channel I *was* in, but it should work. Also, if I am logged onto two servers I can use $server to get the server names, then use that to access both servers' channels.

Last edited by cgfiend; 21/07/04 05:38 PM.
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
  • on *:connect:unset %lactivechan. $+ $cid
    on *:active:#:set %lactivechan. $+ $cid #

//msg $($+(%,lactivechan.,$cid),2) message

You might want to unset it when you part (or are kicked from) channels too.

Joined: Mar 2003
Posts: 37
C
cgfiend Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Mar 2003
Posts: 37
Thanks. Another way I figured out without using ON triggers...

;find file using filename from listbox (no path specified)
var %t = $findfile(g:\ogg,* $+ $sline(@FrethScript,1),0,var %f = $1-)

;play the file using an external player associated with file
/run %f

;switch to the last active channel and make it active again
/window -a $chan(1)

;place a command in the active window's edit box and press enter - in this case a play emote
/editbox -an /me plays $nopath(%f)

(edit) This is flawed tho since $chan(1) only gives the first channel window always. $lactive would be what to use, but I am still trying to figure out what it is when it's a status window.

Last edited by cgfiend; 22/07/04 04:51 PM.
Joined: Mar 2003
Posts: 37
C
cgfiend Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Mar 2003
Posts: 37
Found the answer on this forum. smile Problem solved...

Instead of using this...
/window -a $chan(1)

...this works like a charm and works w/ Status WIndow...
window -a $iif(* * iswm $lactive,$+(",$lactive,"),$lactive)

Joined: Mar 2003
Posts: 37
C
cgfiend Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: Mar 2003
Posts: 37
***UPDATE***
I was wrong. Disregard the above!! Even with the above example, if you try to /me from a @Window when the last active window was the Status Window you will get an error message that /me cannot be used in the current window (status window).

The secret isn't to check for the last active window at all. Instead, you check the active window and see if it's the type of "status".

;If the active window type is not equal to "status" then
;take the edit box of the last active window and add
;"/me says something", then press Enter.

if $window($active).type != status { /editbox -an /me says something. }


This will effectively post in the last active window unless it's a status window. smile


Link Copied to Clipboard