Jump to content

Recommended Posts

Posted

Hello again :)

I just found a heck of a *.bat file, which I would really like to include in my program.

All it does is create around a thousand Null-files.

Is there some kind of tool that will convert a bat file to Auto-it script?

Pleaaaaase say yes! :lmao:

Posted

Well it's basically this line just repeated a lot (with different filenames ofcourse :) )

type nul > %windir%/winsxs/backup/x86_hid-user.resources_31bf3856ad364e35_6.0.6000.16386_zh-cn_c2f2386dd569373b.manifest

Yes I know that I don't need this bat fil per se, but i would really prefer not to have to copy+paste these 1000 or so filenames into Au3

Posted

This is just modified code from the AutoIT Helpfile for FileReadLine...just change null.bat to your batfile's path and name

Dim $Output
$File = FileOpen("null.bat", 0)

; Check if file opened for reading OK
If $File = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
While 1
    $Line = FileReadLine($File)
    If @error = -1 Then ExitLoop
    If $Line <> '' Then $Output &= 'Run(@Comspec & " /c ' & $Line & '")' & @CRLF
WEnd

FileClose($File)
FileWrite(@ScriptDir & "\NullAutoItScript.au3", $Output)

This creates a new file called "NullAutoItScript.au3" that will run the batfile's code in AutoIT.

If you are combining text from several batfiles, look up _FileListToArray and For Loops

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