Welcome to %s forums

BrainModular Users Forum

Login Register

Get a file list in a script

I need help on a Patch
Post Reply
Ken29
Member
Posts: 116
Contact:

Unread post by Ken29 » 21 Aug 2011, 20:21

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

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 21 Aug 2011, 20:55

hope all scripts gurus are not in holidays...

bsork
Site Admin
Posts: 1334
Location: Asker, Norway
Contact:

Unread post by bsork » 22 Aug 2011, 08:47

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.
Bjørn S

Ken29
Member
Posts: 116
Contact:

Unread post by Ken29 » 23 Aug 2011, 13:18

Too Bad,

Thanks for the answer...

Kenan

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests