dim $PostscriptFile='20121123172655.ps'
dim $copies=1
dim $pages=1
$file = FileOpen($PostscriptFile, 0)
If $file = 0 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
; Read in lines of text until the EOF is reached
While 1
Local $line = FileReadLine($file)
If @error = -1 Then ExitLoop
if StringInStr($line,"%%Pages:",1,2) >0 then
$array1= StringRegExp($line,"%%Pages:\h\(d+)",3)
$pages = Number($array1[0])
EndIf
if StringInStr($line,"/#copies",1,1)>0 then
$array2= StringRegExp($line,"/#copies\h\(d+)",3)
$copies = Number($array2[0])
EndIf
WEnd
FileClose($file)
MsgBox(0,"total pages",$copie * $pages)
Partager