Sign in to follow this  
Followers 0
ficofico

From batch to autoit

3 posts in this topic

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? :)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I have solved.....

filedelete ($cartella & "*.txt")

thank PsaltyDS, i think that i'll use this post again for ask for script issue...

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