Jump to content
Sign in to follow this  
Function

Help with tray icon menus script

Recommended Posts

Function

Hello, I've been working on a simple script that replaces the right click menu on the tray icon to something more favorable than the plain old Pause / Exit. I've gotten this far, but now I'm stuck. I don't know how to replicate the Pause function and how to implement a Reload function. Also, how does one run the help file directly? Any ideas?

#include <Constants.au3>
Opt("WinTitleMatchMode",2)
Opt("SendKeyDelay", 0)
Opt("SendKeyDownDelay", 0)
Opt("TrayMenuMode",1)

$help = TrayCreateItem("&Help")
$seperator1 = TrayCreateItem("")
$windowspy = TrayCreateItem("&Window Spy")
$reload = TrayCreateItem("&Reload This Script")
$edit = TrayCreateItem("&Edit This Script")
$seperator2 = TrayCreateItem("")
$pause = TrayCreateItem("&Pause Script")
$exit = TrayCreateItem("E&xit")

TraySetState()

;SCRIPT BODY

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $help
        Run ("C:\Program Files\AutoIt3\AutoIt3.chm");@ScriptDir & "\AutoIt3.chm" can't be called directly it seems
    Case $msg = $windowspy
            Run (@ScriptDir & "\Au3Info.exe")
        Case $msg = $reload
            Sleep(100)
        Case $msg = $edit
            Run ("notepad.exe " & @ScriptFullPath)
        Case $msg = $pause
            Sleep(100)
        Case $msg = $exit
            ExitLoop
    EndSelect
WEnd

Share this post


Link to post
Share on other sites
Kryptonite

For the helpfile thing, in the Autoit3 directory, there is a file called "Autoit3Help.exe" or something to that effect. It is basically a launcher for the helpfile, and can be called through Run()

:P

EDIT:

And for the pause:

Global $paused = false
While 1
If $paused then
     Do
        Sleep(200)
     Until not $paused
EndIf
;Your whole select statement...

Case $paused
   If $paused = False then
      $paused = true
   Else
      $paused = false
   EndIf

;... Your other code

This wont work as it is, but you get my idea right?

Edited by Kryptonite

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  

×