Sub folder help

Hi all,

I'm trying to create a project startup ui which reads the folders from a directory, so I can access my xrefs,scenes, assets etc on a specific job. I'm starting with the main part of the script which would be to read the scene folders. Here is what I have so far:

paths = "C:\\V01_Bathroom"
dir_array = GetDirectories (paths+"\*")

for c = 1 to dir_array.count do (
tokens = filterString dir_array[c][1] "C:\\"
)

--tokens = filterString dir_array "C:\\"
print tokens

try(DestroyDialog Save_Lib)catch()
rollout Save_Lib "Project Manager" width:425 height:173
(
dropDownList ProjectList "Project" height:250 width:99 pos:[13,70] items:tokens
) createDialog Save_Lib

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
br0t's picture

Your path is wrong and you

Your path is wrong and you are using filterString on the first element of the current element of dir_array, but that does not exist because dir_array contains strings, not arrays. If I get it right you are trying to get all subfolders of your project folder and display their names in the dropdownlist, maybe like so:

paths = @"C:\\Users\\YourName"
dir_array = GetDirectories (paths+"\\*")
 
tokens = #()
 
for c = 1 to dir_array.count do (
	folders = filterString dir_array[c] "\\" -- e.g. "C:\\Users\\YourName\\Desktop" will yield #("C:", "Users", "YourName", "Desktop")
	append tokens folders[folders.count] -- append last element, which is the subfolder
)--end for
 
try(DestroyDialog Save_Lib)catch()
rollout Save_Lib "Project Manager" width:425 height:173
(
	dropDownList ProjectList "Project" height:99 width:99 pos:[13,70] items:tokens
) createDialog Save_Lib

And please read this: http://www.scriptspot.com/forums/scriptspot-how-to/how-to-post-code-snip...

Cheers

Never get low & slow & out of ideas

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.