Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

AHK Icon Changer


  • Please log in to reply
35 replies to this topic
Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
This simple script will let you use custom icons for compiled ahk scripts (main/pause/suspend etc.). Run it after a new installation of ahk (or when u get bored of current icons)

Required : ResHacker

;These are the paths to icons
;leave blank to not to alter.

;Main
MIco = E:\stuff\Pics\icons\GeoIcons\arrow.ico

;Suspend
SIco =

;Suspend
PIco =

;Suspend + Pause
SPIco =

;Path to ResHacker.exe

RHPath = E:\Program Files\Resource Hacker\ResHacker.exe

;___________________________________________


; Gets path to AutoHotkey
RegRead, AHKPATH, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Run\Command,
StringGetPos, POS, AHKPATH, \AutoHotkey.exe
StringLeft, AHKPATH, AHKPATH, %POS%
StringReplace, AHKPATH, AHKPATH, ",, A

IfNotExist, %AHKPath%\Compiler\AutoHotkeySC.bin
{
	MsgBox, AutoHotkey is not correctly installed.
	ExitApp
}

;creates backup (no overwrite so orig is retained)
FileCopy, %AHKPath%\Compiler\AutoHotkeySC.bin, %AHKPath%\Compiler\AutoHotkeySC.bak


IfNotEqual, MIco,
	Run, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %MIco%`, icon`,159`,

IfNotEqual, SIco,
	Run, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %SIco%`, icon`,206`,

IfNotEqual, PIco,
	Run, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %PIco%`, icon`,207`,

IfNotEqual, SPIco,
	Run, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %SPIco%`, icon`,208`,


MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
This is a great workaround until better control over pause/suspend icons is implemented. There have definitely been requests for this sort of thing.

BoBo
  • Guests
  • Last active:
  • Joined: --
:D

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004

There have definitely been requests for this sort of thing.

yes i remember seeing a couple of posts asking kind of the same thing... so posted this simple way.

by the way i remember seeing posts for version info updation too... that can be easily achieved by:

-changing the ver info in .bin file.
-saving the changed resource as .res file.
-using cmd line (reshacker) to merge that resource when reqd.

this way one can keep different version resources .res files (just like different .ico files) and use the one reqd.

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


ranomore
  • Members
  • 171 posts
  • Last active: Mar 01 2013 01:41 PM
  • Joined: 06 Nov 2004
I updated this to include the icon resources for Win 98 (it's assumed that you would use the same ones on all OSes), and to include the Version Resource file.
;These are the paths to icons
;leave blank to not to alter.

;Main
MIco = E:\stuff\Pics\icons\GeoIcons\arrow.ico

;Suspend
SIco = 

;Suspend
PIco =

;Suspend + Pause
SPIco =

;Version Resource - where the previously made .res file is stored
VRes = E:\stuff\version.res

;Path to ResHacker.exe

RHPath = C:\Program Files\AutoHotkey\ResHack\ResHacker.exe

;___________________________________________


; Gets path to AutoHotkey
RegRead, AHKPATH, HKEY_CLASSES_ROOT, AutoHotkeyScript\Shell\Run\Command,
StringGetPos, POS, AHKPATH, \AutoHotkey.exe
StringLeft, AHKPATH, AHKPATH, %POS%

IfNotExist, %AHKPath%\Compiler\AutoHotkeySC.bin
{
   MsgBox, AutoHotkey is not correctly installed.
   ExitApp
}

;creates backup (no overwrite so orig is retained)
FileCopy, %AHKPath%\Compiler\AutoHotkeySC.bin, %AHKPath%\Compiler\AutoHotkeySC.bak

; the first Run line is for the 2000/XP icon
; the second Run line is for 98/ME icon
IfNotEqual, MIco,
{
  Run, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %MIco%`, icon`,159`,
  Run, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %MIco%`, icon`,228`,
}

; the first Run line is for the 2000/XP icon
; the second Run line is for 98/ME icon
IfNotEqual, SIco,
{
  Run, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %SIco%`, icon`,206`,
  Run, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %SIco%`, icon`,229`,
}

IfNotEqual, PIco,
   Run, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %PIco%`, icon`,207`,

IfNotEqual, SPIco,
   Run, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %SPIco%`, icon`,208`,

IfNotEqual, VRes,
   Run, %RHPath% -addoverwrite %AHKPath%\Compiler\AutoHotkeySC.bin`, %AHKPath%\Compiler\AutoHotkeySC.bin`, %VRes%`, VersionInfo`,1`,

I discovered an interesting quirk of the ResHack program--on Win 98, at least: Opening the AutoHotkeySC.bin file from the Recent file list appears to load a cached version of at least the "Version Info" portion of the file. It took me way too long to figure that out. :oops:

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
nice!

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
in case this might be of interest to anyone...

the icons of uncompiled scripts shown in tray can also be changed... use UPX from upx.sourceforge.net to unpack AutoHotkey.exe and then ResHacker to change icons.

I have the green one with the 'H' changed, as i got bored of it... even though i made that one! heh!!

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Thalon
  • Members
  • 641 posts
  • Last active: Jan 02 2017 12:17 PM
  • Joined: 12 Jul 2005
I have updated the script a bit for comfort and added the possibility of several configurations (to manage different projects).
This script helps to change the icons of compiled and uncompiled (!) scripts.
It also allows to set the fileinformations (Copyright, Version, Description, ...) for a compiled script (has to be compiled with AHK Icon Changer).

To take full advantage you have simply to create a folder named "Settings" in the Scripts folder.

Posted Image
Posted Image

The script can be found here.

Thalon

Thalon
  • Members
  • 641 posts
  • Last active: Jan 02 2017 12:17 PM
  • Joined: 12 Jul 2005

in case this might be of interest to anyone...

the icons of uncompiled scripts shown in tray can also be changed... use UPX from upx.sourceforge.net to unpack AutoHotkey.exe and then ResHacker to change icons.

I have the green one with the 'H' changed, as i got bored of it... even though i made that one! heh!!

How can I use UPX to unpack AutoHotkey.exe?
The following command will end in a denied Permission:

"C:\Dokumente und Einstellungen\Thalon\Desktop\upx.exe" upx -d C:\ProgramFiles\AutoHotkey\AutoHotkey.exe

Thalon

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
After the reshack, one has to compile the script, right?
Couldn't this be done in this scripts too?

Just some ideas for usability:
- If the settings are saved in individual files or sections of on file, they could be listed in a listbox in the gui, so they could be easier selected and loaded via doubleclick.
- A preview of the icons in the gui would be nice.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

Thalon
  • Members
  • 641 posts
  • Last active: Jan 02 2017 12:17 PM
  • Joined: 12 Jul 2005
@toralf
At the moment the tools is not linked to a special script, but this support can be added.
The settings are saved in different configuration-files and the actual Save-dialog is only a fast implementation (can be seen at the fact that all path-information is thrown away).
A icon-preview will be added into the next version.

If I am able (and allowed) to recompile AutoHotkey.exe as shortly described by Rajat it will be also able to change the uncompiled scripts icons...
Other ideas are also welcome!

Thalon

AGU
  • Guests
  • Last active:
  • Joined: --
@toralf

What are you doing here? ;) Hast du keinen GUI zu programmieren? :lol: :mrgreen: I'm waiting full of excitement for SGUI v.4.2

Sorry for offtopic. :D
___________________
Cheers
AGU

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
:) Sorry.... *going back to work on prototype*
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

Thalon
  • Members
  • 641 posts
  • Last active: Jan 02 2017 12:17 PM
  • Joined: 12 Jul 2005
I have updated the script above.

I have implemented toralfs suggestions there (it got a lot of code now ^^)

As soon as I know how to hack the Autohotkey.exe there will be a related update.

Further suggestions are welcome!

Edit: Deleting of config-files will be added soon
Thalon

Thalon
  • Members
  • 641 posts
  • Last active: Jan 02 2017 12:17 PM
  • Joined: 12 Jul 2005
New Update available.
Added the Desciption-Property for Settingsfiles.
Added the possibility to Delete a Settingsfile via Dialog (Delete-Button and pressing Del-Button in Listview)
Minor changes in code-structure.

Thalon