I'm searching for the right workflow to do this:
I have:
- an AHK file
- usage of Icons like "Menu, Tray, Icon, Pdf.ico" and "SB_SetIcon("pdf16.ico",,1)"
- the needed ICO-files in the same folder
-> it works fine
I want to:
- compile the script
- use the "new" AHK2EXE (http://ahkscript.org/boards/viewtopic.php?f=24&t=521)
- embed the ICO into the EXE to get a single file
I need to now:
- how to integrate the ICO in the EXE. ICO is not yet supported by the compiler, but BMP and DIB. And DLL (??? never made it) and SCR (Scrennsaver?)
- how to call it from the AHK-code?
Thanks in advance
Use Icons in compiled scripts
Use Icons in compiled scripts
Peter (AHK Beginner) / Win 10 x64, AHK Version v1.1.33
Re: Use Icons in compiled scripts
You can http://ahkscript.org/docs/commands/FileInstall.htm to include the icon in your exe so when the exe is run the ICO is extracted and you can use it.
Re: Use Icons in compiled scripts
Thanks
Yes, "Fileinstall" is the perfect way for another idea and a 90%-perfect way for this topic (it works, but it creates files).
If someone can solve the other 10% (the real integration into the EXE) it would be great.
Yes, "Fileinstall" is the perfect way for another idea and a 90%-perfect way for this topic (it works, but it creates files).
If someone can solve the other 10% (the real integration into the EXE) it would be great.
Peter (AHK Beginner) / Win 10 x64, AHK Version v1.1.33
Re: Use Icons in compiled scripts
in my opinion 'FileInstall' works well, but is not exactly what I wanted. I think the issue is, how to use the files (.bmp, .png, etc.) included in the .exe file. and, moreover, will have to wait for a new update of the 'new' AHK2EXE.
Re: Use Icons in compiled scripts
if you want to get dirty with some work aroundsssssss, not one around
it's a stretch, but AHK has the ability to read icons from executable files, so why not itself also
so:
- read untill the end..
- compile your script as normal, with no InstallFile for the icons
- use reshacker, from the GUI or using CLI I prefer the latter (since you can do it all in one script and RunWait the commands one after another, nice workflow as far as I'm concern)
- add the icon to your EXE file (Icon group) (keep in mind the file already has the 8 AHK default icons, you can replace them or add your new icon at the end, either case pay attention to the icon number, either 1,2... or 9,10...)
- this is the first step I left it last, just to get the picture, Now the path to your icon is the path of your EXE which is A_ScriptFullPath
after all said and done this
will change the tray icon to the icon you added using the ResHacker
I tried it and i worked fine for me, so afaik it should work nicely for you too
one more thing: thank you for making me think a little about that, since I had no use for it, I didn't think of it.
don't know about the new Ahk2Exe, hope it would simplify things for you
it's a stretch, but AHK has the ability to read icons from executable files, so why not itself also
so:
- read untill the end..
- compile your script as normal, with no InstallFile for the icons
- use reshacker, from the GUI or using CLI I prefer the latter (since you can do it all in one script and RunWait the commands one after another, nice workflow as far as I'm concern)
- add the icon to your EXE file (Icon group) (keep in mind the file already has the 8 AHK default icons, you can replace them or add your new icon at the end, either case pay attention to the icon number, either 1,2... or 9,10...)
- this is the first step I left it last, just to get the picture, Now the path to your icon is the path of your EXE which is A_ScriptFullPath
after all said and done this
Code: Select all
Menu, Tray, Icon, %A_ScriptFullPath%, 9
I tried it and i worked fine for me, so afaik it should work nicely for you too
one more thing: thank you for making me think a little about that, since I had no use for it, I didn't think of it.
don't know about the new Ahk2Exe, hope it would simplify things for you
Re: Use Icons in compiled scripts
At first I thought that the usage of Ressourcehacker is a lot of work which has to be repeated always when I compile the exe again, but the following process should work automated:
- Use the ;@AHK2Exe-Postexec directive
-- which calls a batch file
--- which contains command-line command for Ressourcehacker
---- which adds the Icons you created before.
I will see.
Peter
- Use the ;@AHK2Exe-Postexec directive
-- which calls a batch file
--- which contains command-line command for Ressourcehacker
---- which adds the Icons you created before.
I will see.
Peter
Peter (AHK Beginner) / Win 10 x64, AHK Version v1.1.33
Re: Use Icons in compiled scripts
you don't need batch file, call the commands using runwait
the commands in the patch can be called directly
even the compilong process can be done from commend line without the GUI
when I'll have some time I may try and post the script once I'm done
it's simple, just go step by step. good luck
the commands in the patch can be called directly
even the compilong process can be done from commend line without the GUI
when I'll have some time I may try and post the script once I'm done
it's simple, just go step by step. good luck
Re: Use Icons in compiled scripts
But using RunWait inside the code is not invoked after compiling. At first I have to compile, then I have to add the icon ...MJs wrote:you don't need batch file, call the commands using runwait...
Peter (AHK Beginner) / Win 10 x64, AHK Version v1.1.33
Re: Use Icons in compiled scripts
use another script, seperated, to compile using ahk2exe command line params, you'll find example in docs file, and then add icons using the commands from reshacker
but the key is your original script that has to have the numbers right like the icon 9 in my example
#persistant
Menu, Tray, Icon, %A_ScriptFullPath%, 9
use just these two line for testing
but the key is your original script that has to have the numbers right like the icon 9 in my example
#persistant
Menu, Tray, Icon, %A_ScriptFullPath%, 9
use just these two line for testing
Re: Use Icons in compiled scripts
Yes, that's exactly want I do with the batch which is started from the compiling programMJs wrote:...and then add icons using the commands from reshacker...
Yes. I use numbers for names of the icongroups starting with 300, because the highest number (=name) of the AHK-compiler-icons is 230. (Of course other numbers or names are possible, but I decided for me to not disturb the original order)MJs wrote:... but the key is your original script that has to have the numbers right like the icon 9 in my example...
Peter (AHK Beginner) / Win 10 x64, AHK Version v1.1.33
Re: Use Icons in compiled scripts
ok, if that works and in your work flow then use it
is it solved then?
is it solved then?
Re: Use Icons in compiled scripts
I would say: 99% yes. 1% would be the full integration into AHK2Exe.MJs wrote:...is it solved then?
Thanks and have a fine Sunday.
Peter (AHK Beginner) / Win 10 x64, AHK Version v1.1.33
Re: Use Icons in compiled scripts
you too.
I hope you'll have that missing 1% soon.
I hope you'll have that missing 1% soon.
Re: Use Icons in compiled scripts
Old post, I know, but...could you perhaps use a FileInstall command at a point in the program that is never reached? Then the compiler will add the file into the .exe, but it will never be extracted when the .exe is run. You can then get the icon data as described above. Haven't tested this idea, but it should work, I think.