Sign in to follow this  
Followers 0
MrChris

Folder 2 au3 via FileInstall

9 posts in this topic

I searched the Scripts and Scraps but didnt really find what I was maybe looking for but,

Is there any script that might already be made to Automaticly parse a whole folder for files and subfolders and populate it to a AU3 file with FileInstall functions? Kinda like the Reg2AU3 one someone refered me to a while back?

Thanks,

MrChris

Share this post


Link to post
Share on other sites



Won't work, the FileInstall() has to be a litteral string for the "Source". Unless you want to have it to copy the .au3 in question and write the found input to a new .au3 and delete the old one.

Shouldn't be hard to do that... You can use a directory recurse ... and FileWriteLine or FileWriteToLine or FileRead()/FileDelete()/FileWrite()


[center]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.[/center]

Share this post


Link to post
Share on other sites

Unless you want to have it to copy the .au3 in question and write the found input to a new .au3 and delete the old one.

This might be Ok i think. I was just looking to parse an entire folder that has like 100+ files in it in different subfolders then take that output and past it into my AU3 file where I need it to go. Is there a script that does this already or close to it?

MrChris

Share this post


Link to post
Share on other sites

My contextmenu extension program "CMenu" does have the ability. You can find it here. :)

Share this post


Link to post
Share on other sites

I am also trying to parse a folder for all files to output to a AU3 file to use via the FileInstall function. How can this be done in CMenu? I dont understand where in CMenu this can be done.

Thanks,

GoogleDude

Share this post


Link to post
Share on other sites

Please forgive my ignorence but how do I use that to parse a folder for file names to use with FileInstall in my script. I played with it but it looks like its a Installer that someone made.

I will admit that there is a LOT about AutoIt I have to learn.

GoogleDude

Share this post


Link to post
Share on other sites

Just use AutoIt Archive Script in SendToA3X (the successor/alternative to CMenu). Right click on the folder to process and use Send To -> AutoIt Archive Script. It should create a Au3 script outside of the folder with all the FileInstall()'s done for you so you can then just enhance on the functions created for you.

:shocked:

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I was working on a systme for automatically producing installers by wrapping an entire directory, here is the code i came up with:

It works to an extent, but i never got it fully polished.. sounds like what you want. (im sure i posted a thread about it, but apparently not)

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.2.0
 Author:         tAK
 
 Script Function:
    Automatically Create AutoIT v3 script containing FileInstall details for Entire directory Tree

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <file.au3>
#include <Array.au3>

Dim $a_FilesToInstall

$au3ScriptFile = FileOpen("C:\TEMP\WrappedInstallFile.au3", 10)
$BatFile = FileOpen("C:\TEMP\GetDir_Batfile.bat", 10)
$Folder = FileSelectFolder("", "")
$Drive = StringLeft($Folder, 2)

FileWriteLine($BatFile, "@ECHO OFF")
FileWriteLine($BatFile, "CD "&'"'&$Folder&'"')
FileWriteLine($BatFile, $Drive)
FileWriteLine($BatFile, "Dir /b /s >>C:\TEMP\FilesToInstall")
FileWriteLine($BatFile, "exit")
FileClose($BatFile)

RunWait("C:\TEMP\GetDir_Batfile.bat", "", @SW_HIDE)
FileDelete("C:\TEMP\GetDir_Batfile.bat")
_FileReadToArray("C:\TEMP\FilesToInstall", $a_FilesToInstall)
;_ArrayDisplay($a_FilesToInstall, "a_FilesToInstall")
FileDelete("C:\TEMP\FilesToInstall")

$x = 1
For $x = 1 to $a_FilesToInstall[0] - 1
    $IsNotAFolder = FileGetAttrib($a_FilesToInstall[$x])
    If StringInStr("D", $IsNotAFolder, 0) >= 1 Then
        FileWriteLine($au3ScriptFile, 'DirCreate("'&$a_FilesToInstall[$x]&'")')
        ContinueLoop
    Else
    FileWriteLine($au3ScriptFile, 'FileInstall("'&$a_FilesToInstall[$x]&'", "'&$a_FilesToInstall[$x]&'", 1)')
    EndIf
Next
FileClose($au3ScriptFile)

Exit
Edited by tAKTelapis

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
Sign in to follow this  
Followers 0