Jump to content

Including a folder in FileInstall?


exodius
 Share

Recommended Posts

Hi,

Read the manual please before asking this kind of questions :lmao:

But to answer it : NO !

Taken from the help file.

The FileInstall function is designed to include files into a compiled AutoIt script. These included files can then be "extracted" during execution of the compiled script. Keep in mind that files such as images can greatly increase the size of a compiled script.

The source file must be a string and not a variable so that the compiler can extract the filename to include. The source cannot contain wildcards

Andre

What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!
Link to comment
Share on other sites

The source file must be a string and not a variable so that the compiler can extract the filename to include. The source cannot contain wildcards.

That doesn't explicitly say "And by the way, you can't use folders." Being new to the message board doesn't automatically make everyone an idiot. Sometimes it's nice to check to make sure the functionality doesn't exist before finding another way.

Link to comment
Share on other sites

Speaking of another way, I think you could zip the folder that you want to include, fileinstall() it, and then have AutoIt unzip the folder. Unless I'm missing something. *I didn't check the help file.

Hope that helps,

Thanks for reading,

Ian

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

Speaking of another way, I think you could zip the folder that you want to include, fileinstall() it, and then have AutoIt unzip the folder.  Unless I'm missing something.  *I didn't check the help file.

Hope that helps,

Thanks for reading,

Ian

<{POST_SNAPBACK}>

Probably what I'm gonna go with, thanks for the input.

jason

Link to comment
Share on other sites

This is an old script. Posted Image Could probably use some improving. But does seem to produce some results. It creates a list for fileinstalling, from a directory.

; FileInstall Archiver Compiler Script.

#Region - Variables

Dim $print, $line, $ans, $filenum, $folder, $hc, $hd, $clist, $dlist, $len, $read, $dist, $progress
$dlist = 'DirList.txt'
$clist = 'ConvList.txt'
#EndRegion

#Region - Script

; Input from user

$filenum = InputBox('FileInstall Archiver', 'Enter file number of files in the source folder', '', '', -1, 125)
If @error = 1 Then Exit
Sleep(200)
$folder = InputBox('FileInstall Archiver', 'Name for folder to be extracted' & @CRLF & _
        ' into temporary directory at runtime', 'F_' & Int(Random(100, 999)), '', -1, 140)
If @error = 1 Then Exit
Sleep(200)
$ans = InputBox('FileInstall Archiver', 'Insert full path to the source folder location', 'C:\InstallRite', '', -1, 125)
If @error = 1 Then Exit
Sleep(200)

; Use dir command to create list

RunWait(@ComSpec & ' /c dir "' & $ans & '\" /a:-D /b /s > "' & $dlist & '"', '', @SW_HIDE)
Sleep(2000)
Run('notepad ' & $dlist)
MouseWheel('down', 100)
Sleep(3000)
WinClose('DirList - Notepad')

; Open files for read and write

$hd = FileOpen($dlist, 1)
$hc = FileOpen($clist, 2)
$len = StringLen($ans)
FileWriteLine($clist, 'Func Extract()')
FileWriteLine($clist, '   DirCreate(@TempDir & "\' & $folder & '")')
ProgressOn('Converting list', '')
Convert()
ProgressOff()
FileWriteLine($clist, 'EndFunc  ;===>Extract')
Install()
Remove()
FileClose($hd)
FileClose($hc)

; Sort files and copy to clipboard

FileDelete('DirList.txt')
FileMove($clist, @DesktopDir & "\FileInstall_Include.au3", 1)
Sleep(2000)
FileDelete($clist)
Run('Notepad.exe ' & @DesktopDir & "\FileInstall_Include.au3")
WinWaitActive('FileInstall_Include')
Send('^a')
Send('^c')
Sleep(1000)
MsgBox(0, 'FileInstall Archiver', 'Copied to clipboard' & @CRLF & @CRLF & 'Task is Complete')

#EndRegion

; Functions

Func Convert()
    While $line <> $filenum
        $line = $line + 1
        $read = FileReadLine('DirList.txt', $line)
        $dist = StringTrimLeft($read, $len)
        $print = '   FileInstall("' & $read & '", ' & '@TempDir & "' & '\' & $folder & $dist & '", 1)'
        Sleep(20)
        FileWriteLine($clist, $print)
        Sleep(20)
        $progress = $progress + (100 / $filenum)
        ProgressSet($progress)
    WEnd
EndFunc  ;==>Convert

Func Install()
    FileWriteLine($clist, @CRLF & "Func Install()")
    FileWriteLine($clist, "   Sleep(2000)")
    FileWriteLine($clist, "   Run(@ComSpec & ' /c ' & @TempDir & '\" & $folder & "\SETUP.EXE','', @SW_HIDE)  ;===>EXE ???")
    FileWriteLine($clist, "EndFunc  ;===>Install")
EndFunc  ;==>Install

Func Remove()
    FileWriteLine($clist, @CRLF & "Func Remove()")
    FileWriteLine($clist, "   Sleep(2000)")
    FileWriteLine($clist, '   DirRemove(@TempDir & "\' & $folder & '", 1)')
    FileWriteLine($clist, "EndFunc  ;===>Remove" & @CRLF)
EndFunc  ;==>Remove

:lmao:

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...