Page 1 of 1

Posted: 21 Aug 2011, 20:21
by Ken29
Hi guys,

I work on a script at the moment and I need to get the file names of a directory. I tried to use this :

var
searchResult : TSearchRec;

begin
// Try to find regular files matching Unit1.d* in the current dir
if FindFirst('Unit1.d*', faAnyFile, searchResult) = 0 then
begin
repeat
ShowMessage('File name = '+searchResult.Name);
ShowMessage('File size = '+IntToStr(searchResult.Size));
until FindNext(searchResult) <> 0;

// Must free up resources used by these successful finds
FindClose(searchResult);
end;
end;


But when I compile : TSearchRec isn't recognize as a valid variable (undeclared type TSearchRec) !
I also tried with the Pascal var type : SearchRec, but it doesn't seemed to be valid as well...
So I had a look to the Usine script references and I didn't find the functions Findfirst, FindNext and FindClose ???

Is there another way to do it ?

Thanks

Kenan

Posted: 21 Aug 2011, 20:55
by nay-seven
hope all scripts gurus are not in holidays...

Posted: 22 Aug 2011, 08:47
by bsork
Unless Senso has something undocumented up his sleeve, it seems that it's not possible to do these things from within a script.

I too had a look at the scripts references and couldn't find anything that lists files names.

Posted: 23 Aug 2011, 13:18
by Ken29
Too Bad,

Thanks for the answer...

Kenan