Folder selection dialog from EKL Action?

Justin Brash

Folder selection dialog from EKL Action?

Hi All - I'm trying to write an EKL action which will output some data to a text file.  I would like to give the user the opportunity to select a folder for the file to be saved in.  So far I've not found a way to bring up a windows folder browser window from an EKL Action ... is this not possible?

I've found a way to do this using a VBScript action, and thought that maybe my EKL action could run the VBScript action, and that could pass the selected folder path back to the EKL Action ... can't see a way to do this either.  Can a VBScript action return a value / object back to the EKL action that ran it?

I know what I want to do can all be done with a VBA macro, but would like to try and do it with EKL if it's possible.  Still learning ... any help would be much appreciated.

Edited By:
Justin Brash[Organization Members] @ Mar 06, 2021 - 08:15 PM (Europe/London)

Romain Malher

RE: Folder selection dialog from EKL Action?
(in response to Justin Brash)

Indeed you should use the VBScript to preform the CATIA.FileSection. Then you can set a String type Knowledge parameter to the filepath, and read this string using EKL.


// VBAction

CATIA.FileSelectionBox("Select input file", "*.xls; *.xlsx", CatFileSelectionModeOpen)


// EKL
`MyPart --.--1\strTmpDir` = ""

let vbOpenExcel (VBScript)
vbOpenExcel = `MyPart --.--1\Relations\VBLib\getExcelFile`
vbOpenExcel.Run( `MyPart --.--1\strTmpDir` )

let sPathExcelFile (String)
sPathExcelFile = `MyPart --.--1\strTmpDir`

if sPathExcelFile <> "" and sPathExcelFile.MatchPattern(".*.xls.?")
Trace(1,"OK : #",sPathExcelFile)
Trace(1,"NO: user cancel")