Jump to content
Sign in to follow this  

system tray icon

Recommended Posts

Sorry if this is obvious but I've never came across it in a thread.

See how by default you click the running script tray icon and it pauses your script?

Is the a way to programatically achieve that within autoit other that automating the system tray?

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post

Link to post
Share on other sites

We know that the menu is a resource in AutoIt3.exe, and we also know the command id's of the items (look yourself ;) ). We assume that the menu is controled by the AutoIt hidden window (I checked this a few months ago when I did some work with setting the icon for the default systray item). From that, you know that you just need to send the same message to the AutoIt hidden window with the command id. Simple? Try it. I don't have autoit now but I'll do some testing for you later.

If you want to cheat then use winspector or something similar to get the message queue for the window, but it's not really necessary, we know that it uses standard menu events.

Share this post

Link to post
Share on other sites

I'm onto it now, it's actually something I was thinking of the other day.

Edit: Here is my example of changing the icon of the default systray item: http://www.autoitscript.com/forum/index.php?showtopic=115222

Edited by Mat

Share this post

Link to post
Share on other sites


The only problem is that it doesn't work. I think that AutoIt only uses the messages when the menu is in use, so the menu needs to be in use for this method to work. This is what I was testing:

;~ See this page for details on WM_COMMAND:
;~     * http://msdn.microsoft.com/en-us/library/ms647591(VS.85).aspx


$sTitle = 'B41A52A8-B1E5-42AF-A5E9-E1A1C1C414BE' ; Unique?


$CmdId = 167 ; From reshacker
$hWnd = WinGetHandle($sTitle)

MsgBox(0, "Pause test", StringFormat("Command ID: %d\r\nWindow Handle: 0x%x", $CmdId, $hWnd))

$ret = _SendMessage($hWnd, $WM_COMMAND, $CmdId)

MsgBox(0, "Pause test", StringFormat("Return: %d", $ret))

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...