Sign in to follow this  
Followers 0
darcaro

FileOpenDialog with variables

6 posts in this topic

I would like to use the FileOpenDialog function to pass a variable to and/or from an external program (or DOS batch file). Is there any way to assign a variable to the path, say $PATH is = "c:\windows" , then use that variable in the function and when I select the file, send back the filename in a variable? Any help would be greatly appreciated. thanks!!

Share this post


Link to post
Share on other sites



Example from HelpFile - see FileOpenDialog

$message = "Hold down Ctrl or Shift to choose multiple files."

$var = FileOpenDialog($message, @WindowsDir & "\", "Images (*.jpg;*.bmp)", 1 + 4 )

If @error Then
    MsgBox(4096,"","No File(s) chosen")
Else
    $var = StringReplace($var, "|", @CRLF)
    MsgBox(4096,"","You chose " & $var)
EndIf

Share this post


Link to post
Share on other sites

You do know that fileopendialog retrns the filename of the file you selected?

Share this post


Link to post
Share on other sites

thanks for your replies - I guess what I want to do is be able to assign the filename to a variable (which the function already does) , but use it in another program , like a DOS batch file or some other external program. Is that possible?

Share this post


Link to post
Share on other sites

There are several ways to make your data avialable to another program.

Bascialyl you have to write it to somewhere it can read, this could be -

1. A File

2. A registry Key

3. a stdin stream

4. A network socket

5. windows clipboard

6. some other location in memory (carefull...)

Share this post


Link to post
Share on other sites

Thank you for the great replys - I guess the best option would be to store the data in a temporary text file. Is there an easy way to just write the filename to a text file?? I could then use it from there for what I want to do.

I would also like to define the path name externally (ie, have the fileopendialog run, but use a variable for the path name, file type, etc ) Is there a way to specify a variable in the "command line", and have the function use it?

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