Jump to content

Selecting files


Recommended Posts

I'm writing a script to open one file type with a running application and then have that application save the file in a new file format. It's using standard windows explorer file - open dialog, it's a VB app. What would be the best way to have the script select the next file to open in the current directory?

I could use an elaborate combination of sendkey's with tabs and arrow keys, but there will be hardly any error checking with that and it might go haywire.

Or maybe make a GUI and ask for the folder that contains all the files to be converted, then somehow store all the filenames as variables, increment through them and have it actually type (send) the filename to the file-open dialog. Except I don't know how to do that.

Any clever ideas?

This is the only part I'm stuck on.

-Scott

Link to comment
Share on other sites

What about this ?

; Shows the filenames of all files in the current directory, note that "." and ".." are returned.
$search = FileFindFirstFile("*.*")  

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    
    MsgBox(4096, "File:", $file)
WEnd

; Close the search handle
FileClose($search)
Link to comment
Share on other sites

@ScriptDir is where you are running your script. You can use FileChangeDir() to set your working directory.

<{POST_SNAPBACK}>

Is there a way to give the option to browse for the directory if I prompt for the directory location?
Link to comment
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
 Share

  • Recently Browsing   0 members

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