Page 3 of 7

Re: Upcoming Ahk2Exe changes

Posted: 04 Jun 2015, 13:13
by joedf
Theoretically, any type can be included. Those are just the officially supported ones. ;)

Still waiting on the release with ahk :)

Re: Upcoming Ahk2Exe changes

Posted: 05 Jun 2015, 07:42
by Skrell
Is that expected to happen with the official release?

Re: Upcoming Ahk2Exe changes

Posted: 13 Jul 2015, 08:20
by haichen
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.

Re: Upcoming Ahk2Exe changes

Posted: 13 Jul 2015, 08:52
by Peter2
The mentioned icon is OK? Right format, right name, no access problems? Tried reboot of PC?

Re: Upcoming Ahk2Exe changes

Posted: 13 Jul 2015, 10:13
by Skrell
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 ?

Re: Upcoming Ahk2Exe changes

Posted: 13 Jul 2015, 12:44
by haichen
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.

Re: Upcoming Ahk2Exe changes

Posted: 13 Jul 2015, 14:49
by Skrell
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?

Re: Upcoming Ahk2Exe changes

Posted: 14 Jul 2015, 03:27
by haichen
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 ;)

Re: Upcoming Ahk2Exe changes

Posted: 14 Jul 2015, 07:34
by Skrell
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! :)

Re: Upcoming Ahk2Exe changes

Posted: 14 Jul 2015, 09:48
by joedf
@Skrell yup :)

Re: Upcoming Ahk2Exe changes

Posted: 14 Jul 2015, 10:38
by Skrell
joedf wrote:@Skrell yup :)
Awesome!! What about my "PS" btw?

Re: Upcoming Ahk2Exe changes

Posted: 14 Jul 2015, 11:53
by guest3456
Skrell wrote: What about my "PS" btw?
did you read the first post in the thread?

Re: Upcoming Ahk2Exe changes

Posted: 14 Jul 2015, 19:57
by Skrell
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?

Re: Upcoming Ahk2Exe changes

Posted: 14 Jul 2015, 20:33
by guest3456
there is a .zip file showing an example..

Re: Upcoming Ahk2Exe changes

Posted: 14 Jul 2015, 20:42
by Skrell
Got it! You can delete my last post if the admin wishes!

Re: Upcoming Ahk2Exe changes

Posted: 15 Jul 2015, 19:02
by Skrell
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?

Re: Upcoming Ahk2Exe changes

Posted: 16 Jul 2015, 02:21
by haichen
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.

Re: Upcoming Ahk2Exe changes

Posted: 18 Jul 2015, 10:17
by Skrell
No one can tell me if *.wav files should work ?

Re: Upcoming Ahk2Exe changes

Posted: 18 Jul 2015, 11:08
by tmplinshi
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 )
}



Re: Upcoming Ahk2Exe changes

Posted: 18 Jul 2015, 12:14
by Skrell
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" )" ?