Upcoming Ahk2Exe Changes (2019)

Post your working scripts, libraries and tools
TAC109
Posts: 548
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2019)

20 Oct 2019, 23:08

@joedf @JoeWinograd
It’s possible that the extra icons can be replaced using the existing facilities in the beta (using 'AddResource'). That will simplify everything. If it works I will document this facility in the help.

I’ll look into it tomorrow NZ time!
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
TAC109
Posts: 548
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2019)

21 Oct 2019, 17:50

@@joedf @@JoeWinograd

Ok, here are the compiler directive details to replace the other icons in the generated .exe:

Code: Select all

;@Ahk2Exe-AddResource Icon.ico, 160    ; Replaces 'H' on blue
;@Ahk2Exe-AddResource Icon.ico, 206    ; Replaces 'S' on green
;@Ahk2Exe-AddResource Icon.ico, 207    ; Replaces 'H' on red
;@Ahk2Exe-AddResource Icon.ico, 208    ; Replaces 'S' on red
This will work using the current beta.

As I said before, I'll document this facility in the help.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
User avatar
joedf
Posts: 7695
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: Upcoming Ahk2Exe Changes (2019)

21 Oct 2019, 18:07

Very nice! :+1:
Maybe go one step further and have something like a macro
AhkIcon0 AhkIcon...
Or maybe thats too much... :b
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
TAC109
Posts: 548
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2019)

21 Oct 2019, 18:15

Macro? Not sure what you’re getting at here?
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
User avatar
JoeWinograd
Posts: 1537
Joined: 10 Feb 2014, 20:00

Re: Upcoming Ahk2Exe Changes (2019)

21 Oct 2019, 22:56

here are the compiler directive details to replace the other icons in the generated .exe
Perfect! I don't need anything more than that...works a charm! Thanks for figuring that out.

However, there's a problem when selecting UPX compression. It works fine with no compression and with MPRESS. But with UPX, ResourceHacker shows only Group 159 in the EXE, and after creating a shortcut to the EXE and doing Properties>Change Icon on the shortcut, it displays a Change Icon dialog box that says this:

The file FileName.exe contains no icons.
Choose an icon from the list or specify a different file.


But I don't think that this is a bug in your code...I think it is a bug in UPX, because the same thing happens after compiling with no compression and then doing the UPX compression manually. Btw, I'm using the latest UPX (v3.95, 26-Aug-2018). Regards, Joe
lexikos
Posts: 6963
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Upcoming Ahk2Exe Changes (2019)

21 Oct 2019, 23:20

I would think that's a feature, not a bug, assuming the resources can be loaded by the program itself. The main icon wouldn't be compressed because explorer needs to be able to load it. There's probably a command line switch to prevent compression of resources, but unless it applies specifically to icons, it would also prevent compression of the script text.
User avatar
JoeWinograd
Posts: 1537
Joined: 10 Feb 2014, 20:00

Re: Upcoming Ahk2Exe Changes (2019)

21 Oct 2019, 23:39

I would think that's a feature, not a bug...
Interesting point, but if the main icon is not compressed, why doesn't Properties>Change Icon on the shortcut file find it?
TAC109
Posts: 548
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2019)

21 Oct 2019, 23:52

I’ll look into this tomorrow, @JoeWinograd
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
User avatar
JoeWinograd
Posts: 1537
Joined: 10 Feb 2014, 20:00

Re: Upcoming Ahk2Exe Changes (2019)

22 Oct 2019, 00:01

Thanks, TAC! Cheers, Joe
User avatar
joedf
Posts: 7695
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: Upcoming Ahk2Exe Changes (2019)

22 Oct 2019, 00:04

TAC109 wrote:
21 Oct 2019, 18:15
Macro? Not sure what you’re getting at here?
My bad, I was thinking "C Preprocessor -> Macros"-like... but I realize it was out of context ahah :mrgreen:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
TAC109
Posts: 548
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2019)

22 Oct 2019, 00:14

@JoeWinograd
You could try adding the switch --compress-icons=0 to your externally run UPX job. (You may also use the switches -q --all-methods which are used by Ahk2Exe.)

Let me know how it works out.
Cheers
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
TAC109
Posts: 548
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2019)

22 Oct 2019, 00:25

Note:
With UPX (unlike Mpress) it is trivial to decompress a UPX packed executable; simply run UPX on it with the -d switch.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
User avatar
Drugwash
Posts: 751
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania

Re: Upcoming Ahk2Exe Changes (2019)

22 Oct 2019, 02:13

Compression is not necessarily used for code/resources obfuscation - it saves bandwidth and/or storage space, especially when there are many files to transfer/store and bandwidth is limited or free space is scarce.

What compression level is being used by the compiler for UPX? There are five levels available AFAIK. Dunno the difference between them but it may (or may not) have something to do with the compression of icons discussed above.

In my tests compressed executables (both UPX and MPRESS) appear as corrupted under my Linux Mint so I can't perform any related checks.
I've deleted my CloudMe account because of GDPR - the now legal base for privacy invasion and data theft.
TAC109
Posts: 548
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2019)

22 Oct 2019, 04:10

@Drugwash
UPX parameters are -q --all-methods as mentioned above. No level is used. I have found that the parameters I have used give the best compression for only a little extra elapsed time.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
User avatar
JoeWinograd
Posts: 1537
Joined: 10 Feb 2014, 20:00

Re: Upcoming Ahk2Exe Changes (2019)

22 Oct 2019, 11:09

TAC109 wrote:Let me know how it works out.
Thanks for the explanation of the UPX switches (especially -d, which I was not aware of), but I haven't tried them, as I decided to stick with MPRESS, which I've been using for a long time and is working well with AddResource (for the icons) in Beta_7.

Speaking of MPRESS and UPX, I'll make one more pitch for changing the UI to a drop-down, although I realize you said that the checkbox is your preferred method of implementing this feature. In my case, I clicked the box expecting an on-off check mark with the text showing what was on or off, i.e., MPRESS, UPX, or no compression. But I (admittedly, soon) figured out that the UI is a check mark in the box when the text is MPRESS (if present), a blue square in the box when the text is UPX (if present), and nothing in the box when the text is (none). I believe that the far more conventional (and obvious) approach is a drop-down, exactly like the Base File drop-down above it. Of course, the choice is yours, and whichever way you go, I truly appreciate your effort on these enhancements.
Drugwash wrote:Compression is not necessarily used for code/resources obfuscation - it saves bandwidth and/or storage space, especially when there are many files to transfer/store and bandwidth is limited or free space is scarce.
True enough, although my primary purpose is code obfuscation, limited though it be, as I know that there are MPRESS crackers out there, so it isn't going to stop all the bad actors, but it's better than nothing.

Regards, Joe
User avatar
Drugwash
Posts: 751
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania

Re: Upcoming Ahk2Exe Changes (2019)

23 Oct 2019, 04:31

TAC109 wrote:
22 Oct 2019, 04:10
@Drugwash
UPX parameters are -q --all-methods as mentioned above. No level is used. I have found that the parameters I have used give the best compression for only a little extra elapsed time.
Ah, OK, thank you.
JoeWinograd wrote:
22 Oct 2019, 11:09
True enough, although my primary purpose is code obfuscation [...]
Obviously compression can be used for any available purpose, including mixed ones. :)

The checkbox type you're mentioning is a special tri-state one. Technically it's a nice gimmick but indeed it can be less intuitive for those unaccustomed to it. Additionally I noticed that in my Linux Mint, when theming is enabled in Wine, the tri-state checkbox does not properly show the third state - only the changed text offers a hint of its state. So from this point of view I could agree with your request to have it changed to a dropdown list. But I guess the developer also has the right to stick to his choice. So in the end we all may either accept developer's choice(s) or fork the script locally and modify it to our own liking. That's the beauty of open-source, and then we could all be happy. ;)
I've deleted my CloudMe account because of GDPR - the now legal base for privacy invasion and data theft.
User avatar
JoeWinograd
Posts: 1537
Joined: 10 Feb 2014, 20:00

Re: Upcoming Ahk2Exe Changes (2019)

23 Oct 2019, 12:18

Hi Drugwash,
Thanks for the "tri-state checkbox" terminology...hadn't heard that one. I don't recollect ever seeing any in programs that I use, but I guess it's possible, because you don't know that it's a tri-state checkbox unless you click on it...or the doc discusses it...and, in the latter case, you've read it. :) I see that as a big advantage of the drop-down...you immediately know that other choices are available (and, of course, radio buttons, where all the choices are always exposed). Regards, Joe
User avatar
JoeWinograd
Posts: 1537
Joined: 10 Feb 2014, 20:00

Re: Upcoming Ahk2Exe Changes (2019)

23 Oct 2019, 19:10

Hi TAC,
I don't know if these are bugs, but here are two issues that I ran into today:

(1) If you compile the same file twice with the Beta_7 GUI while specifying a custom icon, the EXEs created are not identical. With the released Ahk2Exe GUI, they are indentical. Two interesting points on this: (a) with the Beta_7 CLI, they are indentical; (b) with the default icon, they are identical with the GUI. I would normally provide a script that shows the issue, but I'm sure you can reproduce it there, as it happens with a one-line MsgBox script and any custom icon.

(2) The Browse-to files (Source, Destination, Custom Icon) are not sticky in the Beta_7 GUI. They are in the released Ahk2Exe GUI. Again, I'm sure you can reproduce it there easily.

Regards, Joe
TAC109
Posts: 548
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2019)

23 Oct 2019, 19:26

@JoeWinograd
Thanks, I’ll check it out.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
TAC109
Posts: 548
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Upcoming Ahk2Exe Changes (2019)

23 Oct 2019, 21:51

@JoeWinograd
Joe, I cannot reproduce your point 1. Compiling using the GUI without reloading between compiles gives identical .exe's here. I used the same icon both times.

Your point 2. The path and name of the custom icon sticks here, between successive loads of the GUI and also successive runs of the GUI.

With the source parameter, only the path should remembered between successive loads, and my tests confirm that this happens.

I’ll need to look further at the destination parameter as it doesn’t seem to stick in an expected way. (I noticed this problem with the standard Ahk2Exe also.) Additionally, I think this needs a 'Default' button.

Could you double-check your results, please. If there are still problems I’ll need more detail.
Thanks
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Pyonkichi, tomjtoth and 20 guests