Sign in to follow this  
Followers 0
deco

Directory Dialog

8 posts in this topic

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.

Posted Image

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 this post


Link to post
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.

Posted Image

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 this post


Link to post
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 this post


Link to post
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. :mellow:

Share this post


Link to post
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.


[center]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.[/center]

Share this post


Link to post
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?).

Share this post


Link to post
Share on other sites

More Ideas?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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
    Send("{NUMPADADD}")
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0