careca

AutoIt Archiver (like winrar sfx)

6 posts in this topic

Hey there, im looking for a way to build something similar to winrar sfx archives.

My idea is to somehow pack files into the exe (maybe fileinstall)

and be able to extract each one to a specific folder if needed.

Now here's the tricky part, i can't think of a way to update only part of the files like i do in winrar.

And it would require some work with command line to be able to somehow get a list of the files packed in, and extract one for example.

Does anyone know of any way to accomplish this? Also, fileinstall that can use variables would be nice.

Best regards.


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Share this post


Link to post
Share on other sites



1 hour ago, careca said:

Also, fileinstall that can use variables would be nice.

If you do a search of the forum on FileInstall Variable you'll be treated to about 1200 threads that explain why this isn't likely to happen.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

That's interesting, i got zero. Anyway, i believe you, do you have any suggestion in regard to the issue? An alternative to fileinstall?


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Share this post


Link to post
Share on other sites

What about using a database?

Share this post


Link to post
Share on other sites

@JohnOne Will that allow me to change the resource at will? extract it to wherever i want, add, delete? keep an executable standalone?

@InunoTaishou How does that work? Will it mean i have one or more files besides de .exe, or is it embedded in the exe?

My main goal is to make it a standalone exe.


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Share this post


Link to post
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

  • Similar Content

    • Marc
      By Marc
      Profiler - yet another backup script for Firefox and Thunderbird profiles
      It automatically detects the last recently used profile directories of Firefox and Thunderbird (installed versions, no portables).
      Clicking the Backup-Button creates a complete Backup of the found profiles with a timestamp.
      Restore deletes the according profile dir and extracts the content of the selected archive into the profile directory.
      Uses Winrar as compression tool, but feel free to change it to your needs
      Best regards
      Marc

      Profiler.au3
    • Marc
      By Marc
      Hi Folks,
      I've been very fond of portable software. Some of the portable programs are quite large, so to make the using fancier, I started to compress the portable applications into a WinRar SFX Archive which extracts the software to the tempdir, starts the software and afterward deletes the whole temp Dir.
      But it got cumbersome to manually extract the icon from the exe, make all necessary settings in the WinRar GUI - so I wrote this script. Nothing spectacular, but (in my eyes) very useful. After that, I added some other options to make it a little more versatile.
      Features:
      if we have a 32Bit and a 64Bit version, it can launch the correct Version (32Bit or 64Bit) fitting to the system the SFX is started on (contains a small exe file "universal_launcher.exe" which expects two parameters  for the 32Bit.exe and 64Bit.exe, checks the current system for 64Bit and then runs the correct file). Powerbasic Sourcecode of the exe file is included, of course. automatically extracts the icon from the chosen exe and uses it as icon for the SFX if the chosen exe file has a version number in it, the version is put in the resulting SFX's filename can just extract the files to a user-chosen directory OR can just extract the files to the program files directory (and, optionally, create a desktop shortcut) OR extract the files to a temp directory and run an exe Have fun with it
      best regards,
      Marc

      MakeSFX.zip
    • Jfish
      By Jfish
      Hello all.  I was playing around with encrypt.au3 and thought it would be neat to build an executable that could extract and decrypt an encrypted file (sort of like an option in PGP if you have ever used that before).  I had to think on the issue of installing the file in the exe because you can't use variable path names.  The approach I came up with may not be the best - others may have much better ideas - but I thought I would share it nonetheless in case anyone finds it interesting.
      ;********************************************* ; Example script ; ENCRYPT A FILE INTO A SELF-EXTRACTING EXE ; by: JFish ; ;******************************************** #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Crypt.au3> ; will be used for the encryption #include <File.au3> ; will be used to manipulate au3 file before we compile #Region ### START Koda GUI section ### Form=C:\Users\RC01712\Documents\Scripts\Encrypt Tool\encrypt_GUI.kxf $Form1 = GUICreate("Form1", 657, 244, 192, 132) $sourceInput = GUICtrlCreateInput("", 144, 48, 337, 24) $sourceBtn = GUICtrlCreateButton("Browse", 40, 48, 89, 25) $encryptBtn = GUICtrlCreateButton("Encrypt", 224, 128, 145, 33) $passwordInput = GUICtrlCreateInput("", 144, 80, 337, 24) $Label1 = GUICtrlCreateLabel("Password", 40, 80, 73, 24) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $decryptBtn = GUICtrlCreateButton("Decrypt", 224, 176, 145, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ; var declaration for global scope dim $sourceFile, $password, $filename, $filenameRoot, $fileExtension, $publicEncFileNameFullPath, $publicEncFileName ; select a source file that we want to encrypt func _selectFile() GUICtrlSetData($sourceInput,"") $filename="" $sourceFile=FileOpenDialog("Please select a file to encrypt",@ScriptDir,"All (*.*)") $dirLen=stringlen(@WorkingDir)+1 ;grab the file name $filename=StringTrimLeft($sourceFile,$dirLen) local $firstDot=stringinstr($filename,".",0,-1) ;grab the file root name without the extension $filenameRoot=stringtrimright($filename,stringlen($filename)-$firstDot+1) ;grab the file extension $fileExtension=stringtrimleft($filename,$firstDot-1) ;MsgBox("","",$fileExtension) GUICtrlSetData($sourceInput,$sourceFile) EndFunc func _encrypt() $password = GUICtrlRead($passwordInput) if $password="" then MsgBox("","","please enter a password") EndIf ; encrypt the file NOTE: method in example of AES 256 is hard coded $result =_Crypt_EncryptFile($sourceFile,@ScriptDir&"\"&$filenameRoot&"_enc"&$fileExtension,$password,$CALG_AES_256) ; if the encryptions works ... if $result=True Then ; set the full path name to the file including the new "_enc" showing that it is encrypted $publicEncFileNameFullPath=@ScriptDir&"\"&$filenameRoot&"_enc"&$fileExtension ; setr the name of the encrypted file without the path $publicEncFileName=$filenameRoot&"_enc"&$fileExtension ; call the function to create the exe _createEXE($publicEncFileName,$publicEncFileName) else MsgBox("","","encryption error") EndIf MsgBox("","Encrypt status",$result) EndFunc func _createEXE($publicEncFileNameFullPath,$publicEncFileName) ;***************************************************************** ; This functions writes an au3 file that will get compiled and become our ; 'self extracting' encrypted file and program to decrypt ; The biggest issue is embedding the encrypted file with fileinstall ; b/c it does not take variable path names ;****************************************************************** ; craete an INI file with the full path name and file name of the encrypted file IniWrite(@ScriptDir&"\temp.ini","filedata","filename",$publicEncFileName) IniWrite(@ScriptDir&"\temp.ini","filedata","filepath",@ScriptDir&"\"&$publicEncFileName) ; stuff our au3 script into a variable called "wrapper" ; NOTE: there are two spots called "REPLACEME" and "REPLACEFILENAME" that will get replaced with ini text $wrapper='#include <Crypt.au3>'&@crlf& _ 'local $readFileName="REPLACEFILENAME"'&@crlf& _ 'MsgBox("","",$readFileName)'&@crlf& _ 'if FileExists(@ScriptDir&"\"&$readFileName) Then'&@crlf& _ 'Else'&@crlf& _ 'FileInstall("REPLACEME",@ScriptDir&"\"&$readFileName,1)'&@crlf& _ 'EndIf'&@crlf& _ '$passkey=InputBox("Please enter the decryption password","PASSWORD","","*",400,150)' &@crlf& _ 'local $newfilename=stringreplace($readFileName,"_enc","_dec")'&@crlf& _ '$firstDot=stringinstr($readFileName,".",0,-1)'&@crlf& _ '$fileExtension=stringtrimleft($readFileName,$firstDot-1)'&@crlf& _ 'if _Crypt_DecryptFile($readFileName, @ScriptDir&"\"&$newfilename&$fileExtension, $passkey, $CALG_AES_256) Then'&@crlf& _ 'Else'&@crlf& _ ' MsgBox("","","invalid password")'&@crlf& _ ' Exit'&@crlf& _ 'EndIf' ; open a new file for our "standalone" decryption program $tempFile=fileopen(@ScriptDir&"\standalone.au3",2) FileWrite($tempFile,$wrapper) FileClose($tempFile) ;after the au3 file is created read in the filename of the file to install and replace the text $readFileName=IniRead(@ScriptDir&"\temp.ini","filedata","filename","decryptedfile.txt") _ReplaceStringInFile (@ScriptDir&"\standalone.au3", "REPLACEFILENAME",$readFileName) ; after the au3 file is created read in the full path of the file to install and replace the text in au3 local $readFilePath=IniRead(@ScriptDir&"\temp.ini","filedata","filepath","default") _ReplaceStringInFile (@ScriptDir&"\standalone.au3", "REPLACEME",$readFilePath) ;compile the au3 file into an executable using the command line ShellExecuteWait("Aut2exe.exe"," /in standalone.au3 /out "&$filenameRoot&".exe",@ScriptDir) ;delete the temporary au3 file FileDelete(@ScriptDir&"\standalone.au3") EndFunc ;************************************************* ; This function will decrypt the file from the UI ; used to create the encrypted file (make sure you ; select the new name with the _enc first ;************************************************ func _decrypt() $password = GUICtrlRead($passwordInput) if $password="" then MsgBox("","","please enter a password") EndIf local $newfilename=stringreplace($filenameRoot,"_enc","_dec") $result=_Crypt_DecryptFile($sourceFile, @ScriptDir&"\"&$newfilename&$fileExtension, $password, $CALG_AES_256) MsgBox("","decrypt status",$result) EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg case $sourceBtn _selectFile() case $encryptBtn _encrypt() case $decryptBtn _decrypt() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  
      encrypt2exe.au3
    • TheDcoder
      By TheDcoder
      Hello!
      If FileInstall('image.png', @ScriptDir) = 0 Then MsgBox(0, "Unexcepted Error", "Damaged file") Exit Will it make any difference if the file was unable to extract?
    • Graeme
      By Graeme
      Hi,
      I have a very simple line in a complex script.
      If Not FileInstall("Thunderbird update.jpg",$ScriptTargetDir,1) Then SplashOff() MsgBox(0x10,$UpdateID,"Update failed - could not install Thunderbird update.jpg in " & $ScriptTargetDir) Exit(0) EndIf Every time I try to compile this script I get the message:
       

      But the file Thunderbird update.jpg exists in the same directory as the script. I tried making it a bmp like the example in the help file - no difference. I tried ".Thunderbird update.jpg" and I tried making it "ThunderbirdUpdate.jpg" gettting rid of the space.
      The destination file is defined as well.
      The error message from SciTE isn't very helpful -
      >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /ShowGui /in "U:Documents5 GraemeQAupdate2_2_0.au3"
      +>17:38:08 Starting AutoIt3Wrapper v.2.1.4.4 SciTE v.3.3.7.0 ;  Keyboard:00000809  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0409  Keyboard:00000809  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
      -> No changes made..
      >Running AU3Check (1.54.22.0)  from:C:Program Files (x86)AutoIt3
      +>17:38:11 AU3Check ended.rc:0
      >Running:(3.3.8.1):C:\Program Files (x86)\AutoIt3\Aut2Exe\aut2exe_x64.exe  /in "U:Documents5 GraemeQAupdate2_2_0.au3" /out "C:UsersGraemeAppDataLocalAutoIt v3Aut2exe~AU3tngpptu.exe" /nopack /comp 4
      !>17:38:21 Aut2exe.exe ended errors because the target exe wasn't created, abandon build. (C:UsersGraemeAppDataLocalAutoIt v3Aut2exe~AU3tngpptu.exe)rc:9999
      +>17:38:21 AutoIt3Wrapper Finished..
      >Exit code: 0    Time: 13.756
      Any ideas as to what the problem is would be very appreciated.
      Blessings
      Graeme