Jump to content

Recommended Posts

Posted (edited)

Hello i've got a Problem. I had written a little Program to Convert some txt Files into PDF. The job of Autoit it is to look into a folder .. list the Files and Start a Program in a loop that converts the txt file into PDF. After ca. 60-70 files autoit stops an post an Error that too much files are open. How can i Fix this Problem?

Sorry for my BAD English.

Thx for Help.

Edited by quicksilver
Posted

Posted Image

$ini_file  = "dirlist.ini"

$file = FileOpen($ini_file, 0)

; Variablen einlesen
$program = FileReadLine($file,1)
$workdir = FileReadLine($file,2)
$sicherung = FileReadLine($file,3)
$filenames = FileReadLine($file,4)
FileClose($file)

$search = FileFindFirstFile($filenames)  

; Check if the search was successful
If $search = -1 Then
   ;MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    $execute = $program&" "&$workdir&$file
    $source = $workdir&$file
    $dest = $sicherung&$file
    RunWait($execute,$workdir)
    FileMove($source, $dest)
   ; --- logfile
    $files = FileOpen($ini_file, 0)

; Variablen einlesen
    $pretext = FileReadLine($files,5)
    $logfile = FileReadLine($files,6)
    $aftertext = FileReadLine($files,7)
    FileClose($files)
    $Input_Date = @MDAY & "-" & @MON & "-" & @YEAR
    $Input_Time = @HOUR &  ":" & @MIN & ":" & @SEC
    $thetime = "Datum und Uhrzeit: "&$Input_Date&" - "&$Input_Time&" - "&$file

; Logfile Erstellen
    $files = FileOpen($logfile, 1)
    FileWriteLine($files, $pretext)
    FileWriteLine($files, $thetime)
    FileWriteLine($files, $aftertext) 
   ; --- logfile    


WEnd

; Close the search handle
FileClose($search)
Posted

­···
; Logfile Erstellen
    $files = FileOpen($logfile, 1)
    FileWriteLine($files, $pretext)
    FileWriteLine($files, $thetime)
    FileWriteLine($files, $aftertext) 
    FileClose($files); ***
    ; --- logfile   
···

Posted

­···
    FileClose($files); ***
   ; --- logfile    
···
Or use _FileWriteLog().

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

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
×
×
  • Create New...