11-15-2017 10:56 AM - edited 11-15-2017 11:05 AM
Hello,
i am using this expression to open a filedialog and return the selected path.
RunState.Engine.DisplayFileDialog("test","ok","c:\\",StationGlobals.S1,StationGlobals.S2,0,"",4100,"")
How can i enter a new filename in the selected path and return this value into the globals?
Thanks
Solved! Go to Solution.
11-15-2017 11:06 AM
Hi,
You can use the TestStand API by calling an ActiveX step:
Automation Server: TestStand <version> API
Object Reference: Runstate.Engine
Object Class: Engine (IEngine)
Call Method: DisplayOpenFileDialog
The step parameters are self explanatory, but you can return the path using "absolutePath" to a local variable.
I hope this helps,
Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)
Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor
11-15-2017 11:10 AM
Hi Charlie,
thanks for your answer.
I think while you wrote the answer i modified my question.
Now i am also doing what you described.. only problem is: how to select a new file (that not exists in dialog).
11-15-2017 11:20 AM
Hi,
change the win32flags parameter to the following:
win32Flags: 4100+WinFileDlg_CREATEPROMPT
Regards,
Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)
Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor
11-16-2017 02:38 AM - edited 11-16-2017 02:59 AM
Works fine.
Thanks. I changed now the 4100 to 0 after reading the help file:
http://zone.ni.com/reference/en-XX/help/370052G-01/tsapiref/reftopics/windowsfiledialogflags/
Another question is:
The function returns the path in a string array. For example c:\test\sub\new\file.txt
How can i replace ALL \ with \\?
best regards
11-16-2017 08:09 AM
Solved: SearchAndReplace
01-16-2018 03:03 PM
Just a few details.
Automation Server: NI TestStand 2016 SP1 API
It took me just about forever to find this.
Call Method needs to be selected on the drop down, too.