View Full Version : select drive dialog


Fathom
09 September 2007, 09:41 AM
I'm trying to write some proj management scripts. Is there a command that brings up a dialog box that lets the user select a drive only? I just need the user to select the drive that he wants the proj created on.

trancor
09 September 2007, 05:00 PM
why just the drive? using "fileBrowserDialog" with flag "-m 4" will bring up a folder select.

fileBrowserDialog -m 4 -fc "YourCommand";

your proc you call up gets two new variables -


proc YourCommand(string $folder, string $fileType){}

The fileType isn't used for folders, but it is needed for the fileDialog to work.

Then you could just break down the folder name picked and just find the letter before the : so that you can get the drive letter no matter what folder the user picks. But wouldn't you want the user to select the actual folder everything is in? Anyway, this would be using the tokenize command, this will make it easy for you to find the drive if the user selects a folder.


string $test="c:/blah";
string $ts[];
tokenize $test ":" $ts;
print $ts;


The ":" in the tokenize command means- split appart the string when ever there is a :

That will return this -
c
/blah

so $ts[0] would equal "c", being the drive letter.

Good luck on the script

Fathom
09 September 2007, 03:21 PM
Thanks trancor iwill check it out! :-)

Fathom
10 October 2007, 03:00 PM
Just a question trancor. In the docs it suggests using the fileDialog command rather than the fileBrowserDialog if one wishes to create cross platform. I'm on a mac and the fileBrowserDialog ain't working. And the fileDilaog only seems to apply to files.
The fileDialog command seems limited. can you suggest any other ideas?

Fathom
10 October 2007, 03:28 PM
ah actually I'm lying. It's working and I am figuring it out. Sorry! :-)

CGTalk Moderation
10 October 2007, 03:28 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.


1