koresho Posted November 2, 2007 Posted November 2, 2007 I would love to throw a few files into my main executable for distribution, I just can't seem to figure how to use FileInstall(). I have about 600MB worth of programs that need to be included with my script for it to work properly. Right now I have the script on the root, and the programs in @ScriptDir & "\Tools\" and they are handled by executing a self-extracting RAR archive. However if I could bundle it all in the script using FileInstall() and then call the files out that would be awesome. If that is too much data, I have a couple little batch files I would like to include in the script at least. Any suggestions, maybe a step by step on how to do it? I read the help file but I must be dumb; I can't get it to work. Thanks in advance.
Blue_Drache Posted November 2, 2007 Posted November 2, 2007 I would love to throw a few files into my main executable for distribution, I just can't seem to figure how to use FileInstall().I have about 600MB worth of programs that need to be included with my script for it to work properly. Right now I have the script on the root, and the programs in @ScriptDir & "\Tools\" and they are handled by executing a self-extracting RAR archive. However if I could bundle it all in the script using FileInstall() and then call the files out that would be awesome. If that is too much data, I have a couple little batch files I would like to include in the script at least. Any suggestions, maybe a step by step on how to do it? I read the help file but I must be dumb; I can't get it to work. Thanks in advance.FileInstall("C:\original\file\location\on\hard\drive\written\out\completely.exe", @scriptdir & "\bin\completely.exe",1)The first parameter has to be completly written out. NO VARIABLES. NO MACROS.The second parameter can contain macros or variables.The third parameter is opitonal. antonioj84 1 Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
Kerros Posted November 2, 2007 Posted November 2, 2007 (edited) I've been working with this one as well, and the problem that I ran into is that you need to create the directory before trying to install anything. failing Example: CODE $return = FileInstall("C:\7za\7z.exe", "C:\7za\") If $return = 0 Then MsgBox(0, "file install error 1", "Unable to install 7z.exe") Exit EndIf Successful Example CODE DirCreate("c:\7za") $return = FileInstall("C:\7za\7z.exe", "C:\7za\") If $return = 0 Then MsgBox(0, "file install error 1", "Unable to install 7z.exe") Exit EndIf Edited November 2, 2007 by Kerros Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.
koresho Posted November 2, 2007 Author Posted November 2, 2007 thanks for the help guys!! That solves it. Now the question: Can I FileInstall() 600+ MB worth of programs into my script?
Blue_Drache Posted November 2, 2007 Posted November 2, 2007 Q: How do you code someone eating a whale? A: One byte at a time. Ok, horrible parable ... but I think you understand. The short answer is: Yes. Xandy 1 Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
koresho Posted November 2, 2007 Author Posted November 2, 2007 Simple answer: Yes, but I would have to program it for every damn file, i cant do it for folders or anything right?
Moderators SmOke_N Posted November 2, 2007 Moderators Posted November 2, 2007 Simple answer: Yes, but I would have to program it for every damn file, i cant do it for folders or anything right?http://www.autoitscript.com/forum/index.ph...c=34805&hl= Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
BigDod Posted November 2, 2007 Posted November 2, 2007 Simple answer: Yes, but I would have to program it for every damn file, i cant do it for folders or anything right?Zip the files into a self extracting exe, fileinstall it and then run it to create the folder structure. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother
koresho Posted November 2, 2007 Author Posted November 2, 2007 Ah ha why didnt i think of that?!? Sweet. Thanks!
antonioj84 Posted May 14, 2017 Posted May 14, 2017 (edited) "Fileinstall " explanation can be tricky this was the clearest info so far, that page did it for me. fileInstall("C:\original\file\location\on\hard\drive\written\out\completely.exe", @scriptdir & "\bin\completely.exe",1) once i had the basic working , i was able to use relative path. The key is to use "dirCreate". i know it;s old however still relevant. Global $sDestination='c:\Installers\EpsonJavaPosAdk\' DirCreate($sDestination) FileInstall(".\DataStorage\copyfile2.exe", $sDestination& "copyfile2.exe", 1);===> Modify this path copyfile2.exe ;~DataStorage is a folder within my script directory where the files i want to copy are located Edited May 14, 2017 by antonioj84 error santoshM 1
Developers Jos Posted May 14, 2017 Developers Posted May 14, 2017 ... and your reason for posting this in an 10 years old thread was.... what? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
antonioj84 Posted May 14, 2017 Posted May 14, 2017 The explanation on this thread was the clearest at least to me, and I hope it can help someone else. Simple, i am not looking for any trouble, let me know if i should remove it ? OtenMoten, santoshM and Keith_Greenberg 2 1
Developers Jos Posted May 14, 2017 Developers Posted May 14, 2017 no worries OtenMoten 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
sebastiian Posted March 30, 2019 Posted March 30, 2019 (edited) expandcollapse popup#include <GUIConstantsEx.au3> #include <File.au3> Global $sMyComputerCLSID = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" Global $gsDirData = "" Global $ghMain = GUICreate('FileInstall Dir', 800, 580) Global $giOutPut = GUICtrlCreateEdit('', 10, 10, 780, 500) GUICtrlCreateLabel('Extension:', 20, 518, 50, 20, 0x001) Global $giExtension = GUICtrlCreateInput('*', 75, 515, 50, 20) GUICtrlCreateLabel('Ruta de destino:', 130, 518, 90, 20, 0x001) Global $giDestPath = GUICtrlCreateInput('@TempDir & "\"', 220, 515, 200, 20) GUICtrlCreateLabel('Flag:', 425, 518, 30, 20, 0x001) Global $giFlag = GUICtrlCreateCombo('', 455, 515, 40, 300) GUICtrlSetData($giFlag, '0|1|', '1') Global $giDirDrive = GUICtrlCreateCheckbox("Camino largo", 500, 515) Global $giDirRecurse = GUICtrlCreateCheckbox("Dir Recurse", 500, 535) GUICtrlSetState(-1, $GUI_CHECKED) Global $giDirHierarchy = GUICtrlCreateCheckbox("Mantener jerarquía", 500, 555) Global $giGetDir = GUICtrlCreateButton('Buscar carpeta', 110, 545, 150, 30) Global $giCopyData = GUICtrlCreateButton('Copiar Datos', 320, 545, 150, 30) GUISetState() While 1 Switch GUIGetMsg() Case - 3 Exit Case $giGetDir $gsDirData = _GetDirData(GUICtrlRead($giExtension), (GUICtrlRead($giDirDrive) <> 1), _ GUICtrlRead($giDestPath), GUICtrlRead($giFlag), GUICtrlRead($giDirRecurse), _ GUICtrlRead($giDirHierarchy) = $GUI_CHECKED) If Not @error Then GUICtrlSetData($giOutPut, '') GUICtrlSetData($giOutPut, $gsDirData) EndIf Case $giCopyData ClipPut(GUICtrlRead($giOutPut)) EndSwitch WEnd Func _GetDirData($sExt, $bExcludeLongName, $sDestPath, $nFlag, $nRecursive, $bHierarchy) Local $sDir = FileSelectFolder("Select a Directory to FileInstall", $sMyComputerCLSID) If @error Then Return SetError(1, @extended, "") EndIf $nRecursive = ($nRecursive = $GUI_CHECKED) ? 1 : 0 Local $aFiles = _FileListToArrayRec($sDir, "*." & $sExt, 1, $nRecursive, 0, 2) If Not IsArray($aFiles) Then Return SetError(2, @extended, "") EndIf Local $sTDrive, $sTDir, $sTFName, $sTExt Local $sHold = "" _GetExistStr($sDestPath, $sHold) Local $sFinstall = "" Local $sTmpDest = "" Local $sHoldStr = "" If $bHierarchy Then ; main folder searching _PathSplit($sDir, $sTDrive, $sTDir, $sTFName, $sTExt) If StringRight(StringRegExpReplace($sDestPath, "[\\/]+\z", ""), _ StringLen($sTFName)) <> $sTFName Then $sTmpDest = StringRegExpReplace($sDestPath, _ "(\&\s*(?:\x27|\x22)[\\/]+(?:\x27|\x22))", "") & ' & "\' & $sTFName & '\"' If Not StringInStr($sHoldStr, $sTDir & @LF) Then $sHoldStr &= $sTDir & @LF _GetExistStr($sTmpDest, $sHold) EndIf EndIf EndIf Local Static $sScrDir = StringRegExpReplace(@ScriptDir, "\\+\z", "") For $i = 1 To UBound($aFiles) - 1 $sTmpDest = $sDestPath _PathSplit($aFiles[$i], $sTDrive, $sTDir, $sTFName, $sTExt) If $bExcludeLongName Then If $sScrDir = StringRegExpReplace($sTDrive & $sTDir, "\\+\z", "") Then $aFiles[$i] = $sTFName & $sTExt EndIf EndIf If $bHierarchy Then $sTmpDest = StringRegExpReplace($sTmpDest, _ "(\&\s*(?:\x27|\x22)[\\/]+(?:\x27|\x22))", "") & ' & "' & $sTDir & '"' If Not StringInStr($sHoldStr, $sTDir & @LF) Then $sHoldStr &= $sTDir & @LF _GetExistStr($sTmpDest, $sHold) EndIf EndIf $sFinstall &= "FileInstall(""" & $aFiles[$i] & '", ' & $sTmpDest & ", " & $nFlag & ")" & @CRLF Next $sHold &= $sFinstall $sHold = StringTrimRight($sHold, 2) Return $sHold EndFunc Func _GetExistStr($sDestPath, ByRef $sOutData) $sOutData &= 'If Not FileExists(' & $sDestPath & ') Then' & @CRLF $sOutData &= ' Do' & @CRLF $sOutData &= ' DirCreate(' & $sDestPath & ')' & @CRLF $sOutData &= ' Until FileExists(' & $sDestPath & ')' & @CRLF $sOutData &= 'EndIf' & @CRLF EndFunc File Install - s04.au3 Edited March 30, 2019 by Melba23 Added code tags
Moderators Melba23 Posted March 30, 2019 Moderators Posted March 30, 2019 sebastiian, Is there a question in there somewhere? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now