Sign in to follow this  
Followers 0
jessharpur

TrayItemGetState

2 posts in this topic

Using Version 3.2.4.9

I'm new to AutoIt (but not new to programming) and I'm getting an odd result using the TrayItemGetState function. I have written some code to take action when the user clicks an item in my tray menu, depending on its state. The code also toggles the checked state of the item. No matter which state the menu item is in, the call to TrayItemGetState always returns 68. Am I doing something wrong? Here's some example code which always returns 68 on my machine...

CODE
#include <Constants.au3>

; Set up Tray Menu...

AutoItSetOption("TrayAutoPause", 0)

AutoItSetOption("TrayMenuMode", 1)

AutoItSetOption("TrayOnEventMode", 1)

$optionsMenu = TrayCreateMenu("Quick Options")

$startOnBoot = TrayCreateItem("Start with Windows", $optionsMenu)

$exitItem = TrayCreateItem("Exit")

TrayItemSetOnEvent($startOnBoot, "SetOptions")

TrayItemSetOnEvent($exitItem, "AppExit")

TrayItemSetState($startOnBoot, $TRAY_UNCHECKED)

while(1)

WEnd

Func SetOptions()

ConsoleWrite("TrayItemGetState = " & TrayItemGetState($startOnBoot) & @LF)

If BitAND(TrayItemGetState($startOnBoot), $TRAY_UNCHECKED) = $TRAY_UNCHECKED Then

TrayItemSetState($startOnBoot, $TRAY_CHECKED)

Else

TrayItemSetState($startOnBoot, $TRAY_UNCHECKED)

EndIf

EndFunc ;==>SetOptions

Func AppExit()

Exit

EndFunc ;==>AppExit

Share this post


Link to post
Share on other sites



Hmphf... I get the same with 3.2.4.9 Prod and 3.2.3.14 Beta. Looks broke. :)

I suggest you post it to the Bug Reports.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  
Followers 0