Cybazaar Posted May 24, 2018 Share Posted May 24, 2018 Umm, hello again. Ive experimented with creating my own tray menu today and it worked as intended (i followed the example), but when i tried to merge it with the desired script it's not working. If i place the tray menu func first, the Exit option wont work (it will show a MsgBox), or if its last, the script freezes. This is the Tray Menu script: #NoTrayIcon #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <TrayConstants.au3> ; Required for the $TRAY_ICONSTATE_SHOW constant. Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. CustomTray() Func CustomTray() Local $iHelpMSG = TrayCreateItem("Help") ; Help Message TrayCreateItem("") ; Create a separator line. Local $idExit = TrayCreateItem("Exit") TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. TraySetToolTip("CustomName") While 1 Switch TrayGetMsg() Case $iHelpMSG ; Display a message box with the working instructions. MsgBox($MB_SYSTEMMODAL, "", "CustomTEXT") Case $idExit ; Exit the loop. ExitLoop EndSwitch WEnd EndFunc ;==>CustomTray And this is the script that i want the tray menu implemented in: expandcollapse popup#include <Misc.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> HotKeySet("^{F11}", "ExitProg") Func ExitProg() Exit 0 ;;Exits the program EndFunc TraySetToolTip("Автоматични Отливка/Матрица/Дата") MsgBox($MB_SYSTEMMODAL, "", "Използавай знак '+' (плюс) за автоматично попълване на Отливка/Матрица/Дата." & @LF & "" & @LF & "Инструкции:" & @LF & " 1. Програмата работи само за изчакващата отливка" & @LF & " 2. Натискате ПЛЮС след стартирана програма в PCDMIS" & @LF & " (Когато изпише '№ Отливка')" & @LF & "" & @LF & "За изход се натиска CTRL и F11.") While 1 If WinActive ("[TITLE:Input Comment; CLASS:#32770]", "отливка") Then If _IsPressed("6B") Then WinActivate ("[CLASS:OMain]", "") WinMove("[CLASS:OMain]", "", 0, 300, 1280, 702) MouseMove (480, 770, 0) MouseClick ($MOUSE_CLICK_LEFT) Send("{TAB}") Send ("^c") WinActivate ("[CLASS:#32770]", "") Send ("{BS}") Send ("^v") Send ("{ENTER}") WinActivate ("[CLASS:OMain]", "") MouseMove (480, 770, 0) MouseClick ($MOUSE_CLICK_LEFT) Send("{TAB 2}") Send ("^c") WinActivate ("[CLASS:#32770]", "") Send ("^v") Send ("{ENTER}") WinActivate ("[CLASS:OMain]", "") MouseMove (480, 770, 0) MouseClick ($MOUSE_CLICK_LEFT) Send("{TAB}") Send("+{TAB}") Send ("^c") WinActivate ("[CLASS:#32770]", "") Send ("^v") Send ("{ENTER}") EndIf ElseIf WinActive ("[TITLE:Input Comment; CLASS:#32770]", "Отливка") Then If _IsPressed("6B") Then WinActivate ("[CLASS:OMain]", "") WinMove("[CLASS:OMain]", "", 0, 300, 1280, 702) MouseMove (650, 770, 0) MouseClick ($MOUSE_CLICK_LEFT) MouseClick ($MOUSE_CLICK_LEFT) Send ("^c") WinActivate ("[CLASS:#32770]", "") Send ("{BS}") Send ("^v") Send ("{ENTER}") WinActivate ("[CLASS:OMain]", "") MouseMove (780, 770, 0) MouseClick ($MOUSE_CLICK_LEFT) MouseClick ($MOUSE_CLICK_LEFT) Send ("^c") WinActivate ("[CLASS:#32770]", "") Send ("^v") Send ("{ENTER}") WinActivate ("[CLASS:OMain]", "") MouseMove (480, 770, 0) MouseClick ($MOUSE_CLICK_LEFT) MouseClick ($MOUSE_CLICK_LEFT) Send ("^c") WinActivate ("[CLASS:#32770]", "") Send ("^v") Send ("{ENTER}") EndIf EndIf WEnd Can you tell me where i am doing wrong? Link to comment Share on other sites More sharing options...
Cybazaar Posted May 24, 2018 Author Share Posted May 24, 2018 Why is my topic on hold for a review? Link to comment Share on other sites More sharing options...
Cybazaar Posted May 26, 2018 Author Share Posted May 26, 2018 Can you guys help me out? No matter what i try it's always the same result Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 26, 2018 Moderators Share Posted May 26, 2018 Cybazaar, Quote Why is my topic on hold for a review? Probably because your IP has previously been used for spam and so requires a Moderator to approve any posts using the same IP. And as to your problem - did you put the TrayGetMsg inside the While...WEnd loop like this? expandcollapse popup#include <MsgBoxConstants.au3> #include <Misc.au3> HotKeySet("^{F11}", "ExitProg") Opt("TrayMenuMode", 3) Global $idExit, $iHelpMSG CustomTray() While 1 If WinActive ("[TITLE:Input Comment; CLASS:#32770]", "???????") Then If _IsPressed("6B") Then ; Code EndIf ElseIf WinActive ("[TITLE:Input Comment; CLASS:#32770]", "???????") Then If _IsPressed("6B") Then ; Code EndIf EndIf Switch TrayGetMsg() Case $iHelpMSG ; Display a message box with the working instructions. MsgBox($MB_SYSTEMMODAL, "", "CustomTEXT") Case $idExit ; Exit the loop. ExitLoop EndSwitch WEnd Func CustomTray() $iHelpMSG = TrayCreateItem("Help") ; Help Message TrayCreateItem("") ; Create a separator line. $idExit = TrayCreateItem("Exit") TraySetToolTip("CustomName") EndFunc ;==>CustomTray Func ExitProg() Exit 0 ;;Exits the program EndFunc That works fine for me. 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...
Cybazaar Posted May 26, 2018 Author Share Posted May 26, 2018 Ah, you've put the switch inside the first While_Wend loop. What i was trying to do was to put them one after another. Yes it now works as intended. Thanks for the help, much appreciated! 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