Accessing the open / save dialog

2 posts / 0 new
Last post
Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57
Accessing the open / save dialog

The common way to use an open / save dialog in IDEAScript is the following:

Sub Main
     Dim fileName as string
     Dim opendlg as object
     Set opendlg = CreateObject(Ideaex.SaveOpenDialog”)
     Opendlg.DisplayDialog TRUE
     fileName = opendlg.SelectedFile
     Set db = client.OpenDatabase(fileName)
End Sub

I found an alternate way today.  Instead of using the DisplayDialog you use the FileSaveOpen as it allows you to specify the type, the default extension, the default name and the filter.  So if you want to open or save a text file in your default working directory you might have something like this:

Opendlg.FileSaveOpen FALSE, "txt",  working_directory & "Text", "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"

The first parameter decides if it is a open or a save dialog.

 

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

The above only seems to work in V9, if you try it in V8.5 it will give an error.