Jump to content

When compiling with a3x, the icon is not applied - (Moved)


 Share

Recommended Posts

(If translated with a translator, it may be written a little awkwardly. I would be grateful if you could understand my situation)

As mentioned in the title, the icon file, which was applied well when compiled with exe, does not apply when compiled with a3x, and is displayed as the default autoit icon.

 

#AutoIt3Wrapper_Icon=icon.ico

 

I specified the icon file at the top, but why can't it be applied? Is there any way to compile with a3x including icons?

Link to comment
Share on other sites

  • Moderators

Moved to the appropriate AutoIt General Help and Support forum, as the AutoIt Example Scripts forum very clearly states:

Quote

Share your cool AutoIt scripts, UDFs and applications with others.


Do not post general support questions here, instead use the AutoIt Help and Support forums.

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

this way it works with or without compilation
No need to set #AutoIt3Wrapper_Icon. The icon of <file>.a3x I don't think it changes

#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile_type=a3x
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
#include <WinAPIShellEx.au3>
#include <TrayConstants.au3> ; Required for the $TRAY_ICONSTATE_SHOW constant.

Opt("TrayMenuMode", 3) ; 1+2 ;0=append, 1=no default menu, 2=no automatic check, 4=menuitemID  not return

_WinAPI_SetCurrentProcessExplicitAppUserModelID(_WinAPI_CreateGUID()) ; ensure a unique ID, neded for TaskBar icon

TraySetIcon("shell32.dll", 239) ; Set the tray menu icon
GUICreate("My Custom GUI", 300, 200)
GUISetIcon(@SystemDir & "\shell32.dll", 239) ; Set the Window & TaskBar icon icon
GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

Edited by ioa747

I know that I know nothing

Link to comment
Share on other sites

From what I understand there is not a way to add a custom icon to a3x (specifically for the file itself), as it's a reference to the AutoIt exe/icon. Here's some more information: 

 

 

The best option you're likely to get is to create a shortcut to the .a3x file, and change the icon of that shortcut:

q7AOBzd.png

Edited by mistersquirrle

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

I have used this for almost 10 years now

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=MyApp
#AutoIt3Wrapper_Icon=scriptfd.ico
#AutoIt3Wrapper_Outfile=some.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=Awesome AutoIt script
#AutoIt3Wrapper_Res_Description=Does some magix
#AutoIt3Wrapper_Res_Fileversion=2.0.1.440
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=Mister Skysnake
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_Res_Field=Compile Date|%date% %time%
#AutoIt3Wrapper_Res_Field=#pragma|compile(OriginalFilename,some.exe)
#AutoIt3Wrapper_Res_Icon_Add=other.ico
#AutoIt3Wrapper_Res_Icon_Add=blackbook.ico
#AutoIt3Wrapper_Res_Icon_Add=bluebook.ico
#AutoIt3Wrapper_Res_Icon_Add=purplebook.ico
#AutoIt3Wrapper_Run_AU3Check=n
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 6 -q
#AutoIt3Wrapper_Run_Tidy=y
#Au3Stripper_Parameters=/rm
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

This goes at the top of your script. The icons must be correctly named and present in the local @Script folder

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

1 hour ago, Skysnake said:

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
;...
://////=__=
://////=__=://////==OriginalFilename,some.exe)
;...
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

 

What is this part supposed to be? It just throws errors for me, and I haven't seen something like this before.

 

Also while this will work for outputting a .exe, the question is specifically about .a3x which this won't do anything for (tested compiling after adding: #AutoIt3Wrapper_Outfile_type=a3x and even adding multiple icons with Res_Icon_Add didn't change the filesize from a couple kb ).

Edited by mistersquirrle

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

  • Developers
2 hours ago, Skysnake said:

This goes at the top of your script. The icons must be correctly named and present in the local @Script folder

This will only work when:

  1. You have the full SciTE4AutoIt3 installer installed with AutoIt3Wrapper
  2. You compile to an EXE !   not A3X as that is missing the PE header a program has which contains the ICO info.

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

9 hours ago, mistersquirrle said:

What is this part supposed to be? It just throws errors for me, and I haven't seen something like this before.

Hmm. Interesting, that is the way the Forum represents the following directive

#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_Res_Field=Compile Date|%date% %time%
#AutoIt3Wrapper_Res_Field=#pragma|compile(OriginalFilename,some.exe)

Probably the |% screws with the interpreter.

I have changed the code tag above to HTML (it is not HTML but now displays the code correctly)

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

8 hours ago, Jos said:

This will only work when:

  1. You have the full SciTE4AutoIt3 installer installed with AutoIt3Wrapper
  2. You compile to an EXE !   not A3X as that is missing the PE header a program has which contains the ICO info.

Yes Master

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

  • Developers

mmm   :think: so what exactly does this do?

13 minutes ago, Skysnake said:

#AutoIt3Wrapper_Res_Field=#pragma|compile(OriginalFilename,some.exe)

 

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

  • Developers
4 minutes ago, Skysnake said:

From what I see that is a Windows file system parameter, the key is "OriginalFilename" and you can then specify "some.exe"

I have no idea what this all means, but assume that statement is ONLY adding an extra TEXT field to the PE header with that content and nothing else!

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

You may be right.  My impression is that Windows does not know what the compiler "Outfile" name means, but is supposed to know what the OriginalFilename means. I am guessing this has to do with Windows Indexes and search. And yes, I am guessing.

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

  • Developers
17 minutes ago, Skysnake said:

You may be right. 

May? ;)  funny...   

 

18 minutes ago, Skysnake said:

My impression is that Windows does not know what the compiler "Outfile" name means, but is supposed to know what the OriginalFilename means. I am guessing this has to do with Windows Indexes and search. And yes, I am guessing.

Correct .... you are guessing and I have no clue why one would think that Windows can do anything with this. Possibly you are referring to these supported "Variables" by AutoIt3Wrapper directive found in the Helpfile?:

 

Quote

; The following directives can contain: these variables
;   %in% , %out%, %outx64%, %icon% which will be replaced by the fullpath\filename.
;   %scriptdir% same as @ScriptDir and %scriptfile% = filename without extension.
;   %fileversion% is the information from the #AutoIt3Wrapper_Res_Fileversion directive
;   %scitedir% will be replaced by the SciTE program directory
;   %autoitdir% will be replaced by the AutoIt3 program directory

 

 

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

  • Developers

Again, what is the relation between an AutoIt3Script that updates an PE header of an Program resource and anything with Windows? 
I realize that the Windows Explorer does use some of the Info in the PE header to display such things as Version and Description.

Looking at your line: 

#AutoIt3Wrapper_Res_Field=#pragma|compile(OriginalFilename,some.exe)

.. there are a number of strange things with it! For starters: Why are you setting a PE field to a AutoIt3 specific #PRAGMA statement? What are you expecting this line to do?

Edited by Jos

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

  • Developers
9 minutes ago, Skysnake said:

Am I missing something?

Guess so as you are not answering my whole question...   Why #PRAGMA?

.. but when the question is how to set a PE header known fieldname like: OriginalFilename you simply use this format:

#AutoIt3Wrapper_Res_Field=OriginalFilename|"Whatever.exe"

Which works nicely for me:

image.png.af1bc7e075466f0941dcd92c8c9b7ae4.png

 

Edited by Jos

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

Contamination 🤷‍♂️

Thank you for pointing that out. I will remove the #pragma, but what would the correct syntax be then?
 

Jos: Was already Edited. ;) 

Edited by Jos

Skysnake

Why is the snake in the sky?

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

×
×
  • Create New...