Jump to content

Change Icon for a3x files


Recommended Posts

So, after Jos told me about an amazing new (Compile to .a3x) feature in AutoIt, I've been using it successfully.  But it's confusing as the .a3x icon is the same as the .au3 files.

I used a simple Registry update to change that icon on my system, but shouldn't the AutoIt3 installer be using a different icon for these files by default?

Thanks

#RequireAdmin

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoIt3XScript\DefaultIcon", "", "REG_SZ", "C:\Program Files (x86)\AutoIt3\Icons\au3script_v9.ico")

 

Link to comment
Share on other sites

  • Developers

Why? The a3x extension is associated with AutoIt3.exe, so it will show its Icon.... or am I missing something? :) 

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

There is no separate ico for a3x at this moment so it indeed uses the default autoit3.exe ico, 

Actually it uses "C:\Program Files (x86)\AutoIt3\Icons\au3script_v11.ico"

Jos

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

  • 1 year later...

Would be a good feature to use the icon declared as #AutoIt3Wrapper_Icon=.

If you use a3x instead of an compiled autoit script you have some advantages:


1. false positive virus detection would be not exist expect from the autoit.exe interpreter file

2. if you have more than one autoit scripts on this pc (which has no autoit installed), you only have one autoit.exe.

 

This is the logic behind the question I guess. And I just want to try out this method. :D

 

Edit: A third launcher application (like c++) would execute the autoit3.exe with parameter (a3x file name).

Edited by xSunLighTx3
Link to comment
Share on other sites

  • Developers
4 hours ago, xSunLighTx3 said:

Would be a good feature to use the icon declared as #AutoIt3Wrapper_Icon=.

How would this help?

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
12 minutes ago, xSunLighTx3 said:

So you are able to set an individual icon for the a3x file within the config file. :)

Do not think that works as the Icon is stored in the PE header of a program, which the a3x file doesn't have. Did you actually try?

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

  • 4 years later...
Posted (edited)

Just my two cents. I just tried this and I could not get it to work. Registry entry had no effect on the program icon for a .a3x.  I even tried rebuilding icon cache. No dice.

A few years back I tried changing the icon within the AutoIt3.exe, It worked sorta. But that just broke the fact that it is a signed exe which defeats the main purpose of using an .a3x

FOUND THIS HERE. IT CAN BE DONE!!! Years I have been trying to find this.   ioa747 posted this

#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 BobMerit
Link to comment
Share on other sites

Posted (edited)
1 hour ago, BobMerit said:

Not being able to change the icon within a .a3x is just a sad situation.

Look, a file type, say: .pdf or .txt, is no different from .au3 or a3x.
If you would like an specific icon for your running script ( au3 or a3x ) just declare it.

Use _WinAPI_SetCurrentProcessExplicitAppUserModelID() to separate your scripts from one another:

#include <WinAPIShellEx.au3>
_WinAPI_SetCurrentProcessExplicitAppUserModelID('MyScript-' & @AutoItPID)

If StringInStr($CmdLineRaw, "/reRunLikeOnTV") Then
    $hGui = GUICreate("", 0, 0, 0, 0)
    GUISetIcon(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1)) & 'icons\MyAutoIt3_' & $CmdLine[2] & '.ico')
    GUISetState()
    TraySetIcon(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1)) & 'icons\MyAutoIt3_' & $CmdLine[2] & '.ico')
    MsgBox(262144, $CmdLine[2] & ' Script', $CmdLine[2] & ' icon', 60, $hGui)
    GUIDelete()
    Exit
EndIf

ShellExecute(@AutoItExe, '"' & @ScriptFullPath & '" /reRunLikeOnTV Green')
ShellExecute(@AutoItExe, '"' & @ScriptFullPath & '" /reRunLikeOnTV Red')

 

Edited by argumentum
better code

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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...