Jump to content

TrayCommand Change Tray Icon


 Share

Recommended Posts

Hey, I'm working on a program, it's a tray program that gives me links to sites, programs, etc. Anyways, my problem is that I need a different tray icon, here is my source:

#include <Constants.au3>
#NoTrayIcon

Opt("TrayMenuMode", 1)

$programs = TrayCreateMenu("Programs")
$tools = TrayCreateMenu("Tools", $programs)
$internet = TrayCreateMenu("Internet", $programs)
$other = TrayCreateMenu("Other", $programs)
$websites = TrayCreateMenu("Websites")
$aim = TrayCreateItem("AIM", $internet)
$firefox = TrayCreateItem("Firefox", $internet)
$alftp = TrayCreateItem("ALFTP", $internet)
$record = TrayCreateItem("Quick Screen Recorder", $tools)
$paint = TrayCreateItem("MSPaint", $tools)
$alzip = TrayCreateItem("ALZip", $tools)
$notepad = TrayCreateItem("Notepad", $tools)
$scite = TrayCreateItem("SciTE", $tools)
$help = TrayCreateItem("AutoIT Help", $other)
TrayCreateItem("")
$about = TrayCreateItem("About")
$exit = TrayCreateItem("Exit")

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $aim
            Run("C:\Program Files\AIM6\aim6.exe")
        Case $msg = $firefox
            Run("C:\Program Files\Mozilla Firefox\firefox.exe")
        Case $msg = $notepad
            Run("notepad.exe")
        Case $msg = $scite
            Run("C:\Program Files\AutoIt3\SciTE\SciTE.exe")
        Case $msg = $alftp
            Run("C:\Program Files\ESTsoft\ALFTP\ALFTP.exe")
        Case $msg = $alzip
            Run("C:\Program Files\ESTsoft\ALZip\ALZip.exe")
        Case $msg = $paint
            Run("mspaint.exe")
        Case $msg = $record
            Run("C:\Program Files\Quick Screen Recorder\qsr.exe")
        Case $msg = $help
            Run("C:\Program Files\AutoIt3\AutoIt3Help.exe")
        Case $msg = $about
            MsgBox(0, "Tray Command v1.0 RC2", "TrayCommand v1.0 RC2 no Comments")
        Case $msg = $exit
            ExitLoop
    EndSelect
WEnd

Exit

Any help would be greatly appreciated!

.::HardHackz::.

[center]My BlogOldSock Programs (AutoIT Apps)A Message to Hackers! (NOT SKIDDIES!)OldSock Programs is my little "company."[/center]

Link to comment
Share on other sites

Theres TraySetIcon that will change the tray icon... heres the help file example...

#Include <Constants.au3>
#NoTrayIcon

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

$exititem       = TrayCreateItem("Exit")

TraySetState()

$start = 0
While 1
    $msg = TrayGetMsg()
    If $msg = $exititem Then ExitLoop
    $diff = TimerDiff($start)
    If $diff > 1000 Then
        TraySetIcon("Shell32.dll",Random(0,100,1))
        $start = TimerInit()
    EndIF
WEnd

Exit

Also if/when you compile your script the program's tray icon will be the main icon of your compiled program.

Hope this helps!

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...