Search the Community
Showing results for tags 'fileinstall'.
-
What i'm trying to achieve is to bundle a few folders within the executable script and from what I've read it can be done with: #include <FileConstants.au3> FileInstall(src, dest, $FC_OVERWRITE) I know that src must be a literal string and cant be a variable or macro. However, I also learned that I cant just install a folder but there is a workaround that uses 7zip or winrar so that FileInstall extracts the folder to the desired location (e.g. to dest) so I wend and tried both variants: I zipped a single folder just for testing. I winrared a single folder just for testing. Keep in mind that both the .zip and .rar are the same folder with the same content. The problem I ran into is that FileInstall simply moves the .rar or .zip folder to the desired location but it doesn't extract it! #RequreAdmin #include <FileConstants.au3> Func installESPLibraries() Local Const $sLibrariesPath = @LocalAppDataDir & "\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries" FileInstall("esp-libraries\ESP32-ADXL345.rar", $sLibrariesPath & "\", $FC_OVERWRITE) EndFunc installESPLibraries() The result I'm left with is that ESP32-ADXL345.rar just gets moved to $sLibrariesPath (so it does kinda work). The result I want is to have ESP32-ADXL345.rar extracted to the same location so that I have only a folder with the name ESP32-ADXL345 without any winrar files. Is there a way to achieve such a thing ? (because i'm sure there is). NOTE: I already did search the forum for such a solution: how to use fileinstall want to bundle my exe foldersfiles embedding images folders in exe However, They all show practical examples with files and none with folders (the third link mentions folders but has no examples) so I am at a loss as to how it should be done. EDIT: Thanks to @Musashi and @Nine for pointing out what I was missing! Also, I would like to add my solution: #RequreAdmin #include <FileConstants.au3> ; Create a local constant string to hold a path to the folder where we will be installing the libraries Local Const $sLibrariesPath = @LocalAppDataDir & "\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\" ; Unpack libraries.rar to the path we defined FileInstall("libraries.rar", $sLibrariesPath, $FC_OVERWRITE) ; Run the batch script to extract libraries.rar at the path we defined RunWait("unrar.bat " & $sLibrariesPath & " libraries.rar", "", @SW_HIDE) ; Deletes libraries.rar FileDelete($sLibrariesPath & "libraries.rar") I attached the .bat file I wrote to make it work. The reasoning for this solution is to show how its done cleanly with .rar files as I didn't see anyone do it this way. Hope it helps people in the future! unrar.bat
-
CreateFilesEmbedded.exe Application to embed files into their programs in the format .AU3 I present a different format to add files in your script: So how about having our files (photos, text, executables) built? 1 - We can use the binary variables with 2 - We can test the fully functional program with F5 SciTE 4 - Use your imagination!!! Sintax / Examples: #include "YourFileEmbedded.au3" ; Returning the code in binary format $bData = _YourFileEmbedded() ; Saving the code in the HDD _YourFileEmbedded( True, @ScriptDir) ; Saving and running the code _YourFileEmbedded( True, @ScriptDir, True) ; Finally, running the code directly Run(_YourFileEmbedded(True))Language file sample: Supports: ; All file types! Downloads: Version: 2.27 CreateFilesEmbedded_(RedirectLink).html (Previous downloads: 575) Example using the binary return (without writing the file in HDD) BinarySoundTest.zip Sample: Fixes: Free Software João Carlos.
- 54 replies
-
- embedded
- fileinstall
-
(and 2 more)
Tagged with:
-
Hi, I have a source Script where I inserted the following code lines to be able to extract the script source code anytime later if I run it with the /ExtractSourceCode: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Res_SaveSource=Y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** If StringInStr($cmdlineRaw, "/ExtractSourceCode") Then FileInstall(@ScriptFullPath, @ScriptDir & "\" & @ScriptName & ".txt", 1) ;FileInstall("C:\Test.txt", @ScriptDir & "\Test.txt") Exit EndIf I used to be able to compile it on another computer some years ago without problems. Now I wanted to modify the code, so I extracted it, renamed the file *.au3, performd my little modification and rebuild. Strangely, I get this popup with Caption: Aut2Exe Error and Invalid FileInstall() function. BEfore I hit the OK button on the Popup, I can see the file is actually Built as I can see that an EXE file is created, but as I hit OK in that error dialog, the EXE disappears. Any advice? Thanks David I can't remember if I did it with Autoit 2 EPP_NF_Replacer_UBI.au3
-
I get the "Unable to add resources" error related to AppData\Local\AutoIt v3\Aut2Exe when compiling with a large FileInstall of a 1.5GB file. Is there a size limit I need to be aware of? I've also disabled or removed Trend from three different machines and had the same results. I've had issues like this in the past but have compiled after the Aut2Exe folder was excluded in AV. That doesn't seem to be the problem this time around. If I comment out the FileInstall the script compiles successfully.
-
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.
-
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
-
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?
-
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
-
Hi, I am currently working on a script to install a driver for a cardreader system and a software package both wrapped in a separate .msi package so that I can install them silently. Until now I only have been focusing on the fundamental element of installing the drivers. And testing it on 2 vm’s which are Windows XP & 7 32bit (not using 64x). With the code that I am currently using it does work on Windows XP but on windows 7 I keep getting the following error when the script executes the .msi ERROR_INSTALL_PACKAGE_OPEN_FAILED 1619 I know this is a rights issue but what I can’t understand is that I am executing the script as a system Administrator account, I also tried to push this the script with a management software we have. The management software runs the scripts it pushes under SYSTEM account with the same results. My question is if some of you have some experience with this or maybe have some hints/examples how to approach this. Here is what i have until now for the installation. ; Script Start - Add your code below here FileInstall("C:\VM_SHARE\Omnikeydriver.msi", "C:\Omnikeydriver.msi", 1) ; HID_OMNIKEY3x21_x86_R1_2_6_5.msi FileInstall("C:\VM_SHARE\SafeSign.msi", "C:\SafeSign.msi", 1) ; SafeSign-Identity-Client-3.0.40-admin.msi $InstallDriver = ShellExecuteWait("msiexec.exe", '/i "C:\Omnikeydriver.msi" /q /norestart') MsgBox ( 48, "Omnikey", "Return Value: " & $InstallDriver ) $InstallSafeSign = ShellExecuteWait("msiexec.exe", '/i "C:\SafeSign.msi" /q /norestart') MsgBox ( 48, "Omnikey", "Return Value: " & $InstallSafeSign ) ConsoleWrite ( $InstallDriver & @CRLF & $InstallSafeSign )
- 1 reply
-
- msi
- fileinstall
-
(and 1 more)
Tagged with:
-
Hi, I'm trying to create an installer that extracts about 586 files (3.2 GB) to temp directory, then executes the msi file. For this, I created a script with 586 fileinstall() functions. Script runs perfectly when executed without compiling. But when executed after compiling, only 263 (~2 GB) files are extracted to the temp directory. The remaining fileinstall() functions returned 0. Is there any limit for usage of fileinstall() in a single script. If so, any work around other than creating a separate script for the remaining files. -Roshith
-
Hi guys, i have problem with FileInstall: Global $Dest = @TempDir & "_Temp" DirCreate($Dest) For $i = 0 To 9 FileInstall("._TempX0" & $i & ".bmp", $Dest & "X0" & $i & ".bmp", 1) FileInstall("._TempY0" & $i & ".bmp", $Dest & "Y0" & $i & ".bmp", 1) Next For $i = 10 To 60 FileInstall("._TempX" & $i & ".bmp", $Dest & "X" & $i & ".bmp", 1) FileInstall("._TempY" & $i & ".bmp", $Dest & "Y" & $i & ".bmp", 1) Next I have a folder with X01.bmp X02.bmp Y01.bmp etc... Work fine, it install the files but when i'm trying to compile i have the error: INVALID FILEINSTALL FUNCTION() So work if the file is .au3 but i can't compile into .exe What is the problem? Thanks