Jump to content

No custom GUI icon in taskbar when au3 script is executed by "Run script" option


maniootek
 Share

Go to solution Solved by argumentum,

Recommended Posts

My Autoit script contains code which show GUI with custom icon (GuiSetIcon() function is used).

When I compile my script to exe and run it then I can see my custom icon on the windows taskbar but when I run my script with option "Run script" then I see default AutoIt icon on the taskbar.

I want see my custom icon on the taskbar when I run my script with option "Run script" or I when I use code:

Run("C:\Program Files (x86)\AutoIt3\Autoit3.exe" "C:\myscript.au3")

Any idea?

Link to comment
Share on other sites

You will need to make a copy of AutoIt3.exe into a new directory, hack its icon to change it to yours, then run with this new exe.  Voilà !

Or you can just compile it ;)

Link to comment
Share on other sites

 

@maniootek try compile this script

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=C:\Program Files (x86)\AutoIt3\Icons\MyAutoIt3_Red.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>

Example()

Func Example()

    GUICreate("My GUI new icon") ; will create a dialog box that when displayed is centered
    $sFile = "C:\Program Files (x86)\AutoIt3\Icons\MyAutoIt3_Red.ico"

    GUISetIcon($sFile) ; will change icon

    GUISetState(@SW_SHOW); will display an empty dialog box

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd

    GUIDelete()
EndFunc   ;==>Example

 

I know that I know nothing

Link to comment
Share on other sites

Link to comment
Share on other sites

This works for me compiled/uncompiled:

;#NoTrayIcon
#include <GUIConstantsEx.au3>

GUICreate("Test", 300, 200)
GUISetIcon(@ScriptDir & '\test.ico')
TraySetIcon(@ScriptDir & '\test.ico')
GUISetState(@SW_SHOW)

While 1
    If GuiGetMsg() = $GUI_EVENT_CLOSE Then Exit
WEnd

Anyway try this if you use embeded icon added at compile time by #AutoIt3Wrapper:

#AutoIt3Wrapper_icon=test.ico

;#NoTrayIcon
#include <GUIConstantsEx.au3>

GUICreate("Test2", 300, 200)
If Not @Compiled Then
    GUISetIcon(@ScriptDir & '\test.ico')
    TraySetIcon(@ScriptDir & '\test.ico')
EndIf
GUISetState(@SW_SHOW)

While 1
    If GuiGetMsg() = $GUI_EVENT_CLOSE Then Exit
WEnd

 

Link to comment
Share on other sites

Tray icon and gui icon is no problem, it works, It's all about Windows 10 taskbar icon when script is run as a parameter of autoit.exe (run script option)

Your code also show autoit icon (not custom icon).

image.png.8c1e5f1bf8ee54602b2623f379a36e31.png

image.png.9271493346735cd3b3d32044752108e3.png

Edited by maniootek
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...