Jump to content

From batch to autoit


ficofico
 Share

Recommended Posts

I guys, in my batch file I use this way to read variables from file .

copy setcartella2.bat + cartella2.txt $tmp$.bat > nul
call $tmp$.bat
del $tmp$.bat
del tempfile


del %cartella2%\*.txt

I want to translate this script into autoit script, but I'm very noob!!!!!

$cartella2 = FileOpen("cartella2.txt", 0)
$cartella =  FileReadLine($cartella2)
filedelete ($cartella"*.txt")

Obviously this code doesn't work.... who want to help me? :)

Link to comment
Share on other sites

Well, $tmp$.bat doesn't translate well. I can't tell if you mean to have literal dollar signs in the file name.

Here's something at least similar:

$TmpBat = "C:\Temp\Temp.bat"
FileCopy("setcartella2.bat", $TmpBat, 1) ; 1 = overwrite
$hFile = FileOpen($TmpBat, 1) ; 1 = append
FileWrite($hFile, FileRead("cartella2.txt"))
FileClose($hFile)
RunWait(@ComSpec & " /c " & $TmpBat)
FileDelete($TmpBat)
FileDelete("tempfile")
$iOptSav = Opt("ExpandEnvStrings", 1)
FileDelete("%cartella2%\*.txt")
Opt("ExpandEnvStrings", $iOptSav)

Look each of those commands up in the help file and see what they are doing and why those particular options are used. Even if it's not exactly what you want, it will help you figure it out.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...