Sign in to follow this  
Followers 0
turbox

co-running two functions

5 posts in this topic

I want the tray buttons working while it sleep

$prefsitem  = TrayCreateItem("Preferences")
TrayCreateItem("")
$aboutitem  = TrayCreateItem("About")
TrayCreateItem("")
$exititem   = TrayCreateItem("Exit")

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $prefsitem
            Msgbox(64, "Preferences:", "OS:" & @OSVersion)
        Case $msg = $aboutitem
            Msgbox(64, "About:", "AutoIt3-Tray-sample.")
        Case $msg = $exititem
            ExitLoop
    EndSelect
WEnd

sleep(353522)

Share this post


Link to post
Share on other sites



have your code trigger a seperate .au3 and run it at the same time with the first script controlling what the second one does.


~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK

Share this post


Link to post
Share on other sites

I want the tray buttons working while it sleep

$prefsitem  = TrayCreateItem("Preferences")
TrayCreateItem("")
$aboutitem  = TrayCreateItem("About")
TrayCreateItem("")
$exititem   = TrayCreateItem("Exit")

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $prefsitem
            Msgbox(64, "Preferences:", "OS:" & @OSVersion)
        Case $msg = $aboutitem
            Msgbox(64, "About:", "AutoIt3-Tray-sample.")
        Case $msg = $exititem
            ExitLoop
    EndSelect
WEnd

sleep(353522)
This is what event mode was invented for:
Opt("TrayOnEventMode", 1)
Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 1)

Global $prefsitem = TrayCreateItem("Preferences")
TrayItemSetOnEvent(-1, "_TrayItemHit")
TrayCreateItem("")
Global $aboutitem = TrayCreateItem("About")
TrayItemSetOnEvent(-1, "_TrayItemHit")
TrayCreateItem("")
Global $exititem = TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "_TrayItemHit")
TraySetState()

While 1
    Sleep(353522)
WEnd

Func _TrayItemHit()
    Switch @TRAY_ID
        Case $prefsitem
            MsgBox(64, "Preferences", "You clicked on preferences")
        Case $aboutitem
            MsgBox(64, "About", "You clicked on about")
        Case $exititem
            Exit
    EndSwitch
EndFunc  ;==>_TrayItemHit

;)


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

This is what event mode was invented for:

Opt("TrayOnEventMode", 1)

;)

Thanks a lot! That's exactly what I searched for a few days ago.

@ Dev / Doku Team:

In the Help File all the Opt() do not have particular examples for all the options.

This sample code for Opt("TrayOnEventMode",1) might be enlighting for others, too?

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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