From WikiChip
Difference between revisions of "mirc/identifiers/$window"
< mirc‎ | identifiers

(Parameters)
(Properties)
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{mirc title|$window Identifier}}'''$window''' returns information about the specified window.
+
{{mirc title|$window Identifier}}'''$window''' returns information about the specified window for the current connection or returns the name of the @window that is left inside the 'leave' menu {} event.
  
WORK IN PROGRESS
+
== Synopsis ==
 +
<source lang="mIRC">$window(N/name)
  
== Synopsis ==
+
$window
<pre>$window(N/name)</pre>
+
</source>
  
 
== Parameters ==
 
== Parameters ==
  
* '''N''' - The Nth window, if N is 0, returns the total number of windows.
+
* '''N''' - The Nth @custom window, if N is 0, returns the total number of windows.
* '''Name''' - The name of query/channel/@custom window, or "status window"
+
* '''Name''' - The name of query/channel/@custom window, or "status window", "channel list", etc..
 +
 
 +
'''Note''': you can use -1 or @desktop to refer to the screen, -2 or @mirc to refer to the main mIRC window, and -3 or @mdi to refer to the mdi window where all others windows inside mIRC are displayed, these @name are reserved. You can use the .x .y .w .h .dx .dy .dw .dh properties with these parameters to get the size of these windows (or your screen's size)
  
 
== Properties ==
 
== Properties ==
Properties: x, y, w, h, dx, dy, dw, dh, bw, bh, mdi, title, state, font, fontsize, fontbold, fontitalic, fontcs, logfile, stamp, icon, ontop, type, anysc, wid, cid, hwnd, sbtext, sbcolor, sbstate, tbtext, tbstate, idle, lb
 
 
 
* '''x,y,w,h''' - the left, top positions, and the width and height of the window respectively
 
* '''x,y,w,h''' - the left, top positions, and the width and height of the window respectively
 
* '''dx,dy''' - the left, top positions of the window relative to the desktop
 
* '''dx,dy''' - the left, top positions of the window relative to the desktop
 +
* '''cx,cy''' - the left, top positions of the window relative to the primary monitor
 
* '''dw,dh''' - the width and height of the text display area
 
* '''dw,dh''' - the width and height of the text display area
 
* '''bw,bh''' - the width and height of the bitmap for a graphic window
 
* '''bw,bh''' - the width and height of the bitmap for a graphic window
Line 23: Line 25:
 
* '''font''' -  the name of the window's font
 
* '''font''' -  the name of the window's font
 
* '''fontsize''' - the window's font size
 
* '''fontsize''' - the window's font size
 +
* '''fontdialogsize''' - returns the size of the current font in font dialog size
 
* '''fontbold''' - $true if the font is bold, otherwise returns $false
 
* '''fontbold''' - $true if the font is bold, otherwise returns $false
 
* '''fontitalic''' - $true if the font is italic, otherwise returns $false
 
* '''fontitalic''' - $true if the font is italic, otherwise returns $false
 
* '''fontcs''' - the character set of the current font
 
* '''fontcs''' - the character set of the current font
 +
* '''fullscreen''' - $true if the window is in fullscreen, $false otherwise
 
* '''logfile''' - the path\filename of the window's logfile if one is open
 
* '''logfile''' - the path\filename of the window's logfile if one is open
 
* '''stamp''' - timestamp setting, $true or $false
 
* '''stamp''' - timestamp setting, $true or $false
 
* '''icon''' - returns on/off depending on whether icon is visible
 
* '''icon''' - returns on/off depending on whether icon is visible
 
* '''ontop''' - returns ontop status for a window, $true or $false
 
* '''ontop''' - returns ontop status for a window, $true or $false
* '''type''' -  returns window type: status,channel,custom,query,Urls List... Does not reflect cursor being in Options or Remote Scripot Editor
+
* '''type''' -  returns window type: status,channel,custom,query,etc...
 
* '''anysc''' -  returns $true or $false to indicate if the /window was created using the -i switch
 
* '''anysc''' -  returns $true or $false to indicate if the /window was created using the -i switch
 
* '''wid''' - returns the window id number
 
* '''wid''' - returns the window id number
 
* '''cid''' - returns the connection id number associated with that window. Changes based on active network if @window created using the -i switch
 
* '''cid''' - returns the connection id number associated with that window. Changes based on active network if @window created using the -i switch
 
* '''hwnd''' - returns the window handle number
 
* '''hwnd''' - returns the window handle number
* '''sbtext''' - sbtext returns the switchbar button text, even if window is hidden from the switchbar (such as custom windows losing the @ when created using the -k switch)
+
* '''sbtext''' - sbtext returns the switchbar button text
 
* '''sbcolor''' the name of the switchbar highlight color, event/message/highlight, or $null if not colored
 
* '''sbcolor''' the name of the switchbar highlight color, event/message/highlight, or $null if not colored
 
* '''sbstate''' - returns switchbar button state for a window, 0=hidden 1=not hidden
 
* '''sbstate''' - returns switchbar button state for a window, 0=hidden 1=not hidden
* '''tbtext''' - returns the treebar button text, even if treebar is not displayed, but only if the window is not hidden from the treebar
+
* '''tbtext''' - returns the treebar button text
 
* '''tbstate''' - returns treebar button state for a window, 0=hidden 1=not hidden
 
* '''tbstate''' - returns treebar button state for a window, 0=hidden 1=not hidden
* '''idle''' - returns idle state
+
* '''idle''' - returns the number of second elapsed since someone different from you talked in a channel/query
* '''lb''' - returns 0= no listbox, 1= has listbox, or 2= has side listbox
+
* '''lb''' - returns 0 if the window has no listbox, 1 if it has a listbox, or 2 if it has a side listbox
 
+
* '''.utf''' - used to returns the utf mode of the window which could be changed via the /font setting in mIRC 6.17-6.35, 1 = default, 2 = utf8 is displayed (decoded) only, 3 = utf8 is displayed and encoded, nowadays it always seems to return 2, even if you disabled the encoding and decoding of utf8 in main mirc option
Note: Using names -1 and @desktop are aliases to the width and height of the screen, -2 and @mirc are aliases to the main mIRC window, -3 and @mdi are aliases to the MDI window where all other windows inside mIRC are displayed. Using $window(name) with these aliases does not return a window name, and the only properties which return a value for these names are: .x .y .w .h .dx .dy .dw  .dh .state .icon .type .cid .wid .hwnd (wid and cid return 0).<br><br>
 
 
 
Note: $window(name) returns the actual name of the window, regardless of the upper/lower case spelling used in the identifier. If window was created using name @Test, $window(@TEST) and $window(@test) both return Test. Channel and DCC windows return a value only when $window is used from that connection id. $window(#test) returns the name of that channel window when the active window is on the connection where a channel named #test is open, and returns $null at all other connections.<br><br>
 
 
 
If there is an open send window, $window(Send ReceivingNick $nopath(filename)) returns $null except within the connection where the DCC was made.<br><br>
 
 
 
The non-number name used to obtain properties from a window should be the same string returned by the $active identifier.
 
  
 
== Example ==
 
== Example ==
Line 60: Line 57:
  
 
<source lang="mIRC">
 
<source lang="mIRC">
echo -a Checking which .props work for windows -1 -2 and -3.
+
//var %i $window(0) , %list | while (%i) { var %list $window(%i).sbtext %list | dec %i } | echo -a These are the @custom windows as shown in the switchbar: %list (windows listed without @ were created using -k switch)
//tokenize 44 x, y, w, h, dx, dy, dw, dh, bw, bh, mdi, title, state, font, fontsize, fontbold, fontitalic, fontcs, logfile, stamp, icon, ontop, type, anysc, wid, cid, hwnd, sbtext, sbcolor, sbstate, tbtext, tbstate, idle, lb | while ($1) { var %i -1 | var %text $1 | while (%i isnum -3--1 ) { var %text %text / [ $ $+ [ window( [ %i ] ). $+ [ $1 ] ] ] | dec %i } | echo -a %text | tokenize 32 $2- }
+
//echo -a The font of the active window is: $window($active).font $window($active).fontsize $iif($window($active).fontbold,Bold) $iif($window($active).fontitalic,Italic)
 +
//window -ea @test | titlebar @test This text appears in the titlebar | [ $iif($window(@test).type == listbox,aline,echo) ] @test The titlebar of this window shows $window(@test).title
 +
//window -c @test | window -ekaido @test | timertest 99 1 echo @test $!timer(test).reps $!asctime The Connection id $!window(@test).cid $!scid( $!window(@test).cid ).network changes as you click between windows attached to different connections
 
</source>
 
</source>
 
  
  

Latest revision as of 01:45, 15 September 2022

$window returns information about the specified window for the current connection or returns the name of the @window that is left inside the 'leave' menu {} event.

Synopsis[edit]

$window(N/name)
 
$window

Parameters[edit]

  • N - The Nth @custom window, if N is 0, returns the total number of windows.
  • Name - The name of query/channel/@custom window, or "status window", "channel list", etc..

Note: you can use -1 or @desktop to refer to the screen, -2 or @mirc to refer to the main mIRC window, and -3 or @mdi to refer to the mdi window where all others windows inside mIRC are displayed, these @name are reserved. You can use the .x .y .w .h .dx .dy .dw .dh properties with these parameters to get the size of these windows (or your screen's size)

Properties[edit]

  • x,y,w,h - the left, top positions, and the width and height of the window respectively
  • dx,dy - the left, top positions of the window relative to the desktop
  • cx,cy - the left, top positions of the window relative to the primary monitor
  • dw,dh - the width and height of the text display area
  • bw,bh - the width and height of the bitmap for a graphic window
  • mdi - $true if the window is mdi, otherwise returns $false
  • title - text in the titlebar of the window
  • state - returns minimized/maximized/hidden/normal
  • font - the name of the window's font
  • fontsize - the window's font size
  • fontdialogsize - returns the size of the current font in font dialog size
  • fontbold - $true if the font is bold, otherwise returns $false
  • fontitalic - $true if the font is italic, otherwise returns $false
  • fontcs - the character set of the current font
  • fullscreen - $true if the window is in fullscreen, $false otherwise
  • logfile - the path\filename of the window's logfile if one is open
  • stamp - timestamp setting, $true or $false
  • icon - returns on/off depending on whether icon is visible
  • ontop - returns ontop status for a window, $true or $false
  • type - returns window type: status,channel,custom,query,etc...
  • anysc - returns $true or $false to indicate if the /window was created using the -i switch
  • wid - returns the window id number
  • cid - returns the connection id number associated with that window. Changes based on active network if @window created using the -i switch
  • hwnd - returns the window handle number
  • sbtext - sbtext returns the switchbar button text
  • sbcolor the name of the switchbar highlight color, event/message/highlight, or $null if not colored
  • sbstate - returns switchbar button state for a window, 0=hidden 1=not hidden
  • tbtext - returns the treebar button text
  • tbstate - returns treebar button state for a window, 0=hidden 1=not hidden
  • idle - returns the number of second elapsed since someone different from you talked in a channel/query
  • lb - returns 0 if the window has no listbox, 1 if it has a listbox, or 2 if it has a side listbox
  • .utf - used to returns the utf mode of the window which could be changed via the /font setting in mIRC 6.17-6.35, 1 = default, 2 = utf8 is displayed (decoded) only, 3 = utf8 is displayed and encoded, nowadays it always seems to return 2, even if you disabled the encoding and decoding of utf8 in main mirc option

Example[edit]

//echo -a There are $window(0) custom windows open $iif($window(1),The first custom window listed in 'window' menu is $v1)
//echo -a Custom window @test $iif($window(@test),Does,Does Not) exist.
//echo -a Channel named #test $iif($window(#test),is open on this .cid,is not open on this .cid but might be open on other .cid)
//var %i $window(0) , %list | while (%i) { var %list $window(%i).sbtext %list | dec %i } | echo -a These are the @custom windows as shown in the switchbar: %list (windows listed without @ were created using -k switch) 
//echo -a The font of the active window is: $window($active).font $window($active).fontsize $iif($window($active).fontbold,Bold) $iif($window($active).fontitalic,Italic)
//window -ea @test | titlebar @test This text appears in the titlebar | [ $iif($window(@test).type == listbox,aline,echo) ] @test The titlebar of this window shows $window(@test).title
//window -c @test | window -ekaido @test | timertest 99 1 echo @test $!timer(test).reps $!asctime The Connection id $!window(@test).cid $!scid( $!window(@test).cid ).network changes as you click between windows attached to different connections


Compatibility[edit]

Added: mIRC v5.0
Added on: 02 Apr 1997
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See Also[edit]

/window