Jump to content

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

Embed images in compiled AutoHotkey scripts?


  • Please log in to reply
73 replies to this topic

Poll: Would you be interested in the ability to have images embeded in compiled AutoHotkey scripts? (146 member(s) have cast votes)

Would you be interested in the ability to have images embeded in compiled AutoHotkey scripts?

  1. Voted Yes (183 votes [99.46%])

    Percentage of vote: 99.46%

  2. No (1 votes [0.54%])

    Percentage of vote: 0.54%

Vote Guests cannot vote
corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004
Would you be interested in the ability to have images embedded in compiled AutoHotkey scripts instead of having to include the images separately when distributing the compiled .exe file?

Edit: typo

AGermanUser
  • Members
  • 82 posts
  • Last active: Apr 07 2010 06:06 PM
  • Joined: 12 Feb 2005
Thumbs up.

I'm surprised that so many people are interested in this topic. ;) :mrgreen:

btw. fantastic poll

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
Why just images? It might even be easier if AutoHotkey had an embedded resource file to store strings, icons, and possibly other files including images.

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

Why just images? It might even be easier if AutoHotkey had an embedded resource file to store strings, icons, and possibly other files including images.

Agreed, but I figured I'd get a "would probably only apply to less than 1%" answer to that request ;) .

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

Thumbs up.

I'm surprised that so many people are interested in this topic. ;) :mrgreen:

btw. fantastic poll

:D :wink: Thanks. Too bad I spelled embedded wrong... :oops:

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Yes!
Posted Image
kWo4Lk1.png

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Although I haven't experimented with it much, I believe you can already add resources of your choice by using ResHacker on the AutoHotkeySC.bin file. Then I think you could use DllCall to call functions like LoadImage() to load the resource.

Also, since resources are not one of my strong points, this might be a hard feature to implement unless someone else were to code it.

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
I don't see the point of embedding strings... Icons are just images. Cursors too. Some people may be interested by sounds too.

Chris' answer is interesting, it only ask for experimentation.
But it isn't very convenient to have to hack AutoHotkeySC.bin, you have to remember to keep a clean copy. Perhaps an option to specify the .bin to use could be useful here.

Note that compiling resources may not be obvious. At least, I have no idea how to do it! Is there some API to do it, or does one have to hack the binary file to add resources to it?
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

Note that compiling resources may not be obvious. At least, I have no idea how to do it! Is there some API to do it, or does one have to hack the binary file to add resources to it?

To compile resources you could use the Microsoft Resource Compiler (or similar) then use something like Resource Hacker to add the compiled resource(s) to the AutoHotkeySC.bin file.

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
1) I was asking how to do it with pure API, not using an external program.

2) Resource Hacker is able to compile resources, no need for Microsoft tools (mostly).
The inconvenient part is that you have to paste the resource to compile in an existing resource: you can add strings or version info to such a table, but it seems hard to create new string tables, for example.
Well, it is logical, it is more a tool to modify existing resources in existing programs. Such programs couldn't use new resources anyway.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

corrupt
  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

1) I was asking how to do it with pure API, not using an external program.

I may be wrong (since I don't know much about it) but I'm not sure it's worth the additional time and effort to build in a resource compiler. There are a few resource compilers that can do the job and that are free to distribute. Maybe ahk2exe could be modified to use a resource compiler then add the compiled resources to the final .exe...?

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
Well, the pure API solution was mostly out of curiosity, I don't advocate to use this method for AutoHotkey, indeed (lot of work for little result).

Maybe ahk2exe could be modified to use a resource compiler then add the compiled resources to the final .exe...?

Maybe one can write a script to hack AutoHotkeySC.bin before running ahk2exe (and restore it thereafter)? It would be useful to the 1% of users needing it, without having to modify ahk2exe.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

Micha
  • Members
  • 539 posts
  • Last active: Dec 31 2011 01:43 PM
  • Joined: 15 Nov 2005

Why just images? It might even be easier if AutoHotkey had an embedded resource file to store strings, icons, and possibly other files including images.


Hi,
why just resources?
If AHK is able to include a dll-file and can call function of it, we could include functions AND resources, all inside the dll.

We can enhance AHK with a dll (new functions/ methods) and we can store resources in it. We would have all opportunities.

Ciao
Micha

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
Good solution. AutoHotkey is able to include a DLL file, with FileInstall... But I believe the original topic was to have a way to have a monolithic AutoHotkey compiled script, which writes no files on the target disk.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

geeneeyes
  • Members
  • 66 posts
  • Last active: Jan 26 2012 01:02 PM
  • Joined: 24 May 2006
I would be disappointed if Chris doesnt implement embedding resources and overhauling the embedded files access & use method

the objective of compiling a script is to either
1) to be able to execute it anywhere OR
2) to make coding and resources hidden


but rather than making single script exe which contains all res
the script should make temp files for embedded resources
or something like that so it is not reverse engineered