Jump to content

FileInstall for multiple files in subfolders


MHz
 Share

Recommended Posts

FileInstall does not support wildcards as the source. Many files could be differcult manually entering into script.

What I would like is for a method of scanning a folder of files which are structured in subfolders. Then using FileInstall to extract them to a temp directory, maintaining structure, when executed.

Basically using autoit as a archiver, I guess.

Has anyone got solution of how this could be done?

Link to comment
Share on other sites

FileInstall does not support wildcards as the source. Many files could be differcult manually entering into script.

What I would like is for a method of scanning a folder of files which are structured in subfolders. Then using FileInstall to extract them to a temp directory, maintaining structure, when executed.

Basically using autoit as a archiver, I guess.

Has anyone got solution of how this could be done?

<{POST_SNAPBACK}>

write a script that does a recursive directory search and writes the fileinstall script?

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

I'd like to make a UDF for you but I am too sleepy, so I give you a good hint only.

A working recursive searching by Larry!

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

'As it is' it makes a list of all folders, but it can be easily moded as needed. The difficult part has been made by Larry. :)

Edit: typo.

Edited by ezzetabi
Link to comment
Share on other sites

Thanks for the hint ezzetabi,

I used the dir command instead. Perhaps not as good, but I managed to get a working script. Well, it does not compile but I did not want it to. So it can be used as a include script or pasted into the main script.

Dim $print, $line, $ans, $filenum, $folder, $handle1, $handle2, $len, $read, $dist, $progress

$filenum = InputBox('FileInstall Archiver', 'Enter file number of files in the source folder')
Sleep(200)
$folder = InputBox('FileInstall', 'Name for folder to be extracted' & @CRLF & _
      ' into temporary directory at runtime')
Sleep(200)
$ans = InputBox('FileInstall Archiver', 'Insert full path to the source folder', 'C:\')
RunWait(@ComSpec & ' /c dir ' & $ans & '\ /a:-D /b /s > DirList.txt', '', @SW_HIDE)
Sleep(2000)
Run('notepad DirList.txt')
MouseWheel('down', 100)
Sleep(3000)
WinClose('DirList - Notepad')
$handle1 = FileOpen('DirList.txt', 1)
$handle2 = FileOpen('ConvList.txt', 2)
$len = StringLen($ans)
FileWriteLine('ConvList.txt', 'Dircreate(@TempDir & "' & $folder & '")')
ProgressOn('Converting list', '')
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('ConvList.txt', $print)
   Sleep(20)
   $progress = $progress + (100/$filenum)
   ProgressSet($progress)
Wend
ProgressOff()
FileWriteLine('ConvList.txt', @CRLF & "Func Install()")
FileWriteLine('ConvList.txt', "Sleep(2000)")
FileWriteLine('ConvList.txt', "Run(@ComSpec & ' /c ' & @TempDir & '\" & $folder & "\SETUP.EXE')  ;===>EXE ???")
FileWriteLine('ConvList.txt', "EndFunc  ;===>Install")
FileClose($handle1)
FileClose($handle2)
FileDelete('DirList.txt')
FileMove("ConvList.txt", @DesktopDir & "\FileInstall_Include.au3", 1)
Sleep(2000)
FileDelete('ConvList.txt')
Run('Notepad.exe ' & @DesktopDir & "\FileInstall_Include.au3")
WinWaitActive('FileInstall_Include - Notepad')
Send('^a')
Send('^c')
Sleep(1000)
MsgBox(0, 'FileInstall Archiver', 'Copied to clipboard' & @CRLF & @CRLF & 'Task Complete')

Edit: Added Dircreate in tempdir to ensure operation and a written function for an executable. Just need to alter run(exe) command then enter call function afterwards. More complete now?

Edited by MHz
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...