NoizeBit Posted July 25, 2015 Share Posted July 25, 2015 Hi,I'd like to add a pause icon to a custom pause menu. What's more I'd like it to flash while the script is paused:TraySetPauseIcon("shell32.dll", 12) ; Set the pause icon. This will flash on and off when the tray menu is selected and the script is paused.I've found no how-tos about adding more icons as resources. At least, I know I'd have to specify it within the wrapper somehow.Code of the script:#include <TrayConstants.au3> Opt("TrayMenuMode", 3) Global $trayPause = TrayCreateItem("Pause") Global $trayExit = TrayCreateItem("Exit") PauseTray() Func PauseTray() ;Pause in ON TrayItemSetText($trayPause, "Resume") ConsoleWrite("!Pause" & @LF) While 3 Switch TrayGetMsg() Case $trayPause ExitLoop Case $trayExit Exit EndSwitch WEnd ;Pause if OFF TrayItemSetText($trayPause, "Pause") ConsoleWrite("+Resume" & @LF) EndFunc ;==>PauseTrayCould anyone give me a hint where should I place the TraySetPauseIcon line to make it work? I've played around with it for a while, but the icon doesn't change if script is paused... Link to comment Share on other sites More sharing options...
Developers Jos Posted July 25, 2015 Developers Share Posted July 25, 2015 From the SciTE4AutoIt3 helpfile (AUtoIt3Wrapper:#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files (x86)\AutoIt3\Icons\au3.ico #AutoIt3Wrapper_Res_Icon_Add=C:\Program Files (x86)\AutoIt3\Icons\au3script_v10.ico #AutoIt3Wrapper_Res_Icon_Add=C:\Program Files (x86)\AutoIt3\Icons\au3script_v9.ico #AutoIt3Wrapper_Res_Icon_Add=C:\Program Files (x86)\AutoIt3\Icons\filetype-blank.ico #include <ButtonConstants.au3> ; Create the GUI $hGUI = GUICreate("Demo icon resources") $cButton = GUICtrlCreateButton("", 10, 10, 40, 40, $BS_ICON) $cLabel = GUICtrlCreateLabel("", 70, 25, 200, 20) GUISetState(@SW_SHOW, $hGUI) ; Now run through the added icons in the resource table For $x = 201 To 204 ; Change the tray icon $rc1 = TraySetIcon(@ScriptFullPath, $x) ; Change the icon in the button $rc2 = GUICtrlSetImage($cButton, @ScriptFullPath, $x) GUICtrlSetData($cLabel, "Icon Name: " & $x) TrayTip("Added icon: " & $x, "TraySetIcon rc: " & $rc1 & @CRLF & "GUICtrlSetImage rc: " & $rc2, 3) ; Allow time for icon to be seen Sleep(5000) Next ; Delete the GUI GUIDelete($hGUI)Compile it and run the compiled exe. Jos NoizeBit 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
NoizeBit Posted July 25, 2015 Author Share Posted July 25, 2015 From the SciTE4AutoIt3 helpfile (AUtoIt3Wrapper:#AutoIt3Wrapper_Res_Icon_Add=C:\Program Files (x86)\AutoIt3\Icons\au3.ico #AutoIt3Wrapper_Res_Icon_Add=C:\Program Files (x86)\AutoIt3\Icons\au3script_v10.ico #AutoIt3Wrapper_Res_Icon_Add=C:\Program Files (x86)\AutoIt3\Icons\au3script_v9.ico #AutoIt3Wrapper_Res_Icon_Add=C:\Program Files (x86)\AutoIt3\Icons\filetype-blank.ico #include <ButtonConstants.au3> ; Create the GUI $hGUI = GUICreate("Demo icon resources") $cButton = GUICtrlCreateButton("", 10, 10, 40, 40, $BS_ICON) $cLabel = GUICtrlCreateLabel("", 70, 25, 200, 20) GUISetState(@SW_SHOW, $hGUI) ; Now run through the added icons in the resource table For $x = 201 To 204 ; Change the tray icon $rc1 = TraySetIcon(@ScriptFullPath, $x) ; Change the icon in the button $rc2 = GUICtrlSetImage($cButton, @ScriptFullPath, $x) GUICtrlSetData($cLabel, "Icon Name: " & $x) TrayTip("Added icon: " & $x, "TraySetIcon rc: " & $rc1 & @CRLF & "GUICtrlSetImage rc: " & $rc2, 3) ; Allow time for icon to be seen Sleep(5000) Next ; Delete the GUI GUIDelete($hGUI)Compile it and run the compiled exe. JosThanks Jos, this helps me how to specify additional icons. Although I'm looking for a solution just like what's in the help file, but don't know how to change my code to reflect the flashing behaviour of this example:#include <TrayConstants.au3> ; Required for the $TRAY_ICONSTATE_SHOW constant. Example() Func Example() TraySetPauseIcon("shell32.dll", 12) ; Set the pause icon. This will flash on and off when the tray menu is selected and the script is paused. TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. While 1 Sleep(100) ; An idle loop. WEnd EndFunc ;==>Example Link to comment Share on other sites More sharing options...
NoizeBit Posted July 25, 2015 Author Share Posted July 25, 2015 I've just figured it out, the full location was missing from wrapper 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