Jump to content
legend

traymenu anywhere

Recommended Posts

legend

I have the following code that will show the traymenu when you press enter,

there's a problem that it will first show the traymenu if you click the tray icon, and then press "T". if you don't click the tray icon first, before pressing T,

it will show: script paused, and exit when you press T.

Does anyone know how to fix that? :)

#include <Constants.au3>

Opt("TrayMenuMode", 1)
Opt("WinTitleMatchMode", 4)

Global Const $WM_USER           = 0x0400
Global Const $MY_WM_NOTIFYICON  = $WM_USER + 1
Global Const $WM_LBUTTONDOWN    = 0x0201

$aboutItem  = TrayCreateItem("About")
TrayCreateItem("")
$exitItem   = TrayCreateItem("Exit")

TraySetState()

HotKeySet("t", "ShowTrayMenu") ; Ctrl + Alt + t

While 1
    $Msg = TrayGetMsg()
    Switch $Msg
        Case $exitItem
            ExitLoop
        Case $aboutItem
            Msgbox(0, "Info", "Just for fun...")
    EndSwitch
WEnd

Exit

Func ShowTrayMenu()
    DllCall("user32.dll", "int", "SendMessage", _
                                "hwnd", WinGetHandle("classname=AutoIt v3"), _
                                "int", $MY_WM_NOTIFYICON, _
                                "int", 0, _
                                "int", $WM_LBUTTONDOWN)
EndFunc

 

Edited by legend

Share this post


Link to post
Share on other sites
careca

I got a somewhat nice result with

Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 3)

But the first time the menu shows it's always the default with the "script pause / exit" entries, from there on, it shows the ones you set.


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites
legend
4 hours ago, careca said:

I got a somewhat nice result with

Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 3)

But the first time the menu shows it's always the default with the "script pause / exit" entries, from there on, it shows the ones you set.

didn't seem to have any effect for me, still comes up with pause script everything you press the hoykey, first when you click on the tray icon,

and then click the hotkey once again, the real menu will appear

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.