Sign in to follow this  
Followers 0
Scottswan

Selecting files

7 posts in this topic

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

Share this post


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

Share this post


Link to post
Share on other sites

What about this ?

Yea, that might work, thanks! I didn't even think to look at that one as I already know where my files are.

The current directory is the directory that the script is running in right?

-Scott

Share this post


Link to post
Share on other sites

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

Share this post


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

Share this post


Link to post
Share on other sites

FileOpenDialog ?

<{POST_SNAPBACK}>

Close, but FileSelectFolder is perfect!

Man, I'm just not finding things well today.

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