Sign in to follow this  
Followers 0
quicksilver

To much open Files

6 posts in this topic

#1 ·  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

Share this post


Link to post
Share on other sites



This is a system limitation. It's can be increased, but this is extensive way. Most likely this is mistake in the your script, that open too many files at once. Look in your script to avoid situation, when you open another file when not closed previous. Or post your script here.

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

­···
    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 *

Share this post


Link to post
Share on other sites

Yeah it works :whistle: Thx Lxp

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