Jump to content

system tray icon


JohnOne
 Share

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.

Link to comment
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.

Link to comment
Share on other sites

Yes...

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

#include<SendMessage.au3>
#include<WindowsConstants.au3>

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

AutoItWinSetTitle($sTitle)

$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))
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...