Zedna Posted February 8, 2023 Posted February 8, 2023 (edited) According to this my old post with similar problem: different title on taskbar/gui here is modification for different icon on taskbar/gui -> which works for me in all situations (Drag/Run/Scite...): expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> #include <Misc.au3> #include <SendMessage.au3> ;~ Global Const $WM_SYSCOMMAND = 0x0112 ;~ Global Const $SC_MINIMIZE = 0xF020 ;~ Global Const $SC_RESTORE = 0xF120 ;~ Global Const $WM_MOVE = 0x3 ;~ Global Const $WM_SIZE = 0x05 $app = GUICreate("Application title", 1, 1,-1,-1,$WS_POPUP) GUISetIcon(@ScriptDir & '\test1.ico') GUISetState(@SW_SHOW, $app) $gui = GUICreate("Form title", 300, 200, -1, -1, -1, -1, $app) GUISetIcon(@ScriptDir & '\test2.ico') GUISetState(@SW_SHOW, $gui) GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") GUIRegisterMsg($WM_MOVE, "WM_MOVE") Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE Func WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) Switch $wParam Case $SC_MINIMIZE _SendMessage($app, $WM_SYSCOMMAND, $SC_MINIMIZE, 0) GUISetState(@SW_HIDE, $gui) Return 0 Case $SC_RESTORE _SendMessage($app, $WM_SYSCOMMAND, $SC_RESTORE, 0) GUISetState(@SW_SHOW, $gui) Return 0 EndSwitch Return $GUI_RUNDEFMSG EndFunc Func WM_MOVE($hWnd, $Msg, $wParam, $lParam) ;~ If $hWnd = $gui Then $pos = WinGetPos($gui) WinMove($app, '', $pos[0], $pos[1]) ;~ WinMove($app, '', _LoWord($wParam), _HiWord($wParam)) ;~ EndIf Return $GUI_RUNDEFMSG EndFunc Func _HiWord($x) Return BitShift($x, 16) EndFunc Func _LoWord($x) Return BitAND($x, 0xFFFF) EndFunc Edited February 8, 2023 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
ioa747 Posted February 8, 2023 Posted February 8, 2023 unfortunately it doesn't work I know that I know nothing
Zedna Posted February 8, 2023 Posted February 8, 2023 (edited) Here is simplified version, which should work also on new AutoIt's versions (I use very old 3.2.12.1): #NoTrayIcon #include <GUIConstantsEx.au3> $app = GUICreate("Application title", 1, 1,-1,-1,0x80000000) ; $WS_POPUP=0x80000000 GUISetIcon(@ScriptDir & '\test1.ico') GUISetState(@SW_SHOW, $app) $gui = GUICreate("Form title", 300, 200, -1, -1, -1, -1, $app) GUISetIcon(@ScriptDir & '\test2.ico') GUISetState(@SW_SHOW, $gui) Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE But this works for me also when running on my (Unzipped) AutoIt 3.3.14.5/3.3.16.1 ... Edited February 8, 2023 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
ioa747 Posted February 8, 2023 Posted February 8, 2023 (edited) not working how do you have it installed? is portable? is in C:\Program Files (x86)\ ? why is possible by drop in folder out of C:\Program Files (x86)\ ? Edited February 8, 2023 by ioa747 I know that I know nothing
ioa747 Posted February 8, 2023 Posted February 8, 2023 (edited) yesterday i installed it on c:\ , without result, and I reinstalled it on C:\Program Files (x86)\ Edited February 8, 2023 by ioa747 I know that I know nothing
Nine Posted February 8, 2023 Posted February 8, 2023 not working for me either -- @Zedna you have a magical installation “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
ioa747 Posted February 8, 2023 Posted February 8, 2023 @Nine can you enlighten us ? I have this version v3.3.16.1 19 September, 2022https://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.zip if i run the script from shell with right click custom icon in taskbar not working if i run the script from SciTE with f5 custom icon in taskbar not working if i drop the script on C:\Program Files (x86)\AutoIt3\AutoIt3.exe custom icon in taskbar not working if I copy the AutoIt3 folder from C:\Program Files (x86)\AutoIt3 to C:\ , and drop the script on AutoIt3.exe custom icon in taskbar is working Is there a logical explanation? I know that I know nothing
Zedna Posted February 8, 2023 Posted February 8, 2023 (edited) I have got standard instalation by installer 3.2.12.1 + full Scite4AutoIt3 (from that old time). Newer versions on my computer are only unzipped AutoIt+Scite4AutoIt3. On my machine it's OK with ALL versions in all scenarios. I still don't know why it's OK on my machine and not on yours. EDIT: I have (completely) disabled UAC on all my computers, maybe try to disable it (temporarily) too ... Edited February 8, 2023 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Nine Posted February 8, 2023 Posted February 8, 2023 Which version of OS do you have @Zedna ? I have totally no idea why it is working for Zedna and not for us all “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
Zedna Posted February 8, 2023 Posted February 8, 2023 Tested on Win10 (at work) and Win7 (at home). Resources UDF ResourcesEx UDF AutoIt Forum Search
Nine Posted February 8, 2023 Posted February 8, 2023 Well, I have both too. And none is working correctly as you. In fact, you are the only one that works. So what does it tell you ? You are an MVP, question and answer is on your side to understand and tell us the reason. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
TimRude Posted February 16, 2023 Posted February 16, 2023 (edited) On my Windows 10 system with AutoIt 3.3.16.1 installed, if I have the system taskbar setting 'Combine taskbar buttons' set to 'Always, hide labels', I get the generic AutoIt icon in the taskbar when running an uncompiled script. But if I change that setting to 'Never' or 'When taskbar is full', I see the custom icon. Edited February 16, 2023 by TimRude Zedna and ioa747 2
ioa747 Posted February 16, 2023 Posted February 16, 2023 that is something. But what cracks me up is if I copy the AutoIt3 folder from C:\Program Files (x86)\AutoIt3 to C:\ , and drop the script on AutoIt3.exe custom icon in taskbar is working Is there a logical explanation? I have come to the conclusion that something is going on in the windows registry, but I don't know what I know that I know nothing
Solution argumentum Posted February 16, 2023 Solution Posted February 16, 2023 _WinAPI_SetCurrentProcessExplicitAppUserModelID() will fix that TimRude, ioa747, maniootek and 1 other 4 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
TimRude Posted February 16, 2023 Posted February 16, 2023 (edited) 24 minutes ago, argumentum said: _WinAPI_SetCurrentProcessExplicitAppUserModelID() will fix that Yep, it sure does! Now I get the custom icon in the taskbar no matter what 'Combine taskbar buttons' setting I use. #NoTrayIcon #include <GUIConstants.au3> #include <WinAPICom.au3> #include <WinAPIShellEx.au3> _WinAPI_SetCurrentProcessExplicitAppUserModelID(_WinAPI_CreateGUID()) ; ensure a unique ID GUICreate("My Custom GUI", 300, 200) GUISetIcon(@SystemDir & "\shell32.dll", 239) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited February 16, 2023 by TimRude
pixelsearch Posted December 8 Posted December 8 (edited) Hi just to let you know, I'm at my bro's home on a Win11 x64 laptop, with AutoIt portable 3.3.16.1 unzipped on a USB device, extracted from the 17.208 Kb zip file found on the download page : "AutoIt– Self Extracting Archive (for those who don’t like/want an installer)(includes x86 and x64 components and Aut2Exe and AutoItX)" Now I run Scite.exe from the USB device, then open this .au3 script in Scite and run it with F5 (Go) GUICreate("Custom icon in Taskbar & Systray", 400, 300) GUISetIcon(@ScriptDir & '\script.ico') ; ok TraySetIcon(@ScriptDir & '\script.ico') ; ok GUISetState() Do Until GuiGetMsg() = -3 ; $GUI_EVENT_CLOSE (-3) As you can see, the external icon is correctly shown in the 3 places, even when the script is an .au3 file : In the GUI itself In Taskbar In SysTray I did this test because some posters were surprised why it worked on Zedna's computer but not on their computer. Hope it helps Edit: the icon appears also correctly when I press Alt+Tab to switch between tasks. Edited December 9 by pixelsearch
ioa747 Posted December 8 Posted December 8 @pixelsearch the issue was solved by @argumentum with the following On 2/16/2023 at 7:37 AM, argumentum said: _WinAPI_SetCurrentProcessExplicitAppUserModelID() will fix that However, let's do a recap. on my computer: Windows 10 Pro Version 22H2 with AutoIt Version: 3.3.16.1 installed 1) if I run the script below #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #NoTrayIcon #include <GUIConstants.au3> #include <WinAPIShellEx.au3> ;~ _WinAPI_SetCurrentProcessExplicitAppUserModelID(_WinAPI_CreateGUID()) ; ensure a unique ID GUICreate("My Custom GUI", 300, 200) GUISetIcon(@ScriptDir & '\test1.ico') ; ok TraySetIcon(@ScriptDir & '\test1.ico') ; ok GUISetState(@SW_SHOW) Do Until GuiGetMsg() = -3 ; $GUI_EVENT_CLOSE (-3) the display is 2) if I run the script below #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #NoTrayIcon #include <GUIConstants.au3> #include <WinAPIShellEx.au3> _WinAPI_SetCurrentProcessExplicitAppUserModelID(_WinAPI_CreateGUID()) ; ensure a unique ID GUICreate("My Custom GUI", 300, 200) GUISetIcon(@ScriptDir & '\test1.ico') ; ok TraySetIcon(@ScriptDir & '\test1.ico') ; ok GUISetState(@SW_SHOW) Do Until GuiGetMsg() = -3 ; $GUI_EVENT_CLOSE (-3) the display is However, as I mentioned above, if I copy AutoIt3.exe along with the Include folder to @ScriptDir and drag script1 onto AutoIt3.exe, then the display result is like 2 conclusion? Also, something else that impressed me is that if I pin AutoIt3.exe to the start menu and right-click, it also shows me image files. Please, every comment is appreciated! Thank you very much I know that I know nothing
argumentum Posted December 8 Posted December 8 _WinAPI_CreateGUID() is not a good idea unless to create a constant of the script/project. Otherwise StringTrimRight(@ScriptName, 3) [& $VERSION] would be a good idea, as a copy'n'paste solution. ioa747 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
ioa747 Posted December 8 Posted December 8 Something like that, you mean? #NoTrayIcon #include <GUIConstants.au3> #include <WinAPIShellEx.au3> _WinAPI_SetCurrentProcessExplicitAppUserModelID(StringTrimRight(@ScriptName, 3) & "_v1.0") GUICreate("My Custom GUI", 300, 200) GUISetIcon(@ScriptDir & '\test1.ico') ; ok TraySetIcon(@ScriptDir & '\test1.ico') ; ok GUISetState(@SW_SHOW) Do Until GuiGetMsg() = -3 ; $GUI_EVENT_CLOSE (-3) argumentum 1 I know that I know nothing
argumentum Posted December 8 Posted December 8 (edited) expandcollapse popup#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #NoTrayIcon ; either way, upto the coder #include <GUIConstants.au3> #include <WinAPIShellEx.au3> ; for _WinAPI_SetCurrentProcessExplicitAppUserModelID($sAppID) #include <WinAPIProc.au3> ; for _WinAPI_GetCurrentProcessExplicitAppUserModelID() ;~ #include <WinAPICom.au3> ; for _WinAPI_CreateGUID() ;~ Global Const $_g__ProcessExplicitAppUserModelID = "{E2971A53-037D-4811-B3E3-FE79C2586831}" ; created with _WinAPI_CreateGUID() ;~ _WinAPI_SetCurrentProcessExplicitAppUserModelID($_g__ProcessExplicitAppUserModelID) ; ensure a unique product ID ; or Global Const $VERSION = "0.1.2.3" ; @ScriptFullPath would be better than @ScriptName ? ( depending on how the script works ) _WinAPI_SetCurrentProcessExplicitAppUserModelID(StringRight(StringTrimRight(@ScriptFullPath, 3) & $VERSION, 127)) ; ensure a unique product ID [and maybe unique for version too] ; max length of "SetCurrentProcessExplicitAppUserModelID" is 127 char. ConsoleWrite(' CurrentProcessExplicitAppUserModelID:' & @CRLF & _ ' StringLen = ' & StringLen(_WinAPI_GetCurrentProcessExplicitAppUserModelID()) & @CRLF & _ ' AppID >' & _WinAPI_GetCurrentProcessExplicitAppUserModelID() & '< ' & @CRLF & _ ' @error,@extended = ' & @error & ',' & @extended & @CRLF & @CRLF) main() Func main() Local $sIcon = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1)) & "Icons\MyAutoIt3_Red.ico" Local $hGUI = GUICreate("My Custom GUI", 300, 200) GUISetIcon($sIcon) ; ok TraySetIcon($sIcon) ; ok Local $idBttn1 = GUICtrlCreateButton("MsgBox without parent", 5, 5, 200, 25) Local $idBttn2 = GUICtrlCreateButton("MsgBox with parent", 5, 35, 200, 25) GUISetState(@SW_SHOW) While "meh" ; it is very important to have fun while coding, for me anyway Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idBttn1 MsgBox(0, "title", "Bttn 1" & @LF & @LF & "w/o parent", 60) Do ; the msgbox is smaller than the gui and GuiGetMsg gets queued, Until Not GUIGetMsg() ; therefore this avoids closing the gui unwillingly. Case $idBttn2 ; hence is better to provide the parent if present. MsgBox(0, "title", "Bttn 2" & @LF & @LF & "with parent", 60, $hGUI) EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>main Yes @ioa747. I too felt that it needed a better presentation than just a phrase. That's why I posted this. I tend to tell people to "put code where you mouth is". I was failing my own demands 😁 Edited December 8 by argumentum ioa747 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
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