Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

DROPILER drag and drop compiler/decompiler


  • Please log in to reply
7 replies to this topic
JamixZol
  • Members
  • 54 posts
  • Last active: Jan 22 2014 04:35 AM
  • Joined: 26 Mar 2012
I have seen a ton of compile/decompile scripts on the forum, but I wanted to write one that was super easy to use and change icons etc. I have been working on multiple end user scripts lately that require recompiling for bug fixes and switching things out became tedious.
So, here's a script I wrote to be a quick solution for compiling and decompiling scripts on the fly without modifying the registry.
It's pretty strait forward, just drag a script or compiled exe to the corresponding drop zone on the GUI and then compile or decompile. This app also has the option of a default password for compiling, and reminds you when decompiling.

How it works:
This script just builds calls for the compiler and runs it with switches (ahk2exe)
The decompiler (exe2ahk) is run from a temporary batch file, this seemed to work better than "run"

Why it works:
The compiler and decompiler have been around with AHK since the beginning it seems, this is just a front end for it

How to use it:
The stand alone zip file HERE contains all of the files needed to run this in a stand alone capacity.
See the image below for basic instructions

THIS ZIP has a compiled version as well as the files needed to run this app (the compiler and decompiler found on the forums)
Posted Image

Here's the code:(note: the files from the zip are needed to run)
; set a default compile password
COMPILE_PASSWORD=AHKROCKS

IfNotExist,%A_ScriptDir%\compiler
	FileCreateDir, %A_ScriptDir%\compiler

Gui, Add, Text, x16 y25 w230 h105 vSCRIPT_HITBOX, 
Gui, Add, GroupBox, x6 y10 w250 h130 vSCRIPT_HITBOX_GROUP, DROP SCRIPT HERE

Gui, Add, Text, x276 y25 w230 h105 vEXE_HITBOX, 
Gui, Add, GroupBox, x266 y10 w250 h130 vEXE_HITBOX_GROUP, DROP EXE HERE

Gui, Add, Text, x16 y215 w390 h90 vICON_HITBOX, 
Gui, Add, Picture, x416 y210 w95 h95 vICON_HITBOX_PIC, %A_ScriptDir%\compiler\ahk.ico
Gui, Add, GroupBox, x6 y200 w510 h110 vICON_HITBOX_GROUP, DROP ICON HERE

Gui, Add, Button, x6 y150 w250 h40 vCOMPILE_BUTTON Disabled gCOMPILE, COMPILE =====>
Gui, Add, Button, x266 y150 w250 h40 vDECOMPILE_BUTTON Disabled gDECOMPILE, <===== DECOMPILE

; Generated using SmartGUI Creator for SciTE
Gui, Show, w528 h322, DROPILER
return

GuiClose:
ExitApp

COMPILE:
gui, submit, nohide
GuiControlGet, SCRIPT_HITBOX,, SCRIPT_HITBOX
GuiControlGet, EXE_HITBOX,, EXE_HITBOX
GuiControlGet, ICON_HITBOX,, ICON_HITBOX

StringReplace, SCRIPT_HITBOX_EXEOUT, SCRIPT_HITBOX, .ahk,.exe,ALL
GuiControl,,EXE_HITBOX,%SCRIPT_HITBOX_EXEOUT%

ifexist,%SCRIPT_HITBOX_EXEOUT%
   msgbox, 262196,DROPILER,File `n%SCRIPT_HITBOX%`nalready exist`nWant you convert anyway ?
ifmsgbox,NO
   return

COMPILER_STRING= compiler\compiler.exe /in `"%SCRIPT_HITBOX%`" 
If EXE_HITBOX
	COMPILER_STRING=%COMPILER_STRING%%A_Space%/out `"%EXE_HITBOX%`" 
If ICON_HITBOX
	COMPILER_STRING=%COMPILER_STRING%%A_Space%/icon `"%ICON_HITBOX%`" 
else
	COMPILER_STRING=%COMPILER_STRING%%A_Space%/icon `"compiler\ahk.ico`" 
If COMPILE_PASSWORD
	COMPILER_STRING=%COMPILER_STRING%%A_Space%/pass `"%COMPILE_PASSWORD%`" 

COMPILER_STRING=%COMPILER_STRING%%A_Space%/bin compiler\AutoHotkeySC.bin

Run, %COMPILER_STRING%
return

DECOMPILE:
gui, submit, nohide
GuiControlGet, SCRIPT_HITBOX,, SCRIPT_HITBOX
GuiControlGet, EXE_HITBOX,, EXE_HITBOX
GuiControlGet, ICON_HITBOX,, ICON_HITBOX

StringReplace, SCRIPT_HITBOX_EXEOUT, EXE_HITBOX, .exe,.ahk,ALL
GuiControl,,SCRIPT_HITBOX,%SCRIPT_HITBOX_EXEOUT%

ifexist,%SCRIPT_HITBOX_EXEOUT%
   msgbox, 262196,DROPILER,File `n%SCRIPT_HITBOX_EXEOUT%`nalready exist`nWant you convert anyway ?
ifmsgbox,NO
   return

InputBox, DECOMPILE_PASSWORD, DROPILER, Please enter the password to decompile this exe`nYour default password is `"%COMPILE_PASSWORD%`"

;Build a bat string, then ride it
DECOMPILER_STRING=%DECOMPILER_STRING%cd\`n
DECOMPILER_STRING=%DECOMPILER_STRING%cd %A_ScriptDir%\compiler`n
DECOMPILER_STRING=%DECOMPILER_STRING%decompiler `"%EXE_HITBOX%`"
If DECOMPILE_PASSWORD
	DECOMPILER_STRING=%DECOMPILER_STRING%%A_Space%`"%DECOMPILE_PASSWORD%`" 
DECOMPILER_STRING=%DECOMPILER_STRING%`nexit

FileAppend,%DECOMPILER_STRING%,compiler\DECOMPILE.BAT

RunWait, compiler\DECOMPILE.BAT
FileDelete, compiler\DECOMPILE.BAT
return

GuiDropFiles:
Loop, parse, A_GuiEvent, `n
{
    FirstFile = %A_LoopField%
    Break
}
;script hitbox
IfInString, FirstFile, .ahk
{	
	GuiControl,enable,COMPILE_BUTTON
if(A_GuiControl="SCRIPT_HITBOX_GROUP")
GuiControl,,SCRIPT_HITBOX,%FirstFile%
if(A_GuiControl="SCRIPT_HITBOX")
GuiControl,,SCRIPT_HITBOX,%FirstFile%
return
}

IfInString, FirstFile, .exe
{	
	GuiControl,enable,DECOMPILE_BUTTON
;exe hitbox
if(A_GuiControl="EXE_HITBOX_GROUP")
GuiControl,,EXE_HITBOX,%FirstFile%
if(A_GuiControl="EXE_HITBOX")
GuiControl,,EXE_HITBOX,%FirstFile%
return
}

;icon hitbox
IfInString, FirstFile, .ico
{	
if(A_GuiControl="ICON_HITBOX_GROUP")
{
GuiControl,,ICON_HITBOX,%FirstFile%
GuiControl,,ICON_HITBOX_PIC,*w95 *h95 %FirstFile%
}
if(A_GuiControl="ICON_HITBOX")
{
GuiControl,,ICON_HITBOX,%FirstFile%
GuiControl,,ICON_HITBOX_PIC,*w95 *h95 %FirstFile%
}
if(A_GuiControl="ICON_HITBOX_PIC")
{
GuiControl,,ICON_HITBOX,%FirstFile%
GuiControl,,ICON_HITBOX_PIC,*w95 *h95 %FirstFile%
}
}
else
{
MsgBox %FirstFile%`nThis is not an icon formated file!`nHere`, try this out...
Run, http://converticon.com/
}
return

NOTES:
The contents of the zip are needed to run this.
The script creates a "compiler" folder as a placeholder for "fileinstall" however I did not implement this for the public script, as the files are not mine to install at my leisure.
Modifications are welcome, however I only wrote the above script. The compiler and decompiler are not my work.
My code is built and tested for: AutoHotkey_L
Tools:Notify()Builder Dropiler
Libs:RFN Achieve
sಠಠn

Koobenhoff
  • Members
  • 73 posts
  • Last active: Sep 23 2016 08:39 PM
  • Joined: 13 Aug 2010
Too simple! I prefer my apps to make me search for the files....plus, for added complexity I store all the files on my PC in the root of C:\

Seriously....this is the first one of your apps that isn't crazy complicated :lol:

JamixZol
  • Members
  • 54 posts
  • Last active: Jan 22 2014 04:35 AM
  • Joined: 26 Mar 2012
Lol thanks Koob :lol:
My apps are still complicated though, but I make simple tools :wink:
My code is built and tested for: AutoHotkey_L
Tools:Notify()Builder Dropiler
Libs:RFN Achieve
sಠಠn

DataLife
  • Members
  • 1022 posts
  • Last active: Nov 27 2015 01:09 AM
  • Joined: 27 Apr 2008
This looks really nice. I will try it out later when I get home. Does it matter if the script I want to compile was written with AHK basic or AHK_L?
Check out my scripts.  (MyIpChanger) (XPSnap) (SavePictureAs) All my scripts are tested on Windows 7, AutoHotkey 32 bit Ansi unless otherwise stated.

JamixZol
  • Members
  • 54 posts
  • Last active: Jan 22 2014 04:35 AM
  • Joined: 26 Mar 2012
The compiler/decompiler is dependent on the original files and documentation. I'm not sure if the AHK_L and basic compilers are the same or not. If a different compiler is needed, just put it in the compiler folder and name it compiler.exe

I think the decompiler is not version specific though
My code is built and tested for: AutoHotkey_L
Tools:Notify()Builder Dropiler
Libs:RFN Achieve
sಠಠn

DataLife
  • Members
  • 1022 posts
  • Last active: Nov 27 2015 01:09 AM
  • Joined: 27 Apr 2008

Too simple! I prefer my apps to make me search for the files....plus, for added complexity I store all the files on my PC in the root of C:\

Seriously....this is the first one of your apps that isn't crazy complicated :lol:


JamixZol,
I searched for other scripts written by you just to see how complicated they were but I only found 1.

Do you have links to your other scripts?
Check out my scripts.  (MyIpChanger) (XPSnap) (SavePictureAs) All my scripts are tested on Windows 7, AutoHotkey 32 bit Ansi unless otherwise stated.

JamixZol
  • Members
  • 54 posts
  • Last active: Jan 22 2014 04:35 AM
  • Joined: 26 Mar 2012
@DataLife

Most of my scripts are not published on the forums, as they are proprietary to my job. Koob knows because he works with me. I intend to start posting more here on the forums though. :D

I am working (tentatively) on a cross-process/cross-network interop framework called Gippetto that I intend to post here when it's done though.
My code is built and tested for: AutoHotkey_L
Tools:Notify()Builder Dropiler
Libs:RFN Achieve
sಠಠn

specter333
  • Members
  • 627 posts
  • Last active: Oct 07 2016 07:43 AM
  • Joined: 15 Jan 2007
Been using this for a while with no problems but it's not working on scripts that use Active x. It either gives me an error that says "exe corrupt" or "Parameter number 2 invalid, specifically Activex".
I you need new version of any scripts I haven't re-uploaded yet feel free to pm me.