Openfolder function


#1

Hey there!

I have a problem with this code:
theDialog = dotNetObject “System.Windows.Forms.OpenFileDialog” --create a OpenFileDialog
theDialog.title = “Open Folder” --set the title
result = theDialog.showDialog() --display the dialog, get result into variable
result.ToString() --when closed, convert the result to string
result.Equals result.OK --returns TRUE if OK was pressed, FALSE otherwise
result.Equals result.Cancel --returns TRUE if Cancel was pressed, FALSE otherwise
theFilenames = theDialog.fileNames --the selected filenames will be returned as an array

It opens the OpenFileDialog but you need to select a file. I’m looking for the exact same thing where you don’t have to select a file, like in a output path for a render: you go on the right folder you type: “SHOT100.jpg”, hit “ok” and it goes like “C:\mypath…\SHOT100.jpg” even if the file SHOT100.jpg doesn’t exist yet.
How does it work with dotnet?

Thank you!


#2

if file doesn’t exist you have to use System.Windows.Forms.SaveFileDialog instead


#3

Thanks, that works.
Is there a way to not have “the save as type” dropdownlist?


#4

It’s a part of built-in .net dialog. There might only a ‘hack’ to hide or remove its UI element.


#5

Difficult hack?


#6

Why do you want to hide it?


#7

It simply bothers me, but whatever. It works as good. Thanks :wink: