Jump to content

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

Upcoming Ahk2Exe changes


  • This topic is locked This topic is locked
78 replies to this topic
Pinkfloydd
  • Members
  • 75 posts
  • Last active: May 31 2019 02:43 AM
  • Joined: 01 Jul 2012

Thanks!, it works!

 

Next could you add a resource for chaning the "CompanyName" if it is possible?



RHCP
  • Members
  • 1228 posts
  • Last active: Apr 08 2017 06:17 PM
  • Joined: 29 May 2006

With AHK_H, I like placing large thread files inside the RCData folder using

 Fileinstall, BigThread.ahk, Dont Install

Then I use this to extract the  BigThread.ahk as string

LoadScriptString(scriptResource)
{
    lib := DllCall("GetModuleHandle", "ptr", 0, "ptr")
    res := DllCall("FindResource", "ptr", lib, "str", scriptResource, "ptr", Type := 10, "ptr")
    DataSize := DllCall("SizeofResource", "ptr", lib, "ptr", res, "uint")
    hresdata := DllCall("LoadResource", "ptr", lib, "ptr", res, "ptr")
    if (data := DllCall("LockResource", "ptr", hresdata, "ptr"))
        return StrGet(data, DataSize, "UTF-8")    ; Retrieve text, assuming UTF-8 encoding.
    else return 0 

}

which can be then used with ahktextdll() to launch the thread.

 

It would be really helpful if you could force Ahk2Exe to parse BigThread.ahk and automatically includes any of the #includes AND any referenced function contained in the library folder.

 

I realise few people would find this useful, but there's no harm in asking :)

 

 

 

 

 



JnLLnd
  • Members
  • 193 posts
  • Last active: Jul 23 2015 02:15 AM
  • Joined: 30 Dec 2007
Thank you fincs for these welcomed additions.

Should it be possible to use variables in the -SetProp directives? I tried this and it does not work:
 
var := "My Description"
;@Ahk2Exe-SetDescription %var%
With this code, the property is set as "%var%".

Visioneer
  • Members
  • 287 posts
  • Last active: Sep 17 2017 10:07 PM
  • Joined: 19 Nov 2007

Great job fincs, Thanks.

 

I have a few questions.

 

First, Is it safe to use this for new product rollouts yet.?

If not, when, how, will we know? It could be well before the new version gets "official" and is

included in a future release. 

 

We had some trouble with Avast recently with iWB2 Learner.exe believe it or not.

(fixed now) But I have since become sensitive to AV false positive issues.

 

 

Second, Can you explain more about having different entries for the File Version and the Product

Version. They can be totally different entries in the field.

 

I tried this,

;@Ahk2Exe-SetVersion 3.0`,3.5 

and I got this: 3.0.3.5  for both File and Product.

 

Why not treat them as 2 different things?

 

Here is a link I found that explains the difference between Product Version and File Version pretty well.

Note that the two entries are completely different from each other.

http://bojan-komazec...ct-version.html

 

 

Third, I have used Resource Hacker over the past many years, to set the icons, and file info.

With the latest version I use, v1.1.13.00 Unicode, I am finding that there is a problem

with the "try" statement (in the compiled version only) if I use my doctored AutoHotkeySC.bin.

You might never notice it if you didn't use "try", but the compiled exe file won't run past the

first "try" statement encountered. I even tried making only a few changes to the bin file, but

the problem still occurs. It also happens in your new Ahk2Exe.exe.

 

With your new compiler program, I won't have to use a doctored bin file, and I won't

waste all that time hacking the bin's, and that will be a blessing. But still, where there is

smoke, there is fire. I think you should look into if there is a bug in the compiler. It is very

strange the EVERTHING else I have tried in the compiled files work, but just the "try"

statement crashes. Just this, crashes the executable:

try
{
soundbeep
}

Forth, (and lastly thank God). I use the Resource Hacker to replace every case of the H icons

with our own. So, our Msgbox's all have our icons displayed at the top left. But with using the

Ahk2Exe method of including the icon just once in the GUI (which is a pleasure of course), 

the Msgbox's have a little square thing at the top left. Better than the H, but not as good as

our own icons. Can you make the single icon call more pervasive throughout the executable?

 

Thanks again. I hope I have been a small help to your wonderful endeavor.



fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007

Next could you add a resource for chaning the "CompanyName" if it is possible?

Will be added.

It would be really helpful if you could force Ahk2Exe to parse BigThread.ahk and automatically includes any of the #includes AND any referenced function contained in the library folder.

That behaviour would be very counter-intuitive and it would break backwards compatibility, so that's a no-no.

Should it be possible to use variables in the -SetProp directives? I tried this and it does not work:

This is impossible to implement because the code is NOT executed when it is to be compiled (the same thing happens with FileInstall).

First, Is it safe to use this for new product rollouts yet.

This is beta software and standard rules apply, however if you don't notice any problem then you can use it.

Why not treat them as 2 different things?

I don't think many people would want to set them to 2 different things, so for simplicity and ease of use I made it so that the 'Version' field changes both the File and Product version fields. If there's enough demand I will change it.

But still, where there is smoke, there is fire. I think you should look into if there is a bug in the compiler.

This 'bug' is completely unrelated to the compiler, as it does not do anything related to that. If you are using MPRESS beware that certain versions produce executables that crash on Windows 8 and later.

Can you make the single icon call more pervasive throughout the executable?

I know the cause of this and will tweak the compiler to bypass the normal icon changing mechanism (>AHK WITH ICON< vs >AUTOHOTKEY SCRIPT<) so that the EXE icon can be independent from the tray/window icons.

Visioneer
  • Members
  • 287 posts
  • Last active: Sep 17 2017 10:07 PM
  • Joined: 19 Nov 2007

Hi fincs,

1 - Can I get an email when it is "ready"?

 

2- I like simple. I spent a long time trying to see what differences I could make between File Version and Product Version.

Maybe mention that better in the current Doc to simplify this. There is not some unwritten rule that they must be almost the

same as each other, or a by product or each other.

 

3a-This "bug" does exist?  It happens with or without Mpress. In the current Ahk2Exe included with v1.1.13.00 Unicode and

your new preview 6 beta. Does anyone else find that editing the AutoHotkeySC.bin file with Resource Hacker,

File Version 3.4.0.79, Product Version 3.0.0.0, used with the lastest Ahk2Exe version, produce a "try" problem in the compiled version,

but not the uncompiled version? Maybe I should get a later/Unicode version of Resource Hacker?

 

3b- WHAT? I am so glad I spoke to you fincs. You are really in the know. So MPRESS may not work? Certainly W8+ is the

main prize in new product rollouts. Is there any version of MPRESS that would work? Anyone have phone#/contact info

for MPRESS? I notice their MPRESS GUI v0.2 (by DonDD) link is probably a highjacked ad for iLivid. WOW, should there

not be an anouncement that MPRESS can be a problem with W8+?

 

4-

so that the EXE icon can be independent from the tray/window icons.

        

 I want all the icons for MsgBox, Forms, Tray etc. to be my icon. Is that what you are saying will happen?

Especially since it seems that I may have to abandon my time tested practice of using Resource

Hacker to change all those icons because of this "try" bug thing which remains unresolved.

 

Thanks



Visioneer
  • Members
  • 287 posts
  • Last active: Sep 17 2017 10:07 PM
  • Joined: 19 Nov 2007

Hi fincs,

 

I solved the 'try" bug. I upgraded my Resource Hacker to the latest (last): File Version 3.6.0.92,  Product Version 3.0.0.0

Maybe the Unicode needed the update. Anyway it works great now.

 

I choose to update all the resource icons in Resource Hacker as I was not sure what you meant by "independant" and they

will seldom, if ever, change anyway.

 

The way I see it, once Resouce Hacker is working, the main improvement you can provide with the new Ahk2Exe is the

quick changing of the File Version. Even the Product Version can change very seldom, but the File Version could be

changed very very often, especially if I can just change it in the .ahk source file.

 

I happen to put a Version var in my program, which I actually display in my icon tray menu, to expedite user troubleshooting.

I would love to synchronize that number I am displaying with the actual File Version in the compiled exe file.

So I would eliminate my version var, and instead declare it with your Ahk2Exe directive. Then to show the Version in my

icon tray menu, I would simply read the File Version from the exe file. Would I be correct in assuming that the ahk command

"FileGetVersion" would get the File Version, not the Product version. How would one get both versions anyway?

 

So could you please tell me how your current Version directive could let me have say:

 

Product Version be 3.0 and File Version be 3.0,0.24  ie: the 24th build of the 3rd major product version 3.0

So, I guess you will say use: ;@Ahk2Exe-SetVersion 3.0.0.24 and just make them both that?

I guess even that is a wondeful improvement. For me anyway.

 

So the only thing that has me worried is the MPRESS thing you mentioned. Please follow up on that.

Which MPRESS version(s) would work on W8+? 

BTW: jethrow said he does not use Mpress on files he distributes in his office, for fear of getting flagged by folks

like Avast. (false positives).

 

Thanks



Visioneer
  • Members
  • 287 posts
  • Last active: Sep 17 2017 10:07 PM
  • Joined: 19 Nov 2007

Hi fincs,

 

Sorry to bother you again, after all my work to get Resource Hacker working, I find that my icon

is not being displayed in MsgBoxes. For example, I always use the 4096 variant for Msgboxes

which should show my icon. I could use a 262144 variant which shows no icon. (Any other varant

makes it too easy for the MsgBoxes to get hidden behind other windows)

What is displayed is a little square thing, but not my icon. I edited EVERY SINGLE icon in the

Resource Hacker to have my icon.

 

;MsgBox, 4096,, myVersion is: %myVersion%,   ;This always showed my icon in the past.
;MsgBox, 262144,, myVersion is: %myVersion%     This would not show any icon BTW, so at least would look professional.

 

So does your New Ahk2Exe.exe and v1.1.13.00 Unicode Ahk2Exe.exe override any AutoHotkeySC.bin icon settings after all?

 

I tried all the combinations I could think of. With and Without the Custom icon setting being used. Putting my .ico file right in the

/Compiler folder and selecting that. With and Without Mpress.

 

There is no secure compiling anyway, so is it necessary to disallow some custom icons as well?

Can you please at least allow the AutoHotkeySC.bin icon settings to survive compiling?

I would hope that the single icon call would be able to make "Everything" custom icon-ed, but if it

can't, maybe there could be directives to specify what exactly happens to resource icons.

 

On the plus side, I noticed that my GUI forms do show my icon. :D

 

What are all the things in ahk that can/should show icons?  I have the Program Icon, the menu Tray icon,

Gui forms, and the Msgboxes.

Anything else?

 

Maybe there is something I am missing in Resource Hacker?

 

Thanks



RHCP
  • Members
  • 1228 posts
  • Last active: Apr 08 2017 06:17 PM
  • Joined: 29 May 2006

It seems Ahk2Exe ignores the fileinstall command if it is on the same line as a try statement (the file isn't included in the exe).

try fileinstall, cat.png, %A_Temp%\cat.png, 1


dmg
  • Members
  • 2395 posts
  • Last active: Nov 04 2015 06:46 AM
  • Joined: 19 Nov 2010

I love the promise of an updated and enhanced compiler. One thing I have wanted for a long time is the ability to add icons to an executable and be able to use them in the script in guis, etc. I can do this in a limited way by hacking the exe and replacing the standard icons, but it limits the number and icon size.


"My dear Mr Gyrth, I am never more serious than when I am joking."
~Albert Campion

-----------------------------------------------------------------------------------------------
Website | Demo scripts | Blog | External contact

joedf
  • Administrators
  • 986 posts
  • AutoHotkey Foundation
  • Last active: Nov 02 2019 08:38 PM
  • Joined: 20 May 2012

I think there's also possible is to do a fileinstall, but put it in a label that will never be reached,

then try to self-ref your exe, to display it...

this has probably already been done...


Why ahkscript.org? - autohotkey.com is outdated

dmg
  • Members
  • 2395 posts
  • Last active: Nov 04 2015 06:46 AM
  • Joined: 19 Nov 2010

A nice thought joedf, but I am afraid it does not work that way. Files included using FileInstall can't be accessed in the compiled script, at least not easily.


"My dear Mr Gyrth, I am never more serious than when I am joking."
~Albert Campion

-----------------------------------------------------------------------------------------------
Website | Demo scripts | Blog | External contact

joedf
  • Administrators
  • 986 posts
  • AutoHotkey Foundation
  • Last active: Nov 02 2019 08:38 PM
  • Joined: 20 May 2012

i know its not easy.... :( but thats why i said... "try" :)


Why ahkscript.org? - autohotkey.com is outdated

Daniel Beardsmore
  • Members
  • 3 posts
  • Last active: Jul 20 2016 08:03 PM
  • Joined: 06 Dec 2013

Icon bug

 

I've found a rather bad doozy. Right-click any script and select "Compile":


Error changing icon: Unable to read icon or icon was of the wrong format.
 

Error doing what? I'm not changing any icon. What icon? What format? Where? Eh?

 

I had to track this down with Process Monitor. There's a Registry value "LastIcon" in HKEY_CURRENT_USER\Software\AutoHotkey\Ahk2Exe, and if the program cannot find the file specified at this location, compile fails with a cryptic error message.

 

The compiler should assume that all of the Last* paths are volatile and fail gracefully if they no longer exist.

 

Setting a program icon

 

It would be nice to be able to do this:

 

;@Ahk2Exe-CompileIcon NameOfIcon.ico
;@Ahk2Exe-CompilePreExec Clean.ahk

 

That way, right-click → Compile might actually be useful for something!

 

(I've gone with "Compile*" instead of "Set*" to differentiate it as a compile directive from a VERSIONINFO directive)

 

Sharing details between the runtime and EXE

 

I also concur that it would be really useful to find some way to have the same product information (name, version etc) available in the VERSIONINFO and in the script at runtime. Ideally, a) the runtime itself would gain constants (I am staggered beyond belief that these are still unimplemented), and B) there would be a special type of constant definition that the compiler could read, e.g.

 

Constant *compile EXE_PRODUCT_VERSION 1.0.0

 

The use of *compile would allow ahk2exe to be aware that it needs to read the rest of the line. VERSIONINFO would use this when the script is compiled, but it would also be available as a normal constant that you could use, e.g.

 

Gui, Add, Text, , Version %EXE_PRODUCT_VERSION%, %EXE_PRODUCT_COPYRIGHT%



joedf
  • Administrators
  • 986 posts
  • AutoHotkey Foundation
  • Last active: Nov 02 2019 08:38 PM
  • Joined: 20 May 2012
Interesting idea! Also, cool formatting! :D
Why ahkscript.org? - autohotkey.com is outdated