Les,

Codes a bit ruff at the moment but if I run the function by itself it works, in the script it fauls

if exist ("%systemdrive%\emran.txt")
?"It's there..."
$file = "%systemdrive%\emran.txt"
IF Open(1, $file) = 0
$x = ReadLine(1)
;WHILE @ERROR = 0
? "Line read: [" + $x + "]"
;$x = ReadLine(1)
? "Currentdate: [" + @DATE + "]"
;LOOP
Close (1)
ELSE
BEEP
? "Config file not opened, error code: [" + @ERROR + "]"
ENDIF

?"prefunction"

$DaysBetween=DateMath(@DATE,-7)

? "DaysBetween=" +$DaysBetween

;if over 90 days run
;endif

else