# Directory Dialog

## Recommended Posts

Hello

I'm trying to automate turbo XML to convert DTD's to XSD's. I have to enter a directory name, the source directory. The problem is, that I must "browse" to the target directory instead of entering the path. I provide a screenshot, just in case you don't understand what I mean.

So basically, what I'm trying to do, is converting the path (X:\path\to\DTDs) to "expand X:\" -> "expand path\" -> "expand to".....

Is there a ready solution for this? Or maybe some available code / function? Any help is appreciated.

##### Share on other sites

Hello

I'm trying to automate turbo XML to convert DTD's to XSD's. I have to enter a directory name, the source directory. The problem is, that I must "browse" to the target directory instead of entering the path. I provide a screenshot, just in case you don't understand what I mean.

So basically, what I'm trying to do, is converting the path (X:\path\to\DTDs) to "expand X:\" -> "expand path\" -> "expand to".....

Is there a ready solution for this? Or maybe some available code / function? Any help is appreciated.

maybe like this:

opt("GUIOnEventMode",1)

GUICtrlCreateLabel("File to Run",40,61)

$localfile=GUICtrlCreateInput("",110,60,100,16) GUICtrlSetState(-1,$GUI_ACCEPTFILES)

##### Share on other sites

maybe like this:

opt("GUIOnEventMode",1)

GUICtrlCreateLabel("File to Run",40,61)

$localfile=GUICtrlCreateInput("",110,60,100,16) GUICtrlSetState(-1,$GUI_ACCEPTFILES)

Thanks for the quick reply. Could you please provide some information about what this code does? I like to know what's going on.

##### Share on other sites

Thanks for the quick reply. Could you please provide some information about what this code does? I like to know what's going on.

You can check the autoit help file.

##### Share on other sites

Actually in the state he/she has it, it doesn't do anything, but in essence they are suggesting that you write a GUI, and allow accepting files... essentially writing your own FileSelectFolder() option.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

You can check the autoit help file.

Hmm but I haven't made the dialog. The dialog has been created by the program I'm trying to automate. So I have no access to the dialog and I can't change its properties or add items etc... (or can I?).

More Ideas?

##### Share on other sites

More Ideas?

I have written it myself. It wasn't too hard after all.

; Select directory
Dim $pathbits = StringSplit($path,"\")
For $i = 1 to$pathbits[0] Step 1
If StringLower($pathbits[$i]) == "c:" Then
Send("Local")
Else
Send($pathbits[$i])
EndIf
Next
Send("{ENTER}")

What I'm doing is this:

Imagine using C:\temp as $path 1) I split the string into an array of strings, in this case:$pathbits[1] = C: and \$pathbits[2] = temp

2) If current pathbit = C: (first loop), then I do send("Local") to the application, because my C-drive has the label "Local disk".

3) for each subdirectory, send the subdirectory (the GUI will select the sent directory name) and expand it with NUMPADADD (+).

Note: this will probably not work with other drives, because some of them (e.g. cd-rom) have a label that doesn't match the driveletter.

Edited by deco

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...