Sign in to follow this  
Followers 0
JustinReno

Has a macro been removed?

3 posts in this topic

#1 ·  Posted (edited)

I just tried to use the macro @TRAY_ID and this is what showed up:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\Jar\Desktop\Test2.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>19:47:32 Starting AutoIt3Wrapper v.1.9.2

>Running AU3Check (1.54.10.0) from:C:\Program Files\AutoIt3

+>19:47:32 AU3Check ended.rc:0

>Running:(3.2.10.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Jar\Desktop\Test2.au3"

C:\Documents and Settings\Jar\Desktop\Test2.au3 (21) : ==> Unknown macro.:

MsgBox(0, "", @TRAY_ID)

MsgBox(0, "", ^ ERROR

->19:47:32 AutoIT3.exe ended.rc:1

+>19:47:33 AutoIt3Wrapper Finished

>Exit code: 1 Time: 1.449

The macro is still defined in the helpfile. Is this a bug?

Or is it just me?

@TRAY_ID | Last clicked item identifier during a TraySet(Item)OnEvent action.

Edited by JustinReno

Share this post


Link to post
Share on other sites



The macro is still defined in the helpfile. Is this a bug?

Or is it just me?

Without the source code I will say it is you. The only way I was able to replicate the same message was by adding MsgBox(0, "", @TRAY_ID) before the while statement, in other words trying to use @TRAY_ID before selecting from the tray menu.

This is an example for the help file

#include <Constants.au3>
#NoTrayIcon

Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1)   ; Default tray menu items (Script Paused/Exit) will not be shown.

$exit = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1,"ExitEvent")

TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE,"SpecialEvent")
TraySetOnEvent($TRAY_EVENT_SECONDARYUP,"SpecialEvent")

TraySetState()
;MsgBox(0, "", @TRAY_ID) ; it failed

While 1
    Sleep(10)   ; Idle loop
WEnd
Exit

; Functions
Func SpecialEvent()
    Select
        Case @TRAY_ID = $TRAY_EVENT_PRIMARYDOUBLE
            Msgbox(64,"SpecialEvent-Info","Primary mouse button double clicked.")
        Case @TRAY_ID = $TRAY_EVENT_SECONDARYUP
            Msgbox(64,"SpecialEvent-Info","Secondary mouse button clicked.")
    EndSelect
EndFunc

Func ExitEvent()
    MsgBox(0, "", @TRAY_ID) ;work fine
    Exit
EndFunc

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

The macro will be created when AutoIt declares a value for it. Using the macro before it is declared a value suffers similar fate as a variable suffers if you use it before it is declared.

:)

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