AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compile_AHK II - for those who compile!
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
ladiko



Joined: 14 Jul 2006
Posts: 190
Location: Berlin

PostPosted: Mon May 26, 2008 8:16 pm    Post subject: Reply with quote

hmm? invasive? nooo you are not invasive Smile
sometimes my phrases are a little bit offensive, that's my style, sorry for that. maybe in the future i'm going to add this, but not in the next 4 - 8 weeks, cause its not a function that adds further usefulness to compile_ahk. it only saves 400kb.

i've uploaded a new version without a new changelog, see the changes in my last post. in normal situations it is not necessary to download this version again.
Back to top
View user's profile Send private message
chadross



Joined: 30 Apr 2008
Posts: 8
Location: Canada

PostPosted: Fri May 30, 2008 2:57 pm    Post subject: DEFAULTS INI Reply with quote

ladiko,

would it be possible to have the script check A_ScriptDir for the Defaults INI if it is not found at A_AppData . "\Compile_AHK\Defaults.ini" ?

Perhaps changing to something like this (Line 206):
Code:

; ; --------------------------------------------------------------------------------
; INI File
; --------------------------------------------------------------------------------
DEFAULTS_LOCAL_INI := A_ScriptDir . "\Defaults.ini"
If FileExist(INI_FILE) {
   _READ_INI(INI_FILE)
} Else If FileExist(DEFAULTS_INI) {
   _READ_INI(DEFAULTS_INI)
} Else If FileExist(DEFAULTS_LOCAL_INI) {
   _READ_INI(DEFAULTS_LOCAL_INI)
}

AHK and Compile_AHK have made scripting at work so much easier for me. I can now move between multiple computers and not worry whether or not AHK has been installed.

Thanks for your help. Very Happy
_________________
Chad.
Back to top
View user's profile Send private message
ladiko



Joined: 14 Jul 2006
Posts: 190
Location: Berlin

PostPosted: Sat May 31, 2008 11:26 pm    Post subject: Reply with quote

Update from 2008-04-31
    + New: defaults.ini can be saved in Compile_AHK's folder
    + Changed: More compact GUI
    + Changed: ini-files are read in following order / priority:
    • script folder
    • AppData folder
    • Compile_AHK.exe folder
Back to top
View user's profile Send private message
chadross



Joined: 30 Apr 2008
Posts: 8
Location: Canada

PostPosted: Sat May 31, 2008 11:43 pm    Post subject: Thank Reply with quote

Thanks ladiko, you rock...
_________________
Chad.
Back to top
View user's profile Send private message
NACarter
Guest





PostPosted: Mon Jun 02, 2008 1:47 pm    Post subject: Corrupt file Reply with quote

Hi ladiko,

Is your latest exe file corrupt? I keep getting an error message saying the exe is corrupt, and it would appear to be a lot smaller than your previous versions.

Nick
Back to top
Rhys



Joined: 17 Apr 2007
Posts: 722
Location: Florida

PostPosted: Tue Jun 10, 2008 4:00 pm    Post subject: Reply with quote

I'm not sure when this started happening, but UPX compression doesn't seem to be happening when I compile with this any more.
Edit: It's being compressed, but not at the right level... See my exciting console session:

Code:
G:\AutoHotkey\Compiler>upx -9 checktime_jen.exe
        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
upx: checktime_jen.exe: AlreadyPackedException: already packed by UPX

Packed 1 file: 0 ok, 1 error.

G:\AutoHotkey\Compiler>upx -d checktime_jen.exe
        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
    615115 <-    408267   66.37%    win32/pe     checktime_jen.exe

Unpacked 1 file.

G:\AutoHotkey\Compiler>upx -9 checktime_jen.exe
 
        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
    615115 ->    258763   42.07%    win32/pe     checktime_jen.exe

Packed 1 file.


Edit2: This decmpressed and recompressed exe says:
EXE corrupted

Edit3: I tried on a decompressed exe and it says the same:
EXE corrupted
_________________
[Join IRC!]
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2558
Location: Australia, Qld

PostPosted: Wed Jun 11, 2008 8:43 am    Post subject: Reply with quote

Re: Edit2 and Edit3
Since UPX is used on the stub executable before the actual script is appended, you can't decompress a compiled script without corrupting it. The actual script is compressed, encoded and appended to the executable using a closed-source (afaik) library provided by Jonathan Bennett.
Back to top
View user's profile Send private message
Rhys



Joined: 17 Apr 2007
Posts: 722
Location: Florida

PostPosted: Wed Jun 11, 2008 1:41 pm    Post subject: Reply with quote

Thanks for the info, Lexikos!

Has anyone else seen larger than expected compiled programs with the latest version of Compile_AHK_II? Just a few days ago it was working for me.

Edit: Reinstalling AHK fixed the issue - Root cause unknown!
_________________
[Join IRC!]
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2558
Location: Australia, Qld

PostPosted: Sat Jun 14, 2008 12:46 pm    Post subject: Reply with quote

Quote:
+ New: If present, the folder Lib + AutoHotkey.exe will be copied too (function untested)
I just tested it (I don't compile often); AutoHotkey.exe is copied, but to the wrong directory. To support function libraries, AutoHotkey.exe and the Lib folder must be in %A_AppData%\AutoHotkey, not %A_AppData%\AutoHotkey\Compiler.
Back to top
View user's profile Send private message
darklight_tr



Joined: 29 May 2008
Posts: 11
Location: Madison, WI

PostPosted: Tue Jun 24, 2008 4:36 pm    Post subject: Re: Compile_AHK II - for those who compile! Reply with quote

ladiko wrote:
Update from 2008-04-31
Update from 2008-04-26
Update from 2008-04-25
Update from 2008-05-06


I'm curious, but should the releases after 2008-05-06 be in May, not April? That is, if you don't have a time machine. Very Happy

Anyways, this is an awesome script!
Back to top
View user's profile Send private message
Guest






PostPosted: Wed Jul 02, 2008 12:36 am    Post subject: Reply with quote

Quite usefull tool, thanks!
Back to top
joey335
Guest





PostPosted: Sat Jul 26, 2008 9:24 pm    Post subject: Reply with quote

Is there a way you can have a no UPX option. I don't like my a/v detecting it.
Back to top
scottmattes



Joined: 21 May 2007
Posts: 61
Location: USA

PostPosted: Mon Jul 28, 2008 2:50 pm    Post subject: Reply with quote

ladiko wrote:


scottmattes wrote:
Does this compiler have an option, or is any work being done towards an option, to create a menu item for the compiled version of a script that will display the contents?
maybe i'm a little bit retarded, but i dont get the point of what you want Sad
you want a hotkey or system tray context menu item that shows the current compiled script's source code? hmm my script doesnt compile anything. it uses the default compiler ahk2exe.exe and is limited to it's ahk-related functions. my script only gives access to ahk2exe.exe's command line options and some resource editing. maybe i could add the related script file as a resource to the compiled script, but how to show it ... hmm?!? refer to http://www.autohotkey.com/forum/viewtopic.php?t=30228 and http://www.autohotkey.com/forum/viewtopic.php?p=147202


I doubt that you are retarded.

What I would like in a compiler is for it to scan my .ahk and create "a hotkey or system tray context menu item, in the compiled version, that shows the current compiled script's" defined hotkeys and auto expands (with the comments that are on that line). That way anyone that uses the .exe version of my code can right click on the tray icon and select Contents and see a list of the key and a short comment about what it does.

Here is the code that I cobbled together for my .ahk to use

Code:

; from ideas and code found on AutoHotKey.com
;(and specifically MikeG contribution in http://www.autohotkey.com/forum/viewtopic.php?t=215)
; with some mods of my own - scott.mattes@gmail.com


; purpose: to automate showing what keys, etc, are defined for use
; this script will read the ahk that includes it and display what keys
; and auto replace strings are defined in it. It also includes a menu
; item in the tray popup menu, called Contents, for the calling ahk


; how to use: put the line '#include path/name' in every .ahk file

; dbl clicking on the tray icon will display a list of defined hotkeys
 
#Persistent  ; Keep the script running until the user exits it.

; add an entry to the running script's tray popup menu
Menu, tray, add  ; Creates a separator line.
Menu, tray, add, Contents, key_list ; Creates a new menu item.
Menu, tray, default, Contents
;return

;****************************************************************
; Extract a list of hotkeys and their descriptions from this script
;****************************************************************
key_list:
  SetBatchLines,-1
  AutoTrim,off

  key_count = 0
  key_list=

  Loop,Read,%A_ScriptFullPath%
  {
    Line=%A_LoopReadLine%
   
    Key=

    ; exclude lines that begin with ';'
    first_char:= substr( line, 1, 1 )
    if first_char <> `;
    {
      IfInString,Line,`:`: ; look for :: in line, this is a key assignment
      {
        StringSplit,Key,Line,`:

        key_count += 1

        ; normally we use key1
        key = %key1%
        key_length:=strlen(key)

        ; but if key1 is null, use key2
        if key_length = 0
        {
          StringReplace,Key,Key2,*,%a_space%%key3% ; force autoreplace lines to the top later
        }
        else
        {
          ; change the special characters to human friendly terms
          StringReplace,Key,Key1,#,Win-,all
          StringReplace,Key,Key,!,Alt-,all
          StringReplace,Key,Key,^,Ctrl-,all
          StringReplace,Key,Key,+,Shift-,all
          StringReplace,Key,Key,~,Native+,all
          StringReplace,Key,Key,*,Wild+,all
          StringReplace,Key,Key,<,Left%a_space%,all
          StringReplace,Key,Key,>,Right%a_space%,all
          StringReplace,Key,Key,`;,,all
        }

        if strlen(key) > max_len
        {
        max_len:=strlen(key)
        }

        keys%key_count%:=key

        ; if there is a comment on the line display it, else the command will show
        StringSplit,Comment,Line,`;
        StringTrimLeft,Comment,Comment%Comment0%,0
        comments%key_count%:=comment
      } ; IfInString,Line,`:`:

    } ; if substr( line, 1, 1 ) <> ';'
   
  } ; Loop,Read,%A_ScriptFullPath%

  max_len +=1

  ; go through and format for display
  cnt = 0
  loop %key_count%
  {
    a_key:=keys%a_index%

    ; force the the length of the longest key
    a_key=%a_key%                                                  !
    stringleft,a_key,a_key,%max_len%

    a_comment:=comments%a_index%

    key_list=%key_list%%a_Key%`t%a_comment%`n
  } ; loop %key_count%

  ; sort the variable for output
  sort, key_list

  ; show the user what we found, but only for 5 minutes
  MsgBox,0,Hotkeys list,%key_list%, 300

Return



_________________
-------------
Scott Mattes
Back to top
View user's profile Send private message
scottmattes



Joined: 21 May 2007
Posts: 61
Location: USA

PostPosted: Mon Jul 28, 2008 9:27 pm    Post subject: Reply with quote

Here is an idea for the code

Code:

; ExtractDefinedHotKeys.ahk
;
; Scott Mattes
; 2008-07-28
;
; To create code to show what hotkeys and auto-expands are included in the .ahk
; These lines are to be included in your .ahk before it is compiled
;
; The code for isolating and converting for display is from MikeG
; from ideas and code found on AutoHotKey.com
; (and specifically MikeG's contribution found in http://www.autohotkey.com/forum/viewtopic.php?t=215)


  FileSelectFile, SelectedFile, 3, , Select the .ahk file to prepare, AutoHotKey files (*.ahk)

  if SelectedFile =
  {
      MsgBox, The user didn't select anything.
      return
  }

  FormatTime, CurrentDateTime,, yyyy-MM-dd  HH:mm:ss
  output_lines = %output_lines%`; Generated by ExtractDefinedHotKeys.ahk`r`n
  output_lines = %output_lines%`; on %CurrentDateTime%`r`n
  output_lines = %output_lines%`; By Scott Mattes`r`n
 
  output_lines = %output_lines%`r`n

  output_lines = %output_lines%`; from ideas and code found on AutoHotKey.com`r`n
  output_lines = %output_lines%`;(and specifically MikeG's contribution found in http://www.autohotkey.com/forum/viewtopic.php?t=215)`r`n
 
  output_lines = %output_lines%`r`n

  output_lines = %output_lines%`; purpose: to automate showing what keys, etc, are defined for use`r`n
 
  output_lines = %output_lines%`r`n

  output_lines = %output_lines%`; dbl clicking on the tray icon will display a list of defined hotkeys`r`n

  output_lines = %output_lines%`r`n

  output_lines = %output_lines%`; add an entry to the running script's tray popup menu`r`n
  output_lines = %output_lines%  Menu, tray, add  `; Creates a separator line.`r`n
  output_lines = %output_lines%  Menu, tray, add, Contents, key_list `; Creates a new menu item.`r`n
  output_lines = %output_lines%  Menu, tray, default, Contents`r`n
 
  output_lines = %output_lines%`r`n

  output_lines = %output_lines%`;****************************************************************`r`n
  output_lines = %output_lines%`; Extract a list of hotkeys and their descriptions from this script`r`n
  output_lines = %output_lines%`;****************************************************************`r`n
  output_lines = %output_lines%key_list:`r`n
  output_lines = %output_lines%  SetBatchLines,-1`r`n
  output_lines = %output_lines%  AutoTrim,off`r`n
  output_lines = %output_lines%`r`n
 
  output_lines = %output_lines%  list_list= `; reset for multiple calls`r`n
 
  key_count = 0

  Loop,Read,%SelectedFile%
  {
    Line=%A_LoopReadLine%
   
    Key=

    ; exclude lines that begin with ';'
    first_char:= substr( line, 1, 1 )
    if first_char <> `;
    {
      IfInString,Line,`:`: ; look for :: in line, this is a key assignment
      {
        StringSplit,Key,Line,`:

        key_count += 1

        ; normally we use key1
        key = %key1%
        key_length:=strlen(key)

        ; but if key1 is null, use key2
        if key_length = 0
        {
          StringReplace,Key,Key2,*,%a_space%%key3% ; force autoreplace lines to the top later
        }
        else
        {
          ; change the special characters to human friendly terms
          StringReplace,Key,Key1,#,Win-,all
          StringReplace,Key,Key,!,Alt-,all
          StringReplace,Key,Key,^,Ctrl-,all
          StringReplace,Key,Key,+,Shift-,all
          StringReplace,Key,Key,~,Native+,all
          StringReplace,Key,Key,*,Wild+,all
          StringReplace,Key,Key,<,Left%a_space%,all
          StringReplace,Key,Key,>,Right%a_space%,all
          StringReplace,Key,Key,`;,,all
        }

        keys%key_count%:=key

        ; if there is a comment on the line display it, else the command will show
        StringSplit,Comment,Line,`;
        StringTrimLeft,Comment,Comment%Comment0%,0
        comments%key_count%:=comment
      } ; IfInString,Line,`:`:

    } ; if substr( line, 1, 1 ) <> ';'
   
  } ; Loop,Read,%A_ScriptFullPath%

  ; go through and format for display
  loop %key_count%
  {
    a_key:=keys%a_index%
    a_comment:=comments%a_index%
    output_lines=%output_lines%  list_list=`%list_list`%%a_key%`t%a_comment% |`r`n

  } ; loop %key_count%

 
  output_lines = %output_lines%`r`n

  output_lines = %output_lines%`; sort the variable for output, use | vice CRLF as delimiter`r`n
  output_lines = %output_lines%  sort, output_lines, D|`r`n

  output_lines = %output_lines%`r`n

  output_lines = %output_lines%`; show the results in a simple ListBox`r`n
  output_lines = %output_lines%  Gui, Add, Button, Default x250 y750 w100 h30 , &Close`r`n
  output_lines = %output_lines%  Gui, Add, ListBox, t50 x16 y19 w570 h700, `%list_list`%`r`n
  output_lines = %output_lines%  Gui, Show, w600 h800 center, AutoHotKey defined keys and substitutions`r`n

  output_lines = %output_lines%return`r`n

  output_lines = %output_lines%`r`n

  output_lines = %output_lines%ButtonClose:`r`n
  output_lines = %output_lines%  gui, cancel`r`n
  output_lines = %output_lines%Return `r`n
 
  msgbox, output_lines=%output_lines%

  clipboard=%output_lines%
return


Run this and then paste the clipboard contents into the top of your .ahk file. Run your .ahk and the first thing it does is to display all defined hotkeys and auto-expanding text. After that, double clicking the icon will again display the list.
_________________
-------------
Scott Mattes
Back to top
View user's profile Send private message
Guest






PostPosted: Wed Aug 27, 2008 11:15 am    Post subject: Reply with quote

please update it,is not working with latest autohotkey (1.0.47.6)


thanks
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Page 7 of 8

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group