 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
quatermass
Joined: 14 Dec 2005 Posts: 113
|
Posted: Wed Feb 15, 2006 11:50 am Post subject: incorporate my icon in the AHK .exe |
|
|
I think it would be really nice if there was a way to add any 34x34 .bmp file into the compiled AHK .exe so I can use this as my personal tray icon.
This way I'd have a nice icon of my own rather than have it as a seperate file which I've got to remember to carry with the .exe
a 34x34 24bit bmp uncompressed is only an extra 3.5K
Comments? _________________ Stuart Halliday |
|
| Back to top |
|
 |
Micha
Joined: 15 Nov 2005 Posts: 437 Location: Germany
|
Posted: Wed Feb 15, 2006 12:08 pm Post subject: |
|
|
Hi,
when compiling the AHK-script with the ahk2exe.exe, you can add your own icon: Custom icon (.ico file)
You have to convert the bmp to an icon, but when compiling it, that icon is automatically used as tryicon
Ciao
Micha |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Wed Feb 15, 2006 12:36 pm Post subject: |
|
|
Why 34x34?
I thought tray icons needed to be 16x16, althought I don't see such information in the documentation.
Even larger icons are usually 32x32, it is up to the program managing such icons to add a margin.
So, why this unusual format? _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
quatermass
Joined: 14 Dec 2005 Posts: 113
|
Posted: Wed Feb 15, 2006 1:19 pm Post subject: |
|
|
| PhiLho wrote: | Why 34x34?
So, why this unusual format? |
32 is probably the right size. I may be thinking of the RISC OS icon size.
Still, its easy to convert .bmp to .ico
You just change the file type extension. _________________ Stuart Halliday |
|
| Back to top |
|
 |
quatermass
Joined: 14 Dec 2005 Posts: 113
|
Posted: Wed Feb 15, 2006 1:23 pm Post subject: |
|
|
| Micha wrote: | Hi,
when compiling the AHK-script with the ahk2exe.exe, you can add your own icon: Custom icon (.ico file)
You have to convert the bmp to an icon, but when compiling it, that icon is automatically used as tryicon
Ciao
Micha |
Thanks.
I must have missed that info in the Help file.
Perhaps the Help file could be updated to include that info in the section about using different icons. _________________ Stuart Halliday |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Wed Feb 15, 2006 2:14 pm Post subject: |
|
|
| quatermass wrote: | Still, its easy to convert .bmp to .ico
You just change the file type extension. |
No.
Windows is able (in all cases?) to handle .bmp files as if they are .ico (lacking transparency/inverted colors), but they are different beasts, with a very different file format. For example, you can put several icon images in one icon file: different sizes, different color depth; Windows picks up the one appropriate to the needed view.
To have a real icon, you can use a graphic editor/viewer like IrfanView or XnView, a command line converter like ImageMagick or Nconvert, or an icon editor able to import BMP images.
Freeware icon editors aren't so common, I currently use SnIco Edit. It has glitches, but isn't so bad. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
Micha
Joined: 15 Nov 2005 Posts: 437 Location: Germany
|
Posted: Wed Feb 15, 2006 5:43 pm Post subject: |
|
|
| PhiLho wrote: | | quatermass wrote: | Still, its easy to convert .bmp to .ico
You just change the file type extension. |
No.
Windows is able (in all cases?) to handle .bmp files as if they are .ico (lacking transparency/inverted colors), but they are different beasts, with a very different file format. |
Hi,
you're right, that's not the solution to rename ico<->bmp.
In old Windows 3.0/3.1 it was possible, because the headers were almost the same.
After upcoming 256 color, 16 bit, 32 bit they introduced a new, bigger header and the formats are different now, slighly, but different
Ciao
Micha |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Wed Feb 15, 2006 6:47 pm Post subject: |
|
|
| Micha wrote: | you're right, that's not the solution to rename ico<->bmp.
In old Windows 3.0/3.1 it was possible, because the headers were almost the same.
After upcoming 256 color, 16 bit, 32 bit they introduced a new, bigger header and the formats are different now, slighly, but different |
Uh? This trick didn't even worked in Win16.
AFAIK, the headers of the files were always different: ICO files start with binary 01, while BMP files start with "BM".
Now, I see that the ICO file has, for each icon, a header similar to the (internal) BMP InfoHeader, so I suppose that's what you mean. But since the format supports flexible bits per pixel number, I don't think they had to change the format. But I can be wrong. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
quatermass
Joined: 14 Dec 2005 Posts: 113
|
Posted: Wed Feb 15, 2006 9:27 pm Post subject: |
|
|
| PhiLho wrote: | | Windows is able (in all cases?) to handle .bmp files as if they are .ico (lacking transparency/inverted colors), but they are different beasts, with a very different file format. |
Sure, I knew all that.
But Windows does handle one bmp as one .ico so as that is all I want I'll give it a try.
Shame that .ico is probably the one graphic file format IrfranView doesn't support!
I'll have a look at SnIco Edit
Thanks. _________________ Stuart Halliday |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Thu Feb 16, 2006 9:46 am Post subject: |
|
|
| quatermass wrote: | Sure, I knew all that.
But Windows does handle one bmp as one .ico so as that is all I want I'll give it a try. |
OK, that was the wording I wanted to clarify
No need to increase the urban legends
| quatermass wrote: | | Shame that .ico is probably the one graphic file format IrfranView doesn't support! |
IrfanView always has read the .ico format, handling multiple images unlike some other primitive viewers.
The version I have (3.97) allows to save in .ico format. Let see...
I have a 16x16x4 Gif image (a light bulb), I ask to save as .ico, I check the Save transparency option. It asks me to click on a pixel with the desired transparent color. I get a regular Ico image, Windows handling correctly transparency.
Not perfect (no multiple sizes/color depths), but still good for quick result, eg. to make a favicon. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
quatermass
Joined: 14 Dec 2005 Posts: 113
|
Posted: Thu Feb 16, 2006 1:40 pm Post subject: |
|
|
| PhiLho wrote: |
IrfanView always has read the .ico format, handling multiple images unlike some other primitive viewers.
The version I have (3.97) allows to save in .ico format. Let see...
|
I assumed it didn't as it doesn't supply an icon for a .ico file.
Thanks for correcting me. _________________ Stuart Halliday |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Thu Feb 16, 2006 4:43 pm Post subject: |
|
|
Well, that's logical, since the system is able to interpret the file to show the real icon.
On my Win98SE system, I even have a tweak that ask the system to display a miniature of BMP files. It is not activated on my WinXP, probably because we have the miniature view, plus this is slow on CD-Rom or network folder... _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
furynick
Joined: 03 Jan 2008 Posts: 4
|
Posted: Thu Jan 03, 2008 1:47 pm Post subject: |
|
|
Hi,
I'm also searching a way to append icon resources to compiled AHK scripts.
I've tried out ResHacker and XN Resource Editor without success as it seems to corrupt the exe file (no more script running afterwards).
I use IcoFX to make a 16x16x8 icon and use this code (from this forum and help file) to load the icon into an ImageList :
| Code: | ImageListID := IL_Create(1)
If (A_IsCompiled)
{
MsgBox, LoadFromExe
hBin:=DllCall("LoadLibrary", Str, A_ScriptFullPath)
; Returns handle of image
hIcon:=DllCall("LoadImage"
, "uInt", hBin ; hinst - Handle of modual, if 0 load stand alone resource
, "uInt", 230 ; lpszName - Image resource in modual
, "uInt", 2 ; uType - 0=bitmap, 1=cursor, 2=icon
, "Int", 0 ; cxDesired - Width of image, if 0 use actual size
, "Int", 0 ; cyDesired - Height of image, if 0 use actual size
, "uInt", 0x8000) ; fuLoad - 0x8000=LR_SHARED
ID := DllCall("ImageList_ReplaceIcon", "uint", ImageListID, "int", -1, "uint", hIcon)
MsgBox, %ID%
}
Else
IL_Add(ImageListID, "key.ico")
LV_SetImageList(ImageListID)
|
The exe don't run, no msgbox,
where am I wrong ?
Thanks for help. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6772 Location: Pacific Northwest, US
|
Posted: Fri Jan 04, 2008 4:56 am Post subject: |
|
|
you have to edit the resources of AutohotkeySC.bin before you compile the script.
Have you seen the helper scripts for compiling? they already allow you to change most options. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
furynick
Joined: 03 Jan 2008 Posts: 4
|
Posted: Fri Jan 04, 2008 1:54 pm Post subject: |
|
|
I saw these helpers but I've not seen the ability to add others resources.
It works with the update of AutohotkeySC.bin,
Thanks a lot. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|