reading folder on a mapped network drive - not work

Post Reply
bepsy72
Newbie
Posts: 4
Joined: Thu Sep 04, 2014 9:43 am

reading folder on a mapped network drive - not work

Post by bepsy72 »

Hi,
I'm trying to read a folder on a mapped network drive, but is doesn’t work.
The strange things is that the script work when i test it with a fixture pane in SwitchScripter, and give me the results.
When i run the script whitin a flow i got an error. (Error in line 56 of script : Error. Trying to access undefined member '3')

Any suggestion?




Here my code

function GetMyFolderList(mydir){

var MyDir = new Dir(mydir);
var FolderList = MyDir.entryList("*");
return FolderList;
}


function jobArrived( s : Switch, job : Job )
{

// work on test, not work in a flow
var lista = GetMyFolderList("X:\\");
s.log(1,lista[3]); // Error in line 56 of script : Error. Trying to access undefined member '3'

// work on test, work in a flow
var lista = GetMyFolderList("C:\\");
s.log(1,lista[3]);


}
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: reading folder on a mapped network drive - not work

Post by jan_suhr »

Have you tried with another item from the list, like the first one [0]
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
bepsy72
Newbie
Posts: 4
Joined: Thu Sep 04, 2014 9:43 am

Re: reading folder on a mapped network drive - not work

Post by bepsy72 »

Yes, I've tried now, but nothing to do. Same error.
Error in line 54 of script : Error. Trying to access undefined member '0'

Its probally Javascript that doesn't read a network drive?
jan_suhr
Advanced member
Posts: 592
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: reading folder on a mapped network drive - not work

Post by jan_suhr »

Have you tried with the server name instead of X, like //SERVER_NAME/
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
cstevens
Member
Posts: 103
Joined: Tue Feb 12, 2013 8:42 pm

Re: reading folder on a mapped network drive - not work

Post by cstevens »

I'm not sure that's a valid call for an entry list. It should have 3 arguments like this:

entryList( filter : String, filterSpec : Number, sortSpec : Number )

or in your code

var FolderList = MyDir.entryList( "*.*", Dir.Files, Dir.Time);

That would return all files sorted by modified date.

If that doesn't work try outputing the results in a log message:

s.log(1, lista.toString());

to see if you're returning anything valid from your function call.
bepsy72
Newbie
Posts: 4
Joined: Thu Sep 04, 2014 9:43 am

Re: reading folder on a mapped network drive - not work

Post by bepsy72 »

I try with //SERVER NAME/ and it work fine!!!
:D Thanks!!
Post Reply