Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Minimize to tray menu + stacking


  • Please log in to reply
25 replies to this topic
gl0x0r
  • Members
  • 6 posts
  • Last active: Jul 25 2005 03:54 AM
  • Joined: 23 Jul 2004
Having downloaded autohotkey recently, I started making a few scripts to do useful stuff in windows. I wanted the minimize to tray script (in the autohotkey example scripts section) to be able to undo its minimization via another hotkey.

Basically the script stores the order the windows were hidden in and restores the last hidden on when the correct hotkey is pressed.

On another note, is there a way to simulate a linked list or stack in autohotkey? It would have made my work even easier than it already was.

; Minimize Window to Tray Menu
; http://www.autohotkey.com
; This script assigns a hotkey of your choice to hide any window so that
; it becomes an entry at the bottom of the script's tray menu.  Hidden
; windows can then be restored individually or all at once by selecting
; the corresponding item on the menu.  If the script exits for any reason,
; all the windows that it hid will be restored automatically.

; CONFIGURATION SECTION: Change the below values as desired.

; This is the maximum number of windows to allow to be hidden:
mwt_MaxWindows = 50

; This is the hotkey used to hide the active window:
mwt_stack = #h
mwt_unStack = #+h

; If you prefer to have the tray menu empty of all the standard items,
; such as Help and Pause, use N.  Otherwise, use Y:
mwt_StandardMenu = N

; These first few performance settings help to keep the action within
; the #HotkeyModifierTimeout period, and thus avoid the need to release
; and press down the hotkey's modifier if you want to hide more than one
; window in a row.  These settings are not needed you choose to have the
; script use the keyboard hook via #InstallKeybdHook or other means:
#HotkeyModifierTimeout 100
SetWinDelay 10
SetKeyDelay 0

; The below are recommended for this script:
SetBatchLines 10ms
#SingleInstance


; ----------------------------------------------------

Hotkey, %mwt_stack%, mwt_Minimize
Hotkey, %mwt_unStack%, mwt_UnMinimize

; If the user terminates the script by any means, unhide all the
; windows first:
OnExit, mwt_RestoreAllThenExit

if mwt_StandardMenu = Y
	Menu, Tray, Add
else
{
	Menu, Tray, NoStandard
	Menu, Tray, Add, E&xit, mwt_RestoreAllThenExit
}
Menu, Tray, Add, &Restore All Hidden Windows, mwt_RestoreAll
Menu, Tray, Add  ; Another separator to make the above more special.

return  ; End of auto-execute section


mwt_Minimize:
if mwt_WindowCount >= %mwt_MaxWindows%
{
	MsgBox No more than %mwt_MaxWindows% may be hidden simultaneously.
	return
}

WinGet, ActiveID, ID, A
WinGetTitle, ActiveTitle, ahk_id %ActiveID%
; Because hiding the window won't deactivate it, activate the window
; beneath this one (if any). I tried other ways, but they wound up
; activating the task bar.  This way sends the active window (which is
; about to be hidden) to the back of the stack, which seems best:
Send, !{esc}
; Don't hide until after the above, since by default hidden windows are
; not detected:
WinHide, ahk_id %ActiveID%

; In addition to the tray menu requiring that each menu item name be
; unique, it must also be unique so that we can reliably look it up in
; the array when the window is later unhidden.  So make it unique if it
; isn't already:
Loop, %mwt_MaxWindows%
{
	if mwt_WindowTitle%a_index% = %ActiveTitle%
	{
		; Match found, so it's not unique.
		; First remove the 0x from the hex number to conserve menu space:
		StringTrimLeft, ActiveIDShort, ActiveID, 2
		StringLen, ActiveIDShortLength, ActiveIDShort
		StringLen, ActiveTitleLength, ActiveTitle
		ActiveTitleLength += %ActiveIDShortLength% ; Add up the new length
		ActiveTitleLength++ ; +1 for room for one space between title & ID.
		if ActiveTitleLength > 100
		{
			; Since max menu name is 100, trim the title down to allow just
			; enough room for the Window's Short ID at the end of its name:
			TrimCount = %ActiveTitleLength%
			TrimCount -= 100
			StringTrimRight, ActiveTitle, ActiveTitle, %TrimCount%
		}
		ActiveTitle = %ActiveTitle% %ActiveIDShort%  ; Build unique title.
		break
	}
}

; First, ensure that this ID doesn't already exist in the list, which can
; happen if a particular window was externally unhidden (or its app unhid
; it) and now it's about to be re-hidden:
mwt_AlreadyExists = n
Loop, %mwt_MaxWindows%
{
	if mwt_WindowID%a_index% = %ActiveID%
	{
		mwt_AlreadyExists = y
		break
	}
}

; Add the item to the array and to the menu: ; (and to the window order count)
if mwt_AlreadyExists = n
{
	Menu, Tray, add, %ActiveTitle%, RestoreFromTrayMenu
	mwt_WindowCount++
	Loop, %mwt_MaxWindows%  ; Search for a free slot.
	{
		; It should always find a free slot if things are designed right.
		if mwt_WindowID%a_index% =  ; An empty slot was found.
		{
			mwt_WindowID%a_index% = %ActiveID%
			mwt_WindowTitle%a_index% = %ActiveTitle%
			mwt_WindowNumber%a_index% = %mwt_WindowCount%
			break
		}
	}
}
return

mwt_UnMinimize:
if mwt_WindowCount = 0
{
	; Nothing to un hide
	return
}
Loop, %mwt_MaxWindows%
{
	if mwt_WindowID%a_index% <> ; A non-empty slot
	{
		if mwt_WindowNumber%a_index% = %mwt_WindowCount%
		{
			; This window is the one that needs to be removed
			StringTrimRight, IDToRestore, mwt_WindowID%a_index%, 0
			WinShow, ahk_id %IDToRestore%
			WinActivate ahk_id %IDToRestore%  ; Sometimes needed.
			StringTrimRight, winTitle, mwt_WindowTitle%a_index%, 0
			Menu, Tray, delete, %winTitle%
			mwt_WindowID%a_index% =  ; Make it blank to free up a slot.
			mwt_WindowTitle%a_index% =
			mwt_WindowCount--
			break
		}
	}
}
return
			

RestoreFromTrayMenu:
Menu, Tray, delete, %A_ThisMenuItem%
; Find window based on its unique title stored as the menu item name:
Loop, %mwt_MaxWindows%
{
	if mwt_WindowTitle%a_index% = %A_ThisMenuItem%  ; Match found.
	{
		StringTrimRight, IDToRestore, mwt_WindowID%a_index%, 0
		WinShow, ahk_id %IDToRestore%
		WinActivate ahk_id %IDToRestore%  ; Sometimes needed.

		; Loop through all the windows and decrement what is necessary
		StringTrimRight, winNumber, mwt_WindowNumber%a_index%, 0
		Loop, %mwt_MaxWindows%
		{
			if mwt_WindowNumber%a_index% > %winNumber%
			{
			mwt_WindowNumber%a_index%--
			}
		}

		mwt_WindowID%a_index% =  ; Make it blank to free up a slot.
		mwt_WindowTitle%a_index% =
		mwt_WindowCount--
		break
	}
}
return


mwt_RestoreAllThenExit:
Gosub, mwt_RestoreAll
ExitApp  ; Do a true exit.


mwt_RestoreAll:
Loop, %mwt_MaxWindows%
{
	if mwt_WindowID%a_index% <>
	{
		StringTrimRight, IDToRestore, mwt_WindowID%a_index%, 0
		WinShow, ahk_id %IDToRestore%
		WinActivate ahk_id %IDToRestore%  ; Sometimes needed.
		; Do it this way vs. DeleteAll so that the sep. line and first
		; item are retained:
		StringTrimRight, MenuToRemove, mwt_WindowTitle%a_index%, 0
		Menu, Tray, delete, %MenuToRemove%
		mwt_WindowID%a_index% =  ; Make it blank to free up a slot.
		mwt_WindowTitle%a_index% =
		mwt_WindowCount--
	}
	if mwt_WindowCount = 0
		break
}
return


Edited: Fixed silly typo

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Looks good, thanks for posting it.

On another note, is there a way to simulate a linked list or stack in autohotkey? It would have made my work even easier than it already was.

It's an interesting question. Simple stack operations such as push/pop(?) seem very array-like to me, so it's probably best to use an array in that case.

But linked lists usually imply the ability to insert or delete items from the middle of the list; they are also always(?) implemented with dynamic memory. Although AHK can create variables dynamically while the script is running, it can't destroy them (though it can free the memory of a large variable, which shrinks its memory utilization down to around 70 bytes). For this reason, linked lists whose elements sometimes need to be deleted would either cause an unending number of new variables to be created or would require you to implement your own heap manager so that old variables are reclaimed and reused, rather than abandoned.

gl0x0r
  • Members
  • 6 posts
  • Last active: Jul 25 2005 03:54 AM
  • Joined: 23 Jul 2004
Thats unfortunate, not that big a problem (my code above gets around it, for example, just by storing the order the "list" as a new element for the array)

Thanks for the quick reply

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
For anyone using it, I've updated the minimize-to-tray-menu script.

Changes:
- The taskbar is prevented from being hidden.
- Some possible problems with long window titles have been fixed.
- Windows without a title can be hidden without causing problems.
- If the script is running under AHK v1.0.22 or greater, the maximum length of each menu item is increased from 100 to 260.

http://www.autohotke... ... ayMenu.htm

trogdor
  • Guests
  • Last active:
  • Joined: --
I have added some code that solves 2 problems I was having.
After all windows were minimized one more press of the hot key
minimized the desktop icons. This may be the desired effect, but
I prefered not to have that happen.

Adding the ",Progman" to the "if/in" line solved that.

Next problem:
If the hotkey was pressed after all windows were minimized the
first window to be unminimized form the menu tray would be
automaticaly reminimized. It appears the hotkey sits and waits
for a window to come allong that it can work on.
This happend only for windows that were previosly minimized
with the hotkey.

Adding the "WinWait, A, , 2" solved that.

; Set the "last found window" to simplify and help performance.
; If a window is not found in 2 seconds WinWait will timeout.
; Without the timout: activating the hotkey after there are no more windows to
; hide results in the first window to be unminimized being automaticaly reminimized.
WinWait, A, , 2

WinGet, mwt_ActiveID, ID
WinGetTitle, mwt_ActiveTitle
WinGetClass, mwt_ActiveClass
if mwt_ActiveClass in Shell_TrayWnd,Progman

I've been using AutoHotkey for only a week so there may be
flaws in my usage. Any comments welcome.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Thanks for the great suggestions. I have applied them both. I changed one of them slightly to be this:
; Since in certain cases it is possible for there to be no active window,
; a timeout has been added:
WinWait, A,, 2
if ErrorLevel <> 0  ; It timed out, so do nothing.
	return
Here is the revised version: http://www.autohotke... ... ayMenu.htm

CarlosTheTackle
  • Members
  • 102 posts
  • Last active: Jan 29 2007 12:07 PM
  • Joined: 19 Oct 2004
I have taken gl0x0r's original script and modified it just slightly to provide a little extra functionality for my own use:

1. Added a custom icon config option.
2. A click on the icon will hide the active window or, if there is something already hidden, restore the last hidden window.
3. The tray icon will change to indicate whether something is hidden or not.

; Minimize Window to Tray Menu 
; http://www.autohotkey.com 
; This script assigns a hotkey of your choice to hide any window so that 
; it becomes an entry at the bottom of the script's tray menu.  Hidden 
; windows can then be restored individually or all at once by selecting 
; the corresponding item on the menu.  If the script exits for any reason, 
; all the windows that it hid will be restored automatically. 

; CONFIGURATION SECTION: Change the below values as desired. 

; This is the maximum number of windows to allow to be hidden: 
mwt_MaxWindows = 50 

; This is the hotkey used to hide the active window: 
mwt_stack = #h 
mwt_unStack = #+h 

; If you prefer to have the tray menu empty of all the standard items, 
; such as Help and Pause, use N.  Otherwise, use Y: 
mwt_StandardMenu = N 

; Set custom icons here:
mwt_icon = Hide.ico 
mwt_icon_alt= Hidden.ico  ;This icon will show when something is hidden

; These first few performance settings help to keep the action within 
; the #HotkeyModifierTimeout period, and thus avoid the need to release 
; and press down the hotkey's modifier if you want to hide more than one 
; window in a row.  These settings are not needed you choose to have the 
; script use the keyboard hook via #InstallKeybdHook or other means: 
#HotkeyModifierTimeout 100 
SetWinDelay 10 
SetKeyDelay 0 

; The below are recommended for this script: 
SetBatchLines 10ms 
#SingleInstance 


; ---------------------------------------------------- 

Hotkey, %mwt_stack%, mwt_Minimize 
Hotkey, %mwt_unStack%, mwt_UnMinimize 

; If the user terminates the script by any means, unhide all the 
; windows first: 
OnExit, mwt_RestoreAllThenExit 

if mwt_StandardMenu = Y 
{
   Menu, Tray, Add 
   Menu, Tray, Icon, %mwt_icon%
   Menu, Tray, Click, 1
}
else 
{ 
   Menu, Tray, NoStandard 
   Menu, Tray, Add, E&xit, mwt_RestoreAllThenExit 
   Menu, Tray, Icon, %mwt_icon%
   Menu, Tray, Click, 1
   Menu, Tray, Tip, Minimise Windows to Tray
} 
Menu, Tray, Add, &Restore All Hidden Windows, mwt_RestoreAll 
Menu, Tray, Add, Minimize Current Window, mwt_Minimize_Menu
Menu, Tray, Add  ; Another separator to make the above more special. 
Menu, Tray, default, Minimize Current Window

return  ; End of auto-execute section 


mwt_Minimize: 
if mwt_WindowCount >= %mwt_MaxWindows% 
{ 
   MsgBox No more than %mwt_MaxWindows% may be hidden simultaneously. 
   return 
} 

If FrmMenu=1
	Send, !{esc}
WinGet, ActiveID, ID, A 
WinGetTitle, ActiveTitle, ahk_id %ActiveID% 
; Because hiding the window won't deactivate it, activate the window 
; beneath this one (if any). I tried other ways, but they wound up 
; activating the task bar.  This way sends the active window (which is 
; about to be hidden) to the back of the stack, which seems best: 
Send, !{esc} 
; Don't hide until after the above, since by default hidden windows are 
; not detected: 
WinHide, ahk_id %ActiveID% 

; In addition to the tray menu requiring that each menu item name be 
; unique, it must also be unique so that we can reliably look it up in 
; the array when the window is later unhidden.  So make it unique if it 
; isn't already: 
Loop, %mwt_MaxWindows% 
{ 
   if mwt_WindowTitle%a_index% = %ActiveTitle% 
   { 
      ; Match found, so it's not unique. 
      ; First remove the 0x from the hex number to conserve menu space: 
      StringTrimLeft, ActiveIDShort, ActiveID, 2 
      StringLen, ActiveIDShortLength, ActiveIDShort 
      StringLen, ActiveTitleLength, ActiveTitle 
      ActiveTitleLength += %ActiveIDShortLength% ; Add up the new length 
      ActiveTitleLength++ ; +1 for room for one space between title & ID. 
      if ActiveTitleLength > 100 
      { 
         ; Since max menu name is 100, trim the title down to allow just 
         ; enough room for the Window's Short ID at the end of its name: 
         TrimCount = %ActiveTitleLength% 
         TrimCount -= 100 
         StringTrimRight, ActiveTitle, ActiveTitle, %TrimCount% 
      } 
      ActiveTitle = %ActiveTitle% %ActiveIDShort%  ; Build unique title. 
      break 
   } 
} 

; First, ensure that this ID doesn't already exist in the list, which can 
; happen if a particular window was externally unhidden (or its app unhid 
; it) and now it's about to be re-hidden: 
mwt_AlreadyExists = n 
Loop, %mwt_MaxWindows% 
{ 
   if mwt_WindowID%a_index% = %ActiveID% 
   { 
      mwt_AlreadyExists = y 
      break 
   } 
} 

; Add the item to the array and to the menu: ; (and to the window order count) 
if mwt_AlreadyExists = n 
{ 
   Menu, Tray, add, %ActiveTitle%, RestoreFromTrayMenu
   Menu, Tray, default, %ActiveTitle%
   Menu, Tray, Icon, %mwt_icon_alt%	
   mwt_WindowCount++ 
   Loop, %mwt_MaxWindows%  ; Search for a free slot. 
   { 
      ; It should always find a free slot if things are designed right. 
      if mwt_WindowID%a_index% =  ; An empty slot was found. 
      { 
         mwt_WindowID%a_index% = %ActiveID% 
         mwt_WindowTitle%a_index% = %ActiveTitle% 
         mwt_WindowNumber%a_index% = %mwt_WindowCount% 
         break 
      } 
   } 
} 
return 

;This section provides a variable to determine whether the 
;minimise command came from a the tray menu or not. If so 
;it requires a 'Send to back' command on the top-most window, 
;or else the taskbar will be minimised instead. 
mwt_Minimize_Menu: 
FrmMenu=1
Gosub, mwt_Minimize
FrmMenu=0
return 

mwt_UnMinimize: 
if mwt_WindowCount = 0 
{ 
   ; Nothing to un hide 
   return 
} 
Loop, %mwt_MaxWindows% 
{ 
   if mwt_WindowID%a_index% <> ; A non-empty slot 
   { 
      if mwt_WindowNumber%a_index% = %mwt_WindowCount% 
      { 
         ; This window is the one that needs to be removed 
         StringTrimRight, IDToRestore, mwt_WindowID%a_index%, 0 
         WinShow, ahk_id %IDToRestore% 
         WinActivate ahk_id %IDToRestore%  ; Sometimes needed. 
         StringTrimRight, winTitle, mwt_WindowTitle%a_index%, 0 
         Menu, Tray, delete, %winTitle% 
         mwt_WindowID%a_index% =  ; Make it blank to free up a slot. 
         mwt_WindowTitle%a_index% = 
         mwt_WindowCount-- 
	 if mwt_WindowCount = 0 
         break 
      } 
   } 
} 
If mwt_WindowCount = 0 
{
Menu, Tray, default, Minimize Current Window
Menu, Tray, Icon, %mwt_icon%
}
return 
          

RestoreFromTrayMenu: 
Menu, Tray, delete, %A_ThisMenuItem% 
; Find window based on its unique title stored as the menu item name: 
Loop, %mwt_MaxWindows% 
{ 
   if mwt_WindowTitle%a_index% = %A_ThisMenuItem%  ; Match found. 
   { 
      StringTrimRight, IDToRestore, mwt_WindowID%a_index%, 0 
      WinShow, ahk_id %IDToRestore% 
      WinActivate ahk_id %IDToRestore%  ; Sometimes needed. 

      ; Loop through all the windows and decrement what is necessary 
      StringTrimRight, winNumber, mwt_WindowNumber%a_index%, 0 
      Loop, %mwt_MaxWindows% 
      { 
         if mwt_WindowNumber%a_index% > %winNumber% 
         { 
         mwt_WindowNumber%a_index%-- 
         } 
      } 

      mwt_WindowID%a_index% =  ; Make it blank to free up a slot. 
      mwt_WindowTitle%a_index% = 
      mwt_WindowCount-- 
      break 
   } 
} 
If mwt_WindowCount = 0 
{
Menu, Tray, default, Minimize Current Window
Menu, Tray, Icon, %mwt_icon%
}
return 


mwt_RestoreAllThenExit: 
Gosub, mwt_RestoreAll 
ExitApp  ; Do a true exit. 


mwt_RestoreAll: 
Loop, %mwt_MaxWindows% 
{ 
   if mwt_WindowID%a_index% <> 
   { 
      StringTrimRight, IDToRestore, mwt_WindowID%a_index%, 0 
      WinShow, ahk_id %IDToRestore% 
      WinActivate ahk_id %IDToRestore%  ; Sometimes needed. 
      ; Do it this way vs. DeleteAll so that the sep. line and first 
      ; item are retained: 
      StringTrimRight, MenuToRemove, mwt_WindowTitle%a_index%, 0 
      Menu, Tray, delete, %MenuToRemove% 
      mwt_WindowID%a_index% =  ; Make it blank to free up a slot. 
      mwt_WindowTitle%a_index% = 
      mwt_WindowCount-- 
   } 
   if mwt_WindowCount = 0 
      break 
} 
return

Get the default icons here and here.

Thanks gl0x0r.

Guest12345
  • Guests
  • Last active:
  • Joined: --
This is an excellent script except if you minimize something like internet explorer and an alert or popup or something happens it disapears from the minimized menu....

guest12345
  • Guests
  • Last active:
  • Joined: --
can you make it so that the script will only minimize a specific window that I tell it to? heres my dilemma... I am running CSLH (Craft Syntax Live Help) which is a live chat program for my website. I don't like having windows sitting in the taskbar all the time as it gets messy and cluttered. So i found this script and it looks great except when i am using CSLH when someone visits my website CSLH disappears from the menu (i think it's because it refreshes itself) now i would like it if I had a program that would only minimize the window that is running in. So if I hit window+H it hides the window in the tray and if I hit it again it unhides it. or what i would like is a GUI that opens the location of CSLH (ex. http://mywebsite/livehelp/login.php) and when i hit the minimize button it minimizes to the tray and if I click the icon in the taskbar it reopens the window... any ideas?

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
You could make a timer that automatically hides windows of a certain title or class:
#Persistent
SetTimer, WatchForWindowsToHide, 500
Menu, tray, add  ; separator line
Menu, tray, add, Show one CSLH window, ShowCSLH
return

WatchForWindowsToHide:
WinGet, WinList, List, CSLH - Microsoft Internet Explorer  ; Update this title as needed.
Loop, %WinList%
{
    StringTrimRight, this_id, WinList%a_index%, 0
    WinGet, MinMax, MinMax, ahk_id %this_id%
    if MinMax = -1  ; The window is minimized.
        WinHide, ahk_id %this_id%  ; Hide it.
}
return

ShowCSLH:
DetectHiddenWindows on
WinActivateBottom, CSLH - Microsoft Internet Explorer
WinShow, A
return
The above is a general example and will need adjustment, assuming it's even close to what you wanted.

guest ####
  • Guests
  • Last active:
  • Joined: --
with the current minimize to tray script if you minimize IE and the page refreshes itself than that page disappears from the "hidden menu". How can I fix that. 2nd I would like it if the script only minimized a specific titled window. for example the title of my current IE website is "Live Help admin - Microsoft Internet Explorer" when I hit ctrl+H I want it to "hide" that window only and if I hit ctrl+H again I want it to "restore" that window. (assuming the above problem can be resolved)

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

with the current minimize to tray script if you minimize IE and the page refreshes itself than that page disappears from the "hidden menu". How can I fix that.

Are you saying that when a window auto-refreshes, it becomes visible automatically (of its own accord)? Even if that's the case, I don't see any reason for its entry to disappear from the menu. This is because the script does not actively monitor windows, and as a result, the menu should never change spontaneously.

when I hit ctrl+H I want it to "hide" that window only and if I hit ctrl+H again I want it to "restore" that window.

The example in my previous post would hide a particular type of window whenever you minimize it. If instead you want a hotkey, here is an example:
^h::  ; Ctrl+H hotkey
IfWinExist, Live Help admin - Microsoft Internet Explorer
    WinHide
else
    WinShow Live Help admin - Microsoft Internet Explorer
return


guestagain
  • Guests
  • Last active:
  • Joined: --
thats perfect. how can I make it so it has a custom Icon? How can I get rid of all the options in the meno other than close and restore? It would be awesome if you could just click the icon in the corner and it would hide and if you clicked it again it would restore it....


In a perfect world I would double click "test.exe" and it puts the icon into the tray and opens a browser to http://www.mysite.co...ehelp/login.php
I would login to the site and that opens the window whose title is "Live help admin - Microsoft Internet Explorer" then I can click the icon in the corner (which looks similar to the icon at http://www.pragueisi...live_ico_on.jpg which is property of that website im sure so like it but different) and it will hide the window and if i click the icon again it restores it. I also want the option of ctrl+h and I would like it if the only option in the icon is CLOSE and if you do close the program wether the site is visable or not it closes the window.

how difficult would that be?

guestagain2
  • Guests
  • Last active:
  • Joined: --
I'm also not sure why but if I hide that window and someone goes to my site it's supposed to alert me (via a javascript alert basically just a window that says someones at the site with an ok button) but when that window is hidden it doesn't show me the alert and even worse it disappears so I can't "unhide" the window. any ideas why?

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

if I hide that window and someone goes to my site it's supposed to alert me ... but when that window is hidden it doesn't show me the alert

Some apps might not be designed to have their windows hidden. You could try moving the window off-screen (via WinMove) rather than hiding it.

how can I make it so it has a custom Icon?

Menu, Tray, Icon, C:\My Icon.ico

How can I get rid of all the options in the meno other than close and restore?

if you could just click the icon in the corner and it would hide and if you clicked it again it would restore it....

if you do close the program wether the site is visable or not it closes the window.

Here is an example that covers most of it:
Menu, Tray, NoStandard
Menu, Tray, Add, &Hide or Restore, MenuHideRestore
Menu, Tray, Add, E&xit, MenuExit
Menu, Tray, Default, &Hide or Restore  ; i.e. click the icon to active it.
Menu, Tray, Click, 1  ; Single-click activates tray icon rather than double.
; ... any other things that go in auto-execute section ...
return

^h::
MenuHideRestore:  ; i.e. both the menu and the hotkey will do the below.
IfWinExist, Live Help admin - Microsoft Internet Explorer 
    WinHide 
else 
    WinShow Live Help admin - Microsoft Internet Explorer 
return

MenuExit:
DetectHiddenWindows on
WinClose, Live Help admin - Microsoft Internet Explorer
ExitApp