Page 1 of 1
Return Directory as List In Client
Posted: Fri Mar 21, 2014 7:05 pm
by Danny
Hello,
I'm trying to create a script expression for Switch Client. I'd like to have the user choose from a drop down list of folder already created on the server. I'm not sure if this can be done and am looking for help.
If anyone has something like this or could get pointed in the right direction, I'd appreciate it!
Thanks
Danny
Return Directory as List In Client
Posted: Fri Mar 21, 2014 8:04 pm
by dkelly
What determines the "drop down list of a folder"? Should the script read the contents of a directory and return the list of subdirectories?
Return Directory as List In Client
Posted: Fri Mar 21, 2014 8:23 pm
by Danny
Yes, I was hoping to have the script point to a certain folder and list the folders with it.
So, it would watch an "Active Jobs" folder for example and list the folders, not the contents of any of the folders. If possible could it only list the folders starting with 6 digits?
Active Jobs
1111111 A
2222222 B
3333333 C
zBackup
In the example structure above, I was hoping to have the drop down consist of the 1111111 A, 2222222 B and 3333333 C.
I guess if it showed other folders, it wouldn't be the end of the world.
Thanks
Return Directory as List In Client
Posted: Fri Mar 21, 2014 9:31 pm
by dkelly
var theDir = new Dir("/Server/Active Jobs");
var theEntries = theDir.entryList("*", Dir.Dirs, Dir.Name);
var list = new Array;
for (var i = 0; i < theEntries.length; i++) {
if (theEntries == '.' || theEntries == "..")
continue;
list.push(theEntries);
}
list;
Return Directory as List In Client
Posted: Fri Mar 21, 2014 9:48 pm
by Danny
Works perfect! That's great, I wasn't even in the ball park.
Thanks a lot!