Upcoming Ahk2Exe changes

Community news and information about new or upcoming versions of AutoHotkey
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Upcoming Ahk2Exe changes

04 Jun 2015, 13:13

Theoretically, any type can be included. Those are just the officially supported ones. ;)

Still waiting on the release with ahk :)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Skrell
Posts: 302
Joined: 23 Jan 2014, 12:05

Re: Upcoming Ahk2Exe changes

05 Jun 2015, 07:42

Is that expected to happen with the official release?
User avatar
haichen
Posts: 631
Joined: 09 Feb 2014, 08:24

Re: Upcoming Ahk2Exe changes

13 Jul 2015, 08:20

Cant compile ahk2exe edge with v1.1.22.03 on win7 x64.
Worked before.

Ahk2Exe Error
---------------------------
Error changing icon: Unable to read icon or icon was of the wrong format.
Peter2
Posts: 325
Joined: 21 Sep 2014, 14:38
Location: CH

Re: Upcoming Ahk2Exe changes

13 Jul 2015, 08:52

The mentioned icon is OK? Right format, right name, no access problems? Tried reboot of PC?
Peter (AHK Beginner) / Win 10 x64, AHK Version v1.1.33
Skrell
Posts: 302
Joined: 23 Jan 2014, 12:05

Re: Upcoming Ahk2Exe changes

13 Jul 2015, 10:13

haichen wrote:Cant compile ahk2exe edge with v1.1.22.03 on win7 x64.
Worked before.

Ahk2Exe Error
---------------------------
Error changing icon: Unable to read icon or icon was of the wrong format.
I'm confused...why are you trying to compile ahk2exe....isn't it already an executable ?
User avatar
haichen
Posts: 631
Joined: 09 Feb 2014, 08:24

Re: Upcoming Ahk2Exe changes

13 Jul 2015, 12:44

Sorry, I mean compiling the source ahk2exe.ahk to ahk2exe.exe
Works without problems at home with my old win8.1 x32 pc. Doesn't compile at my work pc. I've done this with all prior ahk versions. So I thought to inform finc.
Skrell
Posts: 302
Joined: 23 Jan 2014, 12:05

Re: Upcoming Ahk2Exe changes

13 Jul 2015, 14:49

haichen wrote:Sorry, I mean compiling the source ahk2exe.ahk to ahk2exe.exe
Works without problems at home with my old win8.1 x32 pc. Doesn't compile at my work pc. I've done this with all prior ahk versions. So I thought to inform finc.
Are you compiling the source code for the ahk2exe so that it'll have the latest updates/improvements and fixes that 1.1.22.03 provide?
User avatar
haichen
Posts: 631
Joined: 09 Feb 2014, 08:24

Re: Upcoming Ahk2Exe changes

14 Jul 2015, 03:27

I don't really believe it makes a difference, because the autohotkey.bin carrys all the news and fixes. So an exe compiled with an "old" ahk2exe.exe will have all fixes and updates from the included bin (i think).
But i hope the compiler directives will someday come into the release version. So please! .. finc have a look at your compiler ;)
Skrell
Posts: 302
Joined: 23 Jan 2014, 12:05

Re: Upcoming Ahk2Exe changes

14 Jul 2015, 07:34

haichen wrote:I don't really believe it makes a difference, because the autohotkey.bin carrys all the news and fixes. So an exe compiled with an "old" ahk2exe.exe will have all fixes and updates from the included bin (i think).
But i hope the compiler directives will someday come into the release version. So please! .. finc have a look at your compiler ;)
So to be clear, you're saying that as long as I have the latest Unicode 64-bit.bin, ANSI 32-bit.bin, AutoHotkeySC.bin, Unicode 32-bit.bin that i can use THIS ahk2exe (which is from the beginning of 2015) and my compiled exe's will have the latest updates/fixes from 1.1.22.03?

PS: How do i add resources? There is no "optional parameters" box in the GUI that comes up when i double click ahk2exe.
PPS: Sorry to take over your topic but i'd like to fully understand this ahk2exe as i'd LOVE to include custom resources in my exe's! :)
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Upcoming Ahk2Exe changes

14 Jul 2015, 09:48

@Skrell yup :)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Skrell
Posts: 302
Joined: 23 Jan 2014, 12:05

Re: Upcoming Ahk2Exe changes

14 Jul 2015, 10:38

joedf wrote:@Skrell yup :)
Awesome!! What about my "PS" btw?
guest3456
Posts: 3453
Joined: 09 Oct 2013, 10:31

Re: Upcoming Ahk2Exe changes

14 Jul 2015, 11:53

Skrell wrote: What about my "PS" btw?
did you read the first post in the thread?

Skrell
Posts: 302
Joined: 23 Jan 2014, 12:05

Re: Upcoming Ahk2Exe changes

14 Jul 2015, 19:57

guest3456 wrote:
Skrell wrote: What about my "PS" btw?
did you read the first post in the thread?
Yes, but had 2 questions:
1. When you include resources using the syntax below how does the compiler know where to look for the files? Does it just look for them in the same directory as the ahk you are compiling?
;@Ahk2Exe-AddResource someBmp.bmp
;@Ahk2Exe-AddResource test.html

2. How do you then reference the compiled resources from within the ahk source code? Again, do you just use their regular names as if they were in the same directory as the executable being run?
guest3456
Posts: 3453
Joined: 09 Oct 2013, 10:31

Re: Upcoming Ahk2Exe changes

14 Jul 2015, 20:33

there is a .zip file showing an example..

Skrell
Posts: 302
Joined: 23 Jan 2014, 12:05

Re: Upcoming Ahk2Exe changes

14 Jul 2015, 20:42

Got it! You can delete my last post if the admin wishes!
Skrell
Posts: 302
Joined: 23 Jan 2014, 12:05

Re: Upcoming Ahk2Exe changes

15 Jul 2015, 19:02

Ok so i followed the example demo as best i could and of course it didn't work. So here is what i did:

Added @ahk2exe-AddResource snap.wav to the top of my file.

Then referenced it like this:

SoundPlay, "SNAP.wav"

and nothing happens. Now i know that wav files aren't technically on the list of "officially supported filetypes" but it was my understanding that almost any file should work.

Can someone please help me?
User avatar
haichen
Posts: 631
Joined: 09 Feb 2014, 08:24

Re: Upcoming Ahk2Exe changes

16 Jul 2015, 02:21

How mostly the error is sitting infront of the monitor.
Of course i could compile ahk2exe.ahk with the newest AHK!

What i did:
I tried to compile ahk2exe.ahk with a rightclick on it.
and i get my error message.

What i forgot:
Shorttime ago i compiled a program by directly opening ahk2exe.exe
At the gui of Ahk2exe.exe i changed the icon for that program. Everything OK.
..but meanwhile i deleted the icon.
The gui (ahk2exe.exe) dont forget the path. And by rigthclick to compile, ahk2exe.exe
tried to take this path and dont find an icon.
:oops:

So I hope to remember: Ahk2exe.exe dont forget you.r icon.
Skrell
Posts: 302
Joined: 23 Jan 2014, 12:05

Re: Upcoming Ahk2Exe changes

18 Jul 2015, 10:17

No one can tell me if *.wav files should work ?
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Upcoming Ahk2Exe changes

18 Jul 2015, 11:08

Skrell wrote:No one can tell me if *.wav files should work ?
try this:

Code: Select all

; http://www.autohotkey.com/board/topic/96484-read-wave-resource-from-exe-using-skans-dllread-possible/

#NoEnv 
ResRead( Sound, "test.wav" )
PlaySound( Sound )
Return ; // end of auto-execute section //

FileInstall, test.wav, -
;never executed, so never extracted, this should be replaced with ahk2exe directives when applicable!

; ResRead() By SKAN, from http://www.autohotkey.com/board/topic/57631-crazy-scripting-resource-only-dll-for-dummies-36l-v07/?p=609282
ResRead( ByRef Var, Key ) { 
  VarSetCapacity( Var, 128 ), VarSetCapacity( Var, 0 )
  If ! ( A_IsCompiled ) {
    FileGetSize, nSize, %Key%
    FileRead, Var, *c %Key%
    Return nSize
  }
 
  If hMod := DllCall( "GetModuleHandle", UInt,0 )
    If hRes := DllCall( "FindResource", UInt,hMod, Str,Key, UInt,10 )
      If hData := DllCall( "LoadResource", UInt,hMod, UInt,hRes )
        If pData := DllCall( "LockResource", UInt,hData )
  Return VarSetCapacity( Var, nSize := DllCall( "SizeofResource", UInt,hMod, UInt,hRes ) )
      ,  DllCall( "RtlMoveMemory", Str,Var, UInt,pData, UInt,nSize )
Return 0    
}

PlaySound( ByRef Sound ) {
 Return DllCall( "winmm.dll\PlaySound" ( A_IsUnicode ? "W" : "A" ), UInt,&Sound, UInt,0
               , UInt, 0x6 ) ; SND_MEMORY := 0x4 | SND_NODEFAULT := 0x2
}

PlaySoundAsync( ByRef Sound ) {
 Return DllCall( "winmm.dll\PlaySound" ( A_IsUnicode ? "W" : "A" ), UInt,&Sound, UInt,0, UInt, 0x7 )
}


Skrell
Posts: 302
Joined: 23 Jan 2014, 12:05

Re: Upcoming Ahk2Exe changes

18 Jul 2015, 12:14

tmplinshi wrote: try this:

Code: Select all

; http://www.autohotkey.com/board/topic/96484-read-wave-resource-from-exe-using-skans-dllread-possible/

#NoEnv 
ResRead( Sound, "test.wav" )
PlaySound( Sound )
Return ; // end of auto-execute section //

FileInstall, test.wav, -
;never executed, so never extracted, this should be replaced with ahk2exe directives when applicable!

; ResRead() By SKAN, from http://www.autohotkey.com/board/topic/57631-crazy-scripting-resource-only-dll-for-dummies-36l-v07/?p=609282
ResRead( ByRef Var, Key ) { 
  VarSetCapacity( Var, 128 ), VarSetCapacity( Var, 0 )
  If ! ( A_IsCompiled ) {
    FileGetSize, nSize, %Key%
    FileRead, Var, *c %Key%
    Return nSize
  }
 
  If hMod := DllCall( "GetModuleHandle", UInt,0 )
    If hRes := DllCall( "FindResource", UInt,hMod, Str,Key, UInt,10 )
      If hData := DllCall( "LoadResource", UInt,hMod, UInt,hRes )
        If pData := DllCall( "LockResource", UInt,hData )
  Return VarSetCapacity( Var, nSize := DllCall( "SizeofResource", UInt,hMod, UInt,hRes ) )
      ,  DllCall( "RtlMoveMemory", Str,Var, UInt,pData, UInt,nSize )
Return 0    
}

PlaySound( ByRef Sound ) {
 Return DllCall( "winmm.dll\PlaySound" ( A_IsUnicode ? "W" : "A" ), UInt,&Sound, UInt,0
               , UInt, 0x6 ) ; SND_MEMORY := 0x4 | SND_NODEFAULT := 0x2
}

PlaySoundAsync( ByRef Sound ) {
 Return DllCall( "winmm.dll\PlaySound" ( A_IsUnicode ? "W" : "A" ), UInt,&Sound, UInt,0, UInt, 0x7 )
}


1. Thank you for helping! But a few questions:
2. Do i still need to use ;@Ahk2Exe-AddResource SNAP.wav ?
3. Should the function call "PlaySound ( Sound)" be used to play the sound instead of "SoundPlay" ?
4. Shouldn't "FileInstall, SNAP.wav, - " be in the autoexec section at the top of my code along with "ResRead( Sound, "SNAP.wav" )" ?

Return to “Announcements”

Who is online

Users browsing this forum: No registered users and 17 guests