
Originally Posted by
Kevin
Thank you for that very much! That's exactly what I was looking for

No problem, mate!
By the way, I wrote a custom little function which doesn't include the file extension to the result..
It also returns as "Untitled" when script hasn't been saved.
Check this out:
Code:
function ScriptName: string;
var
p, o: Integer;
begin
Result := ScriptFile;
case (Result = '') of
False:
if (Pos('.', Result) > 0) then
begin
o := 1;
repeat
p := PosEx('.', Result, o);
if (p > 0) then
o := (p + 1);
until (p = 0);
Result := Copy(Result, 1, (o - 2));
end;
True: Result := 'Untitled';
end;
end;
begin
ClearDebug;
WriteLn(ScriptName);
end.