qwertylol Posted April 28, 2007 Posted April 28, 2007 AutoItSetOption ( "TrayMenuMode" , 1 ) Dim $close[100] Dim $order = 0 Do $close[$order] = TrayCreateItem( $order ) $order = $order + 1 Until $order == 10 While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $close[$order] Msgbox ( 0 , "The order is", $order ) EndSelect WEnd Exit this code should create 10 items on the traymenu, and it should display a msgbox with the corresponding number. yet only the last one will produce such a result when selected. How can I make this work ?
xcal Posted April 28, 2007 Posted April 28, 2007 (edited) AutoItSetOption ( "TrayMenuMode" , 1 ) Opt('TrayOnEventMode', 1) Dim $close[100] Dim $order = 0 Do $close[$order] = TrayCreateItem( $order ) TrayItemSetOnEvent(-1, 'funkyfunc') $order = $order + 1 Until $order == 10 TrayCreateItem('') TrayCreateItem('Exit') TrayItemSetOnEvent(-1, 'quit') While 1 $msg = TrayGetMsg() WEnd Func funkyfunc() MsgBox(0, '', TrayItemGetText(@TRAY_ID)) EndFunc Func quit() Exit EndFunc Edited April 28, 2007 by xcal How To Ask Questions The Smart Way
Zedna Posted April 28, 2007 Posted April 28, 2007 Or another way to solve this (without OnEvent mode): AutoItSetOption ( "TrayMenuMode" , 1 ) Dim $close[100] Dim $order = 0 Do $close[$order] = TrayCreateItem( $order ) $order = $order + 1 Until $order == 10 While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case Else For $i = 1 To 10 If $msg = $close[$i] Then Msgbox ( 0 , "The order is", $i ) ExitLoop EndIf Next EndSelect WEnd Exit Resources UDF ResourcesEx UDF AutoIt Forum Search
smashly Posted April 28, 2007 Posted April 28, 2007 (edited) Updated my post in the Last Thread you started qwertylol.CheersEdit: typo's doh Edited April 28, 2007 by smashly
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now