Sign in to follow this  
Followers 0
H.J.

Please help, Problem when using Tray Menu

6 posts in this topic

#1 ·  Posted (edited)

Hi, I added to my script Opt("TrayAutoPause,0") but the script still pauses when click on tray icon.

If you run the example script below and you click on the Tray icon, when the Tray Icon Menu displayed then

if I tried to press Ctrl+M keys to run the function called DisplayMsgAndExit() to display a message and exit,

the Function will not executed until you exit from the Tray icom menu.

Please can you help me to know what is the problem.

; The script ( as example )

; ------------------------

#Include <Constants.au3>

#NoTrayIcon

HotKeySet ("^M", "DisplayMsgAndExit")

HotKeySet ("^m", "DisplayMsgAndExit")

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

Opt("TrayAutoPause",0) ; 0=N0 Pause 1= Pause

$exititem = TrayCreateItem("Exit")

TraySetIcon("warning")

TraySetToolTip("SOS")

TraySetState() ; Show the tray icon

$toggle = 0

While 1

$VTmp_Try_Msg = TrayGetMsg()

IF $VTmp_Try_Msg = $exititem Then Exit

WEnd

Func DisplayMsgAndExit()

HotKeySet ("^M")

HotKeySet ("^m")

MsgBox(0,"TrayAutoPause","TrayAutoPause working",5)

Exit

EndFunc

;------ End Script -------------------

Best regards

H.J.

Edited by H.J.

Share this post


Link to post
Share on other sites



Opt("TrayAutoPause,0")

Your test-script works fine for me, and doesn't AutoPause when clicking on the tray-icon. But in the first line of you post you stated that you're using the syntax Opt("TrayAutoPause,0"), which is incorrect. The correct syntax is Opt("TrayAutoPause", 0), like you used in your test-script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks, The first line is yes is incorrect in time of writing the message, but in the script is correct.

Please try when clicking on the tray-icon then press Ctrl key with M Key together you will found

that the function called DisplayMsgAndExit() to display a message and exit not executing unly when

you close tray menu.

I'm using Autoit v3.2.12.1 released (12th June, 2008)

Best regards

Edited by H.J.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Please any help, is it a bug or there is something i missed.

Best regards

Edited by H.J.

Share this post


Link to post
Share on other sites

Please I'm waiting for any help.

Best regards

Share this post


Link to post
Share on other sites

I think you are only demonstrating a "feature" of the Windows API. If I open any tray menu with Explorer up, F5 will not update either. While the desktop is focused on a tray menu, I don't think any hot keys outside of the tray menu's are active.

Cleaned up demo:

HotKeySet("^m", "DisplayMsgAndExit")

Opt("TrayMenuMode", 1); Default tray menu items will not be shown.
Opt("TrayAutoPause", 0); 0 = No Pause
$exititem = TrayCreateItem("Exit")
TraySetState(); Show the tray icon

While 1
    If TrayGetMsg() = $exititem Then Exit
WEnd

Func DisplayMsgAndExit()
    MsgBox(0, "TrayAutoPause", "TrayAutoPause working", 5)
EndFunc  ;==>DisplayMsgAndExit

;)


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