Jump to content

Recommended Posts

Posted

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.

Posted

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)

Posted

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. :)

Posted

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:
  • Moderators
Posted

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.

Posted

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?).

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...