Sign in to follow this  
Followers 0
michaelslamet

Change Compiled Icon

10 posts in this topic

How to change compiled AutoIT script icon?

I would like to create a small command line utility for that.

I know before compile I could add

#AutoIt3Wrapper_Icon=

 

But what I want change is the embedded icon after the script compiled

Please give me some hints how to do that :)

Share this post


Link to post
Share on other sites



Resource Hacker

1 person likes this

Share this post


Link to post
Share on other sites

Resource Hacker

 

As far as I know, resource hacker doesn't support command line, does it?

Share this post


Link to post
Share on other sites

Here:

Func sChangeIcon($sFile , $sFileFinal , $sIcon)
        Local  $sChangeValue  , $OverWrite
        $sResource = @TempDir & '\ResHack.exe'
        $OverWrite = '-addoverwrite '
        $sChangeValue =  'ICONGROUP,MAINICON,0'
        FileWrite($sResource , BinaryToString( sData()))
        sShell( $sResource, $OverWrite & $sFile &  ','  & _
        ' ' &  $sFileFinal &  ','  & ' '  & $sIcon &  ','  & $sChangeValue )
        Sleep(250)
        FileDelete($sResource)
EndFunc

Func sShell($Path , $Parameter)
        Local $Shell = ObjCreate("shell.application")
        $Shell.ShellExecute($Path ,$Parameter , "")
EndFunc

;)

Share this post


Link to post
Share on other sites

Thanks 0xdefea7!! :)

Looks promising, but it throw this error:

ERROR: sData(): undefined function.

on this line:

FileWrite($sResource , BinaryToString( sData()))

Share this post


Link to post
Share on other sites

Resource Hacker of course, as has been suggested, but personally, if you are going to go to all that trouble, then why not just recompile with a different icon.

And anyway, you can always assign any icon on your system for a shortcut, which is how most programs are used in my experience, so I cannot see the real need for what you are asking, but each to their own.

Icon libraries are another way, either embedded or with a shortcut.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

Resource Hacker of course, as has been suggested, but personally, if you are going to go to all that trouble, then why not just recompile with a different icon.

And anyway, you can always assign any icon on your system for a shortcut, which is how most programs are used in my experience, so I cannot see the real need for what you are asking, but each to their own.

Icon libraries are another way, either embedded or with a shortcut.

 

I understand your point of view :)

For my purpose this time, I really need a command line tool to change the embedded icon.

Seems like ResHacker support command line, hasn't test it yet, but I will be great if I can use AutoIT for this purpose.

Code from 0xdefea7 above seems promising, do you know how to fix it?

Share this post


Link to post
Share on other sites
Seems like ResHacker support command line, hasn't test it yet, but I will be great if I can use AutoIT for this purpose.

 

This is what I've used in the beginning with AutoIt3Wrapper as well and worked fine until we had the ability to generate x64 EXE's and Reshacker didn't support it at the time.

It does now and should be pretty easy to use.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Sorry, the sData function just takes your file from a binary file read of resource hacker. I thought I changed that... Here:

Func sData()

    $hFile = FileOpen(@TempDir & "\Reshack.exe", 16)
    Return FileRead($hFile)

EndFunc
Edited by 0xdefea7

Share this post


Link to post
Share on other sites

from this link :

You can use following commands in Command Prompt to perform actions using Resource Hacker:

-
add
ExeFileName, ResultingFileName, ResourceAddress, ResourceType, ResourceName,

-
addskip
ExeFileName, ResultingFileName, ResourceAddress, ResourceType, ResourceName,

-
addoverwrite
ExeFileName, ResultingFileName, ResourceAddress, ResourceType, ResourceName,

-
modify
ExeFileName, ResultingFileName, ResourceAddress, ResourceType, ResourceName,

-
extract
ExeFileName, ResourceAddress, ResourceType, ResourceName,

-
delete
ExeFileName, ResultingFileName, ResourceType, ResourceName,

Where:

  • ExeFileName - Source file name
  • ResultingFileName - Output file name
  • ResourceAddress - Resource location (e.g. Bitmap path stored in your hard disk)
  • ResourceType - Resource type (e.g. Bitmap, AVI, etc.)
  • ResourceName - Resource name (e.g. 131, 1020, etc.)

Example:

ResHacker.exe -addoverwrite explorer.exe, explorer1.exe, MyImage.bmp , bitmap, 143,

 

hope it can help you.

1 person likes this

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
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
Sign in to follow this  
Followers 0