Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Help with Tray Menu, Left Click & Double Click

$
0
0
Hi,

Hope someone can help me figure out what I'm doing wrong, fairly new to AutoIt but have done a few little tools for myself and what to do something a bit more complicated.

I am trying to create a system tray icon that when right clicked brings up a menu with a few options for websites and exit(this I can do and get working). What I want to add is the ability to Double Click the tray icon and have it launch a preset website?

Here is my working code for the right click and menu:
[ autoit ]         
#include <Constants.au3> #TrayIcon TraySetIcon("icon.ico") #Disable Default Tray Opt("TrayMenuMode", 3) #Tray Tip TraySetToolTip ("My Name") Local $firstitem = TrayCreateItem("Google") Local $seconditem = TrayCreateItem("MSN") TrayCreateItem("") Local $thirditem = TrayCreateItem("GMail") TrayCreateItem("") Local $exititem = TrayCreateItem("Exit") TraySetState() TraySetClick(16) While 1 Local $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $firstitem ShellExecute("http://www.google.co.uk") Case $msg = $seconditem ShellExecute("http://www.msn.co.uk") Case $msg = $thirditem ShellExecute("http://gmail.com") Case $msg = $exititem ExitLoop EndSelect WEnd Exit

Now here is my attempt for adding the double click that doesn't work, :construction:
[ autoit ]         
#include <Constants.au3> #TrayIcon TraySetIcon("icon.ico") #Disable Default Tray Opt("TrayMenuMode", 3) #Tray Tip TraySetToolTip ("My Name") Local $firstitem = TrayCreateItem("Google") Local $seconditem = TrayCreateItem("MSN") TrayCreateItem("") Local $thirditem = TrayCreateItem("GMail") TrayCreateItem("") Local $exititem = TrayCreateItem("Exit") TraySetState() TraySetClick(16) ; Functions Func SpecialEvent() Select Case @TRAY_ID = $TRAY_EVENT_PRIMARYDOUBLE ShellExecute("http://www.autoitscript.com") EndSelect EndFunc ;==>SpecialEvent While 1 Local $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $firstitem ShellExecute("http://www.google.co.uk") Case $msg = $seconditem ShellExecute("http://www.msn.co.uk") Case $msg = $thirditem ShellExecute("http://gmail.com") Case $msg = $exititem ExitLoop EndSelect WEnd Exit

Obviously would love some help if someone knows how to accomplish this and/or wants a challenge. I had a look at the help as you can see, but just can't get it to do anything else.

Thank you for your help in advance.

Tom

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>