Simpel Posted February 20, 2016 Share Posted February 20, 2016 (edited) Hi, I'm wondering why my code snippet isn't working. I copied most of it from a script where it work's. Here is the code: expandcollapse popup#include <Constants.au3> Opt("TrayAutoPause", 0) ; no pause while click Opt("TrayMenuMode", 1) ; no exit and pause Opt("TrayOnEventMode", 1); While 1 Sleep(100) WEnd Exit #Region ### START Tray section Global $hIni = TrayCreateItem("open INI") TrayItemSetOnEvent (-1, "_INI") TrayCreateItem("") Global $hExit = TrayCreateItem("Exit") TrayItemSetOnEvent (-1, "_Quit") TraySetState(1) TraySetClick(16); INI and Exit with secondary click TraySetOnEvent( $TRAY_EVENT_PRIMARYDOUBLE, "_OpenPath" ); _OpenPath with primary double click #EndRegion ### END Tray section Func _OpenPath() $sPfad = @ScriptDir ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sPfad = ' & $sPfad & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $iDelimiterPfad = StringInStr($sPfad, "\", 0, -1) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iDelimiterPfad = ' & $iDelimiterPfad & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $sPfadHoeher = StringLeft($sPfad, $iDelimiterPfad) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sPfadHoeher = ' & $sPfadHoeher & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console ShellExecute($sPfadHoeher) EndFunc Func _INI() ConsoleWrite("_INI" & @CRLF) Sleep(10) EndFunc Func _Quit() Exit EndFunc I can see the trayicon but there is nothing happening neither primary double click nor secondary click. What's wrong? Regards, Conrad Edited February 21, 2016 by Simpel [Solved] SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 20, 2016 Moderators Share Posted February 20, 2016 Simpel, Simple! (pun intended) You have placed the infinite loop before you create the tray menu - so that code is never run. Just move the loop after the try menu creation lines and all works as you expect. M23 P.S. You might want to add 8 to your Opt("TrayMenuMode") line - look in the Help file to see why. 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...
Simpel Posted February 20, 2016 Author Share Posted February 20, 2016 Ok. Shouldn't code after 8h work in front of a computer. I'll try it tomorrow. But I'm sure it will work. Will mark the topic as [Solved] then. Thanks and regards, Conrad SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
Simpel Posted February 21, 2016 Author Share Posted February 21, 2016 Hi. Yes it is running. 17 hours ago, Melba23 said: You might want to add 8 to your Opt("TrayMenuMode") line... I did this too. Thank you and regards, Conrad SciTE4AutoIt = 3.7.3.0 AutoIt = 3.3.14.2 AutoItX64 = 0 OS = Win_10 Build = 19044 OSArch = X64 Language = 0407/german H:\...\AutoIt3\SciTE H:\...\AutoIt3 H:\...\AutoIt3\Include (H:\ = Network Drive) Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 21, 2016 Moderators Share Posted February 21, 2016 Simpel, Glad I could help. M23 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...
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