Jump to content

FileOpenDialog with variables


Recommended Posts

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!!

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

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

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

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