DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

AutoActName for SUD Dialog?

Hi,
 
When displaying another SUD dialog from the same file within a different SUD dialog, is there a method for determining the current (SUD dialog) file name and path?  Similar to AutoActPath and AutoActName?  I could name my VBS and SUD files alike, then that would work, but thought perhaps there was another command I don't know about.
 
Thank you!
 
Julia Moeller
0 Kudos
Message 1 of 6
(3,764 Views)
Julia,
 
There are three properties of a dialog object that might be of use.  They are:
 
Dialog.DialogCode   >> Will return the unique name of the current dialog (i.e. "Main_Dialog")
Dialog.FileName       >> Will return the name of the current dialog file (i.e. "Test.sud")
Dialog.FilePath         >> Will return the path of the current dialog file (i.e. "C:\Documents and Settings\")
 
You can find more help on these properties in the DIAdem help under Programming Reference>>Object-Oriented Script Interfaces>>User Dialog Boxes>>Objects>>Dialog.
 
 
Josh W. | National Instruments | Applications Engineering
Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 2 of 6
(3,751 Views)

Hello Julia,

I am looking for something very similar when using a Dialog Box.

I would like to specify the starting directory when I search for files in the Dialog Box. I have two files which I need to select but they are in different directories.

This is my current script and I would like to search at the top of the directory rather than just going to the last file selected directory.

Sub Button1_EventClick()
Dim This : Set This = Button1
 
 MSComDlg1.X.ShowOpen
 Editbox1.Text = MSComDlg1.X.filename
 If filex(Editbox1.text) Then load.Enable = True Else load.Enable = False
End Sub

Sub Durchsuchen_EventClick()
Dim This : Set This = Durchsuchen

 MSCommonDlgAX.X.ShowOpen
 FilePath.Text = MSCommonDlgAX.X.FileName
 If filex(FilePath.text) Then load.Enable = True Else load.Enable = False
End Sub

Sub EditBox1_EventChange()
Dim This : Set This = EditBox1
 If filex(Editbox1.text) Then load.Enable = True Else load.Enable = False
End Sub

 

Thanks

 

0 Kudos
Message 3 of 6
(3,536 Views)

I do not use the "Microsoft Common Dialog" box very often, so am not sure I will be much help.  I usually use the "FileNameGet" command (it has lots of helpful input and return parameters), and with this, you can specify which directory you want it to start in.  In this example, pushing Button2 gives a file selection dialog where I can select one or more type DAT or TDM files, and the file paths are returned in an array.  But I'm not sure if this will help you?

Sub Button2_EventClick()
Dim This : Set This = Button2
 Dim DlgTitle, StartPath, FileExts, FilePaths
 DlgTitle = "Insert File Dialog Title Here..."
 StartPath = ProgramDrv & "Libr\Dat\"
 FileExts = "*.DAT;*.TDM"
 Call FileNameGet("Any", "FileRead", StartPath, FileExts, "Nul", True, DlgTitle)
 FilePaths = Split("|" & FileDlgFileName,"|")
End Sub

0 Kudos
Message 4 of 6
(3,523 Views)

Hello Julia,

That gets me partly there, but how can I call the filename path and display it in a editbox.

This is to visually make sure that the file I have selected is correct.

Thanks

0 Kudos
Message 5 of 6
(3,514 Views)

This should display the selected filepath and filename in EditBox1 (below).  To "call" the filename path, do you mean, load the specified data file?  If so, you should be able to just use Call DataFileLoad(DataFilename, [FileImportFilter], [ImportAction]), where DataFileName = FileDlgDir & FileDlgFile or if you selected multiple files, one or more of the FileDlgFileName files.  Does this help?

Sub Button2_EventClick()
Dim This : Set This = Button2
 Dim DlgTitle, StartPath, FileExts, FilePaths
 DlgTitle = "Insert File Dialog Title Here..."
 StartPath = ProgramDrv & "Libr\Dat\"
 FileExts = "*.DAT;*.TDM"
 Call FileNameGet("Any", "FileRead", StartPath, FileExts, "Nul", True, DlgTitle)
 FilePaths = Split("|" & FileDlgFileName,"|")
 EditBox1.Text = FileDlgDir & FileDlgFile
End Sub

 

0 Kudos
Message 6 of 6
(3,500 Views)