AutoHotkey Community

It is currently May 27th, 2012, 12:31 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 414 posts ]  Go to page Previous  1 ... 16, 17, 18, 19, 20, 21, 22 ... 28  Next
Author Message
 Post subject:
PostPosted: December 13th, 2009, 2:22 pm 
Offline

Joined: July 14th, 2006, 12:31 am
Posts: 290
Location: Berlin
which command line parameters do you miss?

i have to see how to handle icons with letters instead of numbers as icongroup name.
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 14th, 2009, 8:31 am 
Offline

Joined: November 20th, 2008, 6:00 pm
Posts: 72
Location: Thionville, France
Oh now i understand better for the icons, thanks.

My goal was to choose some compilation options using command line, but i eventually programatically edited the ini file relative to the file to compile and used the /nogui option.
I will edit your code so that the tray icon won't show when using this option ; this could be a default behavior.

Is there a way to detect that the compilation failed or was aborted?

When I have time, I will try to port your code to the unicode version of AutoHotkey, as i sometimes use paths containing unicode chars.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 14th, 2009, 7:58 pm 
Offline

Joined: July 14th, 2006, 12:31 am
Posts: 290
Location: Berlin
If you change line 3344:
Code:
_EXIT() {
   ExitApp , 1
}
the app exits with exitcode 1 on error and with zero if the compilation was successful. what do you mean with "aborted" ? by the user or by a fault?

i will add it in the next release, but don't hold your breath - it could take a little bit longer.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 14th, 2009, 11:36 pm 
I ran through this thread, but couldn't find an absolute answer/solution. Image resources aren't copied to the exe when compiled!

It also assumes the exe is being made in the folder where these image resouces are kept. If I have the destination folder seperate, the images don't appear in the application when run, but they appear when the applicable is run from the original resource folder.

Has this been encountered/solved by anybody else?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 14th, 2009, 11:46 pm 
Offline

Joined: July 14th, 2006, 12:31 am
Posts: 290
Location: Berlin
i tried to compile a script and include a bmp-file - the exe file is almost the same amount bigger as the bmp file has. so it seems ok for me.

please explain what you did and maybe post some code?!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 15th, 2009, 12:03 am 
The code's fine (to be clear, not trying to be defensive), and the images show up perfectly when the exe is run from the resources' originating folder, just not otherwise.

Create a gui and have the image file displayed in the gui. Compile it in the resource's folder (i used a generated passkey, nodecompile and settings saved in script, but nothing else specifically) and then move the exe onto your desktop or anywhere else.

If you run the exe from outside of the original image's folder it wont show when the gui pops.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 11:59 am 
i got error:

---------------------------
Compile_AHK_Setup.exe - Application Error
---------------------------
The application was unable to start correctly (0xc0000142). Click OK to close the application.
---------------------------
OK
---------------------------

I'm running on Windows 7 Ultimate with UAC disabled.
Whats the problem?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 4:03 pm 
Offline

Joined: July 14th, 2006, 12:31 am
Posts: 290
Location: Berlin
seems to be a failed download. try to download again, maybe with another browser?!

it worked for me with firefox 2.0, 3.0 and 3.5 on windows xp home and professional 32bit, vista business 32bit, windows 7 business 32bit and 64bit.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 9:06 pm 
As with the image resource saving bug, I've since specified the image resources' full directories, compiled, and of course the images show on my station (as the compiled exe is looking in that specific directory, which exists), but when I move the exe to another computer they don't show, as expected.

Is there something else I should be specifying to have the copies of the images saved to the compiled exe be the ones used, and not the original ones on my station?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 10:20 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
How are you using the images in your script? If you're specifying image paths with the Gui command (even relative ones), it will look for files even if you've instructed Compile_AHK to embed them as resources. Compile_AHK cannot automagically detect all references to images in the script, and AutoHotkey's built-in commands can't ordinarily load images from resources.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2009, 12:01 am 
Kinda limits the cosmetic options when it comes to compiled scripts then huh. Guess I'll need to find a way to work around having images in the gui. ):


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2009, 12:27 am 
Quick Question.

What are the benefits using this complier over the standard supplied compiler ?

Is the source more secure ? Faster / Smaller etc ?

Thx


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2009, 2:45 am 
Offline

Joined: January 7th, 2007, 1:43 pm
Posts: 107
Guest2 wrote:
Quick Question.

What are the benefits using this complier over the standard supplied compiler ?

Is the source more secure ? Faster / Smaller etc ?

Thx

you can make it smaller,add icon,add version info ,or other which you maybe like


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2009, 4:18 am 
Offline

Joined: January 20th, 2009, 3:29 am
Posts: 13
poetbox wrote:
Guest2 wrote:
Quick Question.

What are the benefits using this complier over the standard supplied compiler ?

Is the source more secure ? Faster / Smaller etc ?

Thx

you can make it smaller,add icon,add version info ,or other which you maybe like

To add to the above, you can modify Manifest for Vista Administrator Exection Level (User Account Control) easily, instead of using the "standard" compiler, which you need to change the Manifest by using Reshacker manually. 8)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 18th, 2009, 7:04 am 
Offline

Joined: November 20th, 2008, 6:00 pm
Posts: 72
Location: Thionville, France
ladiko, i extracted some code from SKAN's IconEx to create an icon extraction function that will work with named resources as well. I don't exactly know how the extraction part works, but it works :P It doesn't use ResHacker and it seems it performs faster.
Code:
IconExtract(Res, Nb = 0, Out = "") ;Resource file, resource number [0..N], Output file
{
   Global _IconGroups_, _IconGroupsCount_
   Static CallB
   If !CallB
      CallB := RegisterCallback( "EnumResNameProc" )
   Nb:=Nb+1
   If (Out = "")
      Out := A_WorkingDir "\Icon_1.ico"
   Loop, %Res%
   {
      If (A_LoopFileExt = "ICO")
      {
         FileCopy, %Res%, %Out%, 1
         If !ErrorLevel
            Return 1
         Else
            Return
      }
      If A_LoopFileExt Not in EXE,DLL,CPL,SCR
         Return
      hModule := DllCall( "LoadLibraryEx", Str,A_LoopFileLongPath, UInt,0, UInt,0x2 )
      IfEqual,hModule,0,Return
      _IconGroupsCount_:=0, _IconGroups_ := ""
      DllCall("EnumResourceNamesA", UInt,hModule, UInt,14, UInt,CallB, UInt,0 )
      DllCall( "FreeLibrary", UInt,hModule )
      IfEqual,_IconGroupsCount_,0, Continue
      SplitPath, Res,, Res
      hModule := DllCall( "LoadLibraryEx", Str,Res "\" DllCall( "CharUpperA", Str,A_LoopFileName, Str ), UInt,0, UInt,0x2 )
   }
   Loop, Parse, _IconGroups_, |
   {
      If (A_Index > Nb)
         Break
      If (A_Index != Nb)
         Continue
      IconGroup := A_LoopField
      hFile := DllCall( "_lcreat", Str,Out, UInt,0 )
      sBuff := GetResource( hModule, IconGroup, (RT_GROUP_ICON:=14), nSize, hResData )
      Icons := NumGet( sBuff+0, 4, "UShort" )
      tSize := nSize+( Icons*2 ), VarSetCapacity( tmpBuff,tSize, 0 ), tBuff := &tmpBuff
      CopyData( sBuff, tBuff, 6  ),   sBuff:=sBuff+06,  tBuff:=tBuff+06
      Loop %Icons%
         CopyData( sBuff, tBuff, 14  ),  sBuff:=sBuff+14,  tBuff:=tBuff+16
      DllCall( "FreeResource", UInt,hResData )
      DllCall( "_lwrite", UInt,hFile, Str,tmpBuff, UInt,tSize )
      EOF := DllCall( "_llseek", UInt,hFile, UInt,-0, UInt,2 )
      VarSetCapacity( tmpBuff, 0 )
      DataOffset := DllCall( "_llseek", UInt,hFile, UInt,18, UInt,0 )
      Loop %Icons%
      {
         VarSetCapacity( Data,4,0 )
         DllCall( "_lread", UInt,hFile, Str,Data, UInt,2 )
         nID := NumGet( Data, 0, "UShort" )
         DllCall( "_llseek", UInt,hFile, UInt,-2, UInt,1 )
         NumPut( EOF, Data ),  DllCall( "_lwrite", UInt,hFile, Str,Data, UInt,4 )
         DataOffset := DllCall( "_llseek", UInt,hFile, UInt,0, UInt,1 )
         sBuff := GetResource( hModule, nID, (RT_ICON:=3), nSize, hResData )   
         DllCall( "_llseek", UInt,hFile, UInt,0, UInt,2 )         
         DllCall( "_lwrite", UInt,hFile, UInt,sBuff, UInt,nSize )
         DllCall( "FreeResource", UInt,hResData )
         EOF := DllCall( "_llseek", UInt,hFile, UInt,-0, UInt,2 )
         DataOffset := DllCall( "_llseek", UInt,hFile, UInt,DataOffset+12, UInt,0 )
      } 
      DllCall( "_lclose", UInt,hFile )
   }
   DllCall( "FreeLibrary", UInt,hModule )
   If IconGroup
      Return 1
}

EnumResNameProc( hModule, lpszType, lpszName, lParam )
{
   Global _IconGroups_, _IconGroupsCount_
   _IconGroups_ .= ( ( _IconGroups_!="" ) ? "|" : "" ) . lpszName , _IconGroupsCount_:=_IconGroupsCount_+1 
   Return True
}

GetResource( hModule, rName, rType, ByRef nSize, ByRef hResData )
{
   hResource := DllCall( "FindResource", UInt,hModule, UInt,rName, UInt,rType )
   nSize     := DllCall( "SizeofResource", UInt,hModule, UInt,hResource )
   hResData  := DllCall( "LoadResource", UInt,hModule, UInt,hResource )
Return DllCall( "LockResource", UInt, hResData )
}

CopyData( SPtr, TPtr, nSize )
{
   Return DllCall( "RtlMoveMemory", UInt,TPtr, UInt,SPtr, UInt,nSize )
}


EDIT: I noticed it didn't work anymore for named icons on Win7 x64...


Last edited by Yook on December 30th, 2009, 3:03 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 414 posts ]  Go to page Previous  1 ... 16, 17, 18, 19, 20, 21, 22 ... 28  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Cristi®, Google Feedfetcher, tidbit and 55 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group