hi!
if i use the command uls in textport:
uls -d -p <some_path>
to list directories, it returns everything ok.
But if i want to use it in DA:
adding a string parameter and turning on “Use Menu”, and going over to Menu Script tab, putting the command uls -d -p <some_path>, it truncates the list, so half of the directories is missing, and when i choose one from the menu it puts another ones name in the string field.
<some_path> is a mapped drive on windows J
So is this a bug or I'm missing something?
Thanks in advance
uls command bug with DA?
3458 7 1- buki
- Member
- 1769 posts
- Joined: Dec. 2006
- Offline
- graham
- Member
- 1907 posts
- Joined: Nov. 2006
- Online
Menu scripts require value/name pairs. The first part is the actual value, the second is the display name. That's why your list is half as long and has the wrong values.
If your search result is something like this “ folder1 folder2 folder3 folder4” then your actual menu will have 2 items, folder2 and folder4. When you choose folder2 the value returned will be folder1, ect.
If you look in the help docs for the Operator Type Properties window there should be an example of creating one from a single list. It should just be something like a For loop over the search result that adds the current element twice to a new string.
If your search result is something like this “ folder1 folder2 folder3 folder4” then your actual menu will have 2 items, folder2 and folder4. When you choose folder2 the value returned will be folder1, ect.
If you look in the help docs for the Operator Type Properties window there should be an example of creating one from a single list. It should just be something like a For loop over the search result that adds the current element twice to a new string.
Graham Thompson, Technical Artist @ Rockstar Games
- buki
- Member
- 1769 posts
- Joined: Dec. 2006
- Offline
Thanks for the quick answer, will look deeper into it. Was reading that section in the help docs, just i'm not a genius when it comes to scripting.
Thanks!
Thanks!
daniel bukovec | senior fx td | weta digital
qLib -- http://qlab.github.io/qLib/ [qlab.github.io]
qLib -- http://qlab.github.io/qLib/ [qlab.github.io]
- buki
- Member
- 1769 posts
- Joined: Dec. 2006
- Offline
hi again!
Probably my knowledge is too shallow , but if i type a simple example:
set num = 1234
echo $num
nothing happens, and the $num is colored red, as it is in a bad syntax
of course this works in textport.
Also tried the example in the docs
here = `execute(“oppwf”)`
result = “”
for index = 0 to `opninputs($here)`
result = $result + “ ” + `opfullpath($here + “../” + opinput($here, $index))` + “ ” + `opinput($here, $index)`
end
echo $result
which will give bunch of red text in it.
I tried this on null which had another null connected to it
not working either.
I don't understand
Probably my knowledge is too shallow , but if i type a simple example:
set num = 1234
echo $num
nothing happens, and the $num is colored red, as it is in a bad syntax
of course this works in textport.
Also tried the example in the docs
here = `execute(“oppwf”)`
result = “”
for index = 0 to `opninputs($here)`
result = $result + “ ” + `opfullpath($here + “../” + opinput($here, $index))` + “ ” + `opinput($here, $index)`
end
echo $result
which will give bunch of red text in it.
I tried this on null which had another null connected to it
not working either.
I don't understand
daniel bukovec | senior fx td | weta digital
qLib -- http://qlab.github.io/qLib/ [qlab.github.io]
qLib -- http://qlab.github.io/qLib/ [qlab.github.io]
- buki
- Member
- 1769 posts
- Joined: Dec. 2006
- Offline
any idea why this is not working?
daniel bukovec | senior fx td | weta digital
qLib -- http://qlab.github.io/qLib/ [qlab.github.io]
qLib -- http://qlab.github.io/qLib/ [qlab.github.io]
- graham
- Member
- 1907 posts
- Joined: Nov. 2006
- Online
I'm not sure. I can't seem to get the examples to work properly either. I hate Hscript. My suggestion would be to do it using Python instead.
Something like the following will give you the same result as uls -d -p somepath.
import os
search_path = “somepath”
dir_contents = os.listdir(search_path)
dir_list =
for dir in dir_contents:
if os.path.isdir(os.path.join(search_path, dir)):
dir_list.append(dir)
dir_list.append(dir)
return dir_list
Something like the following will give you the same result as uls -d -p somepath.
import os
search_path = “somepath”
dir_contents = os.listdir(search_path)
dir_list =
for dir in dir_contents:
if os.path.isdir(os.path.join(search_path, dir)):
dir_list.append(dir)
dir_list.append(dir)
return dir_list
Graham Thompson, Technical Artist @ Rockstar Games
- buki
- Member
- 1769 posts
- Joined: Dec. 2006
- Offline
Thanks a lot Graham, i will try it
daniel bukovec | senior fx td | weta digital
qLib -- http://qlab.github.io/qLib/ [qlab.github.io]
qLib -- http://qlab.github.io/qLib/ [qlab.github.io]
- Antoine Durr
- Member
- 321 posts
- Joined: July 2005
- Offline
graham
I'm not sure. I can't seem to get the examples to work properly either. I hate Hscript. My suggestion would be to do it using Python instead.
Something like the following will give you the same result as uls -d -p somepath.
import os
search_path = “somepath”
dir_contents = os.listdir(search_path)
dir_list =
for dir in dir_contents:
if os.path.isdir(os.path.join(search_path, dir)):
dir_list.append(dir)
dir_list.append(dir)
return dir_list
how about just:
foreach f (`system(“ls /some/path/to/list”)`)
echo “$f $f”
end
-
- Quick Links