Jump to content

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

Pre-1.0.13 Changes


  • Please log in to reply
19 replies to this topic
Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
I've applied the following changes to the Installer at http://www.autohotkey.com/download/

Added built-in variable %A_ThisMenuItem% which is the name of the user-defined item most recently launched from the tray menu.

Added command OnExit, which specifies a subroutine to run when the script exits.

The above were added to support the following script. If you have any interest in uncluttering your task bar or hiding seldom-used windows, please give it a try and post any improvements or corrections here.

http://www.autohotke... ... ayMenu.ahk
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.

To use the above script, you will need to re-download v1.0.12 if your 1.0.12 was downloaded earlier than the timestamp of this message. Thanks.

beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004

Added command OnExit, which specifies a subroutine to run when the script exits.

Very nice addition. I had a script that needed something similar so I removed all the Standard Menu tray options and added my own pause and exit.

menu, tray, NoStandard
menu, tray, add, Administrator Code, AdminCode
menu, tray, add, Date Format - %format%, DFormat
menu, tray, add ; separator
menu, tray, add, Pause Script, PScript
menu, tray, add, Exit, MenuExit

MenuExit:
FileDelete, c:\winnt\system32\admin.log
ExitApp

PScript:
menu, tray, ToggleCheck, Pause Script
Pause, Toggle
return

The OnExit subroutine is called when the script exits by any means.

I know this probably isn't possible, but if you End Task in Windows NT/2000/XP OnExit doesn't run. Might want to put that in the Help File.

Also if you have a MsgBox in the OnExit section and you do a reload you get the error "Could not close the previous instance of this script." And once you click ok on the MsgBox the script closes and does not reload.

thanks,
beardboy

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

I had a script that needed something similar so I removed all the Standard Menu tray options and added my own pause and exit.

Very creative. I thought of that too, but only in conjunction with working on OnExit.

I know this probably isn't possible, but if you End Task in Windows NT/2000/XP OnExit doesn't run

I've added it to the help file, thanks. If End Task first tried a polite closure of the window (WM_CLOSE), the OnExit subroutine would run. However, it apparently just kills the process, so I guess there's nothing that can be done. I just tried end-tasking a calculator and Spy++ said it didn't receive any messages prior to being killed.

Also if you have a MsgBox in the OnExit section and you do a reload you get the error "Could not close the previous instance of this script." And once you click ok on the MsgBox the script closes and does not reload.

Thanks, I think I've resolved this by having the previous instance's OnExit subroutine retain control over whether it actually exits (in case the MsgBox is important). I've also changed the other prompt to be "Could not close the previous instance of this script. Keep waiting?" Let me know if you can think any improvements.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
A few more changes have been applied to the installer at http://www.autohotkey.com/download/

Fixed hook hotkeys that used a keyboard prefix but a mouse button suffix when the prefix was also a suffix (broken in v1.0.12) as in this example [thanks jamestr]:
$a::send, a
a & lbutton::

Improved SplashTextOn so that its text is updated more quickly. [thanks Sds]

Improved the Menu command to optionally use ErrorLevel instead of displaying runtime errors.

Added the ability to display the tray menu at the current position of the mouse cursor. Among other things, this allows a custom popup menu to be shown in response to pressing a hotkey or "hot mouse button". Use Menu, Tray, Show

Added the ability to change the script's icon while it's running. This affects both the tray and InputBox icons. Use Menu, Tray, Icon, Filename [, IconNumber].

(the changes to OnExit mentioned above are also in this version)

Atomhrt
  • Guests
  • Last active:
  • Joined: --

A few more changes have been applied to the installer at http://www.autohotkey.com/download/
Added the ability to display the tray menu at the current position of the mouse cursor. Among other things, this allows a custom popup menu to be shown in response to pressing a hotkey or "hot mouse button". Use Menu, Tray, Show

WFM! Nice!! :D

beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004
Very nice additions as always.

What do you think of adding variables like:

%A_IconState%
Store whether or not the tray icon exists.

%A_Icon%
A variable to check which Icon is currently being displayed.

thanks,
beardboy

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
this might benefit someone:
mbutton::
        menu, tray, NoStandard
        menu, tray, show
        menu, tray, Standard
Return


Chris, can it b done that if the user clicks outside the menu then it exits by itself?
(like the tray menu or the tooltip menu)

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


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

can it b done that if the user clicks outside the menu then it exits by itself? (like the tray menu or the tooltip menu)

It already does that, at least on my XP and 98 systems here. If you click outside the menu, the menu vanishes.

I plan to add support for at least one additional menu so that you don't have to "sacrifice" the tray menu to get a custom popup menu.

What do you think of adding variables like:

%A_IconState%
Store whether or not the tray icon exists.

%A_Icon%
A variable to check which Icon is currently being displayed.

Since the above are rarely used features (comparatively), and since it's possible to track the state yourself using a variable, historically I've not added them out of concern that the help file gets too cluttered. However, I've thought about it and I think if they're mentioned only in the relevant section of the Menu command, the clutter to the built-in variables section is reduced. So I'll put those in.

It's probably even more useful to have things like A_KeyDelay and A_WinDelay. Thanks for the ideas.

beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004
menu, tray, tooltip, VPN connected ; Change system tray icon's tool tip

thanks,
beardboy

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Nice one, that certainly belongs in there too.

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004

I plan to add support for at least one additional menu so that you don't have to "sacrifice" the tray menu to get a custom popup menu.


i wished for that too, but thought that'd b too much to ask... u already did the mouse menu hours after my suggesting it!

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


jamestr
  • Members
  • 98 posts
  • Last active: Jul 03 2008 12:30 AM
  • Joined: 05 Apr 2004

I plan to add support for at least one additional menu so that you don't have to "sacrifice" the tray menu to get a custom popup menu.


That would be real nice.
Could the primary menu, contain entries that call secondary menus? a 2 level hierarchy.

I also prefer popup menus that are dark text on a light background, like the tooltip color scheme.

Maybe the menu,tray,show command could have an option to select the tooltip color scheme.


as always, AHK is an outstanding program :p

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

Could the primary menu, contain entries that call secondary menus? a 2 level hierarchy.

If you're talking about sub-menus -- which appear when you select a menu item that has an arrow on its right side -- that's definitely planned.

I also prefer popup menus that are dark text on a light background, like the tooltip color scheme. Maybe the menu,tray,show command could have an option to select the tooltip color scheme.

I'm not aware of any way to change that without painting the menu items as graphics rather than text. However, it might be possible to change the colors of all menus on your own system by using Control Panel > Display Properties > Advanced > Menu

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Partially in response to recent requests, more changes have been applied to the installer at http://www.autohotkey.com/download/

Fixed Send {Asc nnnn} so that it allows codes beyond 255 (Unicode) to be sent. [thanks Anandajoti Bhikkhu]

Fixed interference among multiple scripts using the hooks simultaneously.

Changed: A script will only assume CONTROL/ALT/SHIFT/WIN are permanently down if it put them that way. [thanks jamestr & Jon]

Improved the Send command's support for non-English letters, symbols and keyboards. If this applies to you and you notice any problems with this version, please let me know.

Improved the Send command by further limiting its ability to interfere with hotkeys that are being held down by the user to auto-repeat them (only helps hook hotkeys). [thanks jamestr & Jon]

Added the ability to change the tray icon's tooltip via Menu, Tray, Tip [thanks beardboy]

Added the following built-in variables, which contain the current states of their associated commands: A_TitleMatchMode, A_TitleMatchModeSpeed, A_DetectHiddenWindows, A_DetectHiddenText, A_AutoTrim, A_StringCaseSense, A_FormatInteger, A_FormatFloat, A_KeyDelay, A_WinDelay, A_ControlDelay, A_MouseDelay, A_DefaultMouseSpeed, A_IconHidden, A_IconTip, A_IconFile, and A_IconNumber.

Added the built-in variable A_ExitReason, which contains the reason the script is being asked to terminate (e.g. Logoff). [thanks beardboy]

Added command Sort, which arranges a variable's contents in alphabetical or numerical order.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Installer updated again so that compiled scripts also reflect the above changes [thanks beardboy].