Jump to content

No More Exe2Aut


Somerset
 Share

Recommended Posts

I hope this takes off an helps, i am tired of i lost my script deal people are bringing forth.

This following script is compiled and has source i will show as well.

This adds extra functionality to the beta autoit. Since decompiling

of the scripts is going to be stopped and for a good reason i think. I have

created the following just try to help. double click it and follow

the instructions. once installed and you right click on a script you

will see a new function that says compile with source. it takes and

uses fileinstall that is built into autoit, and uses it on your script.

Now that your script is compiled with it own source still intact, to get

it back, just creat either a bat or short cut and use the switch of

source

then either click and save the bat and run or apply and run the shortcut.

It will give you source back in the same folder that the compiled exe is

located at.

Example as follows:

"c:\windows\desktop\my-autoit-program" source

no other switch will be accepted... If no switch is used it will run the

program as normal if the switch is incorrect it will just exit.

#NoTrayIcon
dim $naming,$dealing
if $CmdLine[0] = "" then exit 0

$file = FileOpen($CmdLine[1], 0)

If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
$naming=@MDAY&"-"&@MON&"-"&@YEAR&"-"&@HOUR&@MIN&@SEC&".au3"
$confused=Random (1, 1000000,1)
FileCopy ($CmdLine[1],@TempDir&"\"&$naming,1)
FileWrite(@TempDir&"\source-"&$confused&".au3", "if $CmdLine[0] = "&'"'&'"'&" then"&@CRLF)
FileWrite(@TempDir&"\source-"&$confused&".au3", "else"&@CRLF)
FileWrite(@TempDir&"\source-"&$confused&".au3", "if $CmdLine[1] = "&'"'&"source"&'"'&" then ")
FileWrite(@TempDir&"\source-"&$confused&".au3", "FileInstall ("&'"'&@TempDir&"\"&$naming&'",@ScriptFullPath&'&'"'&"-source.au3"&'"'&")"&@CRLF)
FileWrite(@TempDir&"\source-"&$confused&".au3", "Exit"&@CRLF)
FileWrite(@TempDir&"\source-"&$confused&".au3", "endif"&@CRLF)

While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
FileWrite(@TempDir&"\source-"&$confused&".au3", $line&@CRLF)
Wend

FileClose($file)
$stealing=RegRead ("HKEY_CLASSES_ROOT\AutoIt3Script\Shell\Compile\Command","")
$confirming=StringTrimRight ($stealing, 4)
$gooberpea=FileGetLongName(@TempDir&"\source-"&$confused&".au3")

Runwait ($confirming&'"' &$gooberpea&'"',@TempDir)


$clipping=StringTrimRight ($CmdLine[1], 3)


while 1
If FileExists (@TempDir&"\source-"&$confused&".exe") Then
    exitloop
Else
    sleep(1000)
EndIf
wend

Filemove (@TempDir&"\source-"&$confused&".exe", $clipping&"exe",1)
FileDelete (@TempDir&"\source-"&$confused&".au3")
FileDelete (@TempDir&"\"&$naming)

Jpm, or any of the developers wish to add this to the beta autoit go right ahead i encourage it... :D

Edited by beerman
Link to comment
Share on other sites

This is a bit of a long way round

If you add this into the AU3 template in your templates Directory and just put in the File name when you write a new script it compiles the source into the exe and you restore it with commandline

http://www.autoitscript.com/forum/index.php?showtopic=26877

$password = "MyPassword"
If $CMDLINE [0] > 0 and $CMDLINE [1] = "recover" Then
    $check = InputBox ("Recover", "Password?","", "*")
    If $Check = $password then 
        FileInstall ("Put the name of the au3 file here.au3", StringtrimRight (@ScriptFullPath, 4) & "_rec.au3" ) 
        MsgBox (0,"Output File",StringtrimRight (@ScriptFullPath, 4) & "_rec.au3" ,5)
    Else 
        MsgBox (0,"Error","Incorrect password" ,5)
    EndIf
Exit
EndIf
; Script Start - Add your code below here
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...