Jump to content

Recommended Posts

Posted

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

  • Moderators
Posted

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()

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.

Posted

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

  • 7 months later...
Posted

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

Posted

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

Posted

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:

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...