norjms Posted December 3, 2009 Posted December 3, 2009 I'm having a problem that is bugging me anyone know/see why this won't work? #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.1.6 (beta) Author: James Norman Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- #Include <File.au3> $DoFolderList = "dir /AD /B " & ">> " & @ScriptDir & "\folderlist.txt" MsgBox(64, "Debug", "$DoFolderList = " & $DoFolderList) RunWait($DoFolderList, @ScriptDir & "\Rip Source\") $FolderList = FileOpen(@ScriptDir &"folderlist.txt", 0) ; Check if file opened for reading OK If $FolderList = -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($FolderList) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line) Wend FileClose($FolderList)
anzacfalcon Posted December 3, 2009 Posted December 3, 2009 I'm having a problem that is bugging me anyone know/see why this won't work? #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.1.6 (beta) Author: James Norman Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- #Include <File.au3> $DoFolderList = "dir /AD /B " & ">> " & @ScriptDir & "\folderlist.txt" MsgBox(64, "Debug", "$DoFolderList = " & $DoFolderList) RunWait($DoFolderList, @ScriptDir & "\Rip Source\") $FolderList = FileOpen(@ScriptDir &"folderlist.txt", 0) ; Check if file opened for reading OK If $FolderList = -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($FolderList) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line) Wend FileClose($FolderList) FileClose($FolderList) has to be FileClose($line)
AndyG Posted December 3, 2009 Posted December 3, 2009 (edited) Hi, short version...#include <Array.au3> #include <File.au3> $filename="folderlist.txt" $aFolder = _FileListToArray(@ScriptDir,"*",2) ;writes all folders into the array $aFolder _arraydisplay($aFolder) ; not necessary $hFile=fileopen($filename,1) ;append to existing file, like >> in DOS _filewritefromarray($hFile,$aFolder,1,0) ;writes the foldernames into the textfile fileclose($hFile) or... #include <Array.au3> #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.1.6 (beta) Author: James Norman Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- #Include <File.au3> $DoFolderList = "dir /AD /B >> folderlist.txt" MsgBox(64, "Debug", "$DoFolderList = " & $DoFolderList) RunWait(@ComSpec & " /c " &$DoFolderList);, @ScriptDir & "\Rip Source\") $FolderList = FileOpen(@ScriptDir &"\folderlist.txt", 0) ; Check if file opened for reading OK If $FolderList = -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($FolderList) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line) Wend FileClose($FolderList) /Edit/ fixed copy-error in first script Edited December 3, 2009 by AndyG
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