You were close.
It is a Innerfuse Pascal Script version 2, which is a scripting language that uses a simplified Pascal/Delphi syntax and some basic functions from it.
Some do not exist, for example "Dec" it seems.
Here is the working modified version:
Code: Select all
program testscript;
var
moviesize: string;
filelength: integer;
begin
moviesize := getfield(fieldsize);
filelength :=length(moviesize) - 2;
ShowMessage('Filesize: "'+Moviesize+'" bytes');
While (filelength > 1) Do
begin
Insert(',', moviesize, filelength);
filelength := filelength - 3;
showmessage(moviesize);
end;
end.
You made an error in the Insert: you used "i" instead of your filelength variable.
Also, I initialized it at Length-2 since you have to insert the first separator two characters before the last character (i.e. 3 before the end).
I am not sure if the script engine includes formatting functions (as Format is not existing in it, it seems) so that way of inserting separators is probably easier than trying to format a number like what you were originally trying to do.
To get the size as single type (single = delphi's float type), there is
f := StrToFloat(moviesize);
but then you can't do much more with it...