ixxy Posted November 13, 2007 Posted November 13, 2007 Hello there! I've used AutoIT for simple automation in the past, never really got around to doing anything advanced. I've had previous experience with NT Scripting language (batch scripting) which involves most of the console commands like DIR, FIND, etc. Is there an equivalent to these in AutoIT? I've read through the documentation but it didn't really help. Or is there a way I could use existing commands through Autoit, and have it work in a hybrid sort of way? ex: find /i "hello" < "C:\list.txt" >C:\setm.m3u Would there be a way to include that line in the script? (Also, would it be possible to output those results to a GUI instead of a file?) Thanks!
Moderators SmOke_N Posted November 13, 2007 Moderators Posted November 13, 2007 Run(@Comspec & ' /c find /i "hello" < "C:\list.txt" >C:\setm.m3u') Could try that and see if it works. 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.
PsaltyDS Posted November 13, 2007 Posted November 13, 2007 Would there be a way to include that line in the script? (Also, would it be possible to output those results to a GUI instead of a file?) Yes on both counts: #include <file.au3> Global $sSrc = "C:\List.txt" Global $sDest = "C:\setm.m3u" Global $sSearch = "hello" Global $avLines, $sResults If Not _FileReadToArray($sSrc, $avLines) Then MsgBox(16, "Error", "Error reading file: " & $sSrc) Exit EndIf For $n = 1 To $avLines[0] If StringInStr($avLines[$n], $sSearch) Then $sResults &= $n & ": " & $avLines[$n] & @CRLF EndIf Next MsgBox(64, "Debug: $sResults", $sResults) $hDest = FileOpen($sDest, 2) ; 2 = Overwrite If $hDest = -1 Then MsgBox(16, "Error", "Error writing file: " & $sDest) Exit EndIf FileWrite($hDest, $sResults) FileClose($hDest) I came to AutoIt myself because my .cmd NT shell scripts were getting way too complicated. Welcome to AutoIt! 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
ixxy Posted November 13, 2007 Author Posted November 13, 2007 Run(@Comspec & ' /c find /i "hello" < "C:\list.txt" >C:\setm.m3u')Could try that and see if it works.Yep it seems to work just fine.1. Anyway to hide the console window?2. Or does AutoIT have text/file manipulation commands of its own?
ixxy Posted November 13, 2007 Author Posted November 13, 2007 PsaltyDS; You answered a second too early! I will check out the example you provided. And a fellow nt scripter! /adds as friend.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now