ForsakenGod Posted April 19, 2010 Share Posted April 19, 2010 Hello , I would like to ask how could i add up more options when the autoit incon in the right down edge is right clicked ? Now there is pause script and exit and my second question is can i delete those two ? Link to comment Share on other sites More sharing options...
adik2dmax666 Posted April 19, 2010 Share Posted April 19, 2010 If you use search you could find this http://www.autoitscript.com/autoit3/docs/functions/TrayCreateMenu.htm and this Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown. $settingsitem = TrayCreateMenu("Settings") $displayitem = TrayCreateItem("Display", $settingsitem) $printeritem = TrayCreateItem("Printer", $settingsitem) TrayCreateItem("") $aboutitem = TrayCreateItem("About") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $aboutitem Msgbox(64,"about:","AutoIt3-Tray-sample") Case $msg = $exititem ExitLoop EndSelect WEnd Exit First learn computer science and all the theory. Next develop a programming style. Then forget all that and just hack. -George Carrette[sub]GD Keylogger Creator (never released)[/sub][sub]Garena Autojoin v3.0[/sub] Link to comment Share on other sites More sharing options...
ForsakenGod Posted April 19, 2010 Author Share Posted April 19, 2010 Whoops Sorry for that thanks anyway Link to comment Share on other sites More sharing options...
MadMaxx Posted June 9, 2010 Share Posted June 9, 2010 If you use search you could find this http://www.autoitscript.com/autoit3/docs/functions/TrayCreateMenu.htm and this Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown. $settingsitem = TrayCreateMenu("Settings") $displayitem = TrayCreateItem("Display", $settingsitem) $printeritem = TrayCreateItem("Printer", $settingsitem) TrayCreateItem("") $aboutitem = TrayCreateItem("About") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $aboutitem Msgbox(64,"about:","AutoIt3-Tray-sample") Case $msg = $exititem ExitLoop EndSelect WEnd Exit Hi adik2dmax666 I am a bit of a Newbee to AutoIt3 (a recent convert from AutoHotKey). I am looking for a way to Reload (Restart) a currently running Script from the System Tray Icon. I have fold a .au3 that will do the Restart but not sure is it is possible to have this as a Default option together with the existing "Script Paused / Exit" option. In addition I would like to be able to edit the script with an Edit Script option. Would appreciate any assistance / guidance you can provide. Rgds Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 9, 2010 Moderators Share Posted June 9, 2010 (edited) MadMaxx,Welcome to the AutoIt forum. Here is how you can get the script to restart and be edited from the tray menu:expandcollapse popup#include <GUIConstantsEx.au3> Opt("TrayMenuMode", 3) ; Default tray menu items (Script Paused/Exit) will not be shown. $aboutitem = TrayCreateItem("About") TrayCreateItem("") $Edit = TrayCreateItem("Edit") TrayCreateItem("") $Restart = TrayCreateItem("Restart") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() $hGUI = GUICreate("Test", 500, 500) ; Label to hold counter $hLabel = GUICtrlCreateLabel("0", 10, 10, 50, 50) GUICtrlSetFont(-1, 24) GUISetState() $iBegin = TimerInit() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch Switch TrayGetMsg() Case $aboutitem MsgBox(64, "about:", "AutoIt3-Tray-sample") Case $Edit ; Convert AutoIt path to SciTE path $sScitePath = StringReplace(@AutoItExe, "autoit3.exe", "SCITE\SCITE.exe") ; Run SciTE on the script Run($sScitePath & ' "' & @ScriptFullPath & '"', @ScriptDir) Sleep(500) ; Wait until SciTE exits While ProcessExists("scite.exe") Sleep(10) WEnd ; And then start a new instnace of the modified script ContinueCase Case $Restart ; Run a new instance of the script Run(@AutoItExe & ' "' & @ScriptFullPath & '"', @ScriptDir) Sleep(50) ; Close this instance Exit Case $exititem Exit EndSwitch ; Increase counter If TimerDiff($iBegin) > 1000 Then GUICtrlSetData($hLabel, GUICtrlRead($hLabel) + 1) $iBegin = TimerInit() EndIf WEndI hope that is understandable - please ask if you have any questions. M23P.S. When you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. Edit: Typnig! Edited June 9, 2010 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MadMaxx Posted June 9, 2010 Share Posted June 9, 2010 M23 Fantastic!!! Thanks Very Much! Note your comments re "Add Reply" also & thx for the pointer. Rgds M Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now