Hey guys,
i have feature request from a client, which is a bit tricky to implement. So maybe you guys have a idea.
Scenario:
The customer uses a TI solution from us (Servoy 23.6, NGDesktop, Windows envrioment). He works with alot of Word-Files which named for example 63_8010_200_01_XX_XY.docx
In the solution he needs to select this file, and we save the location of the file. We use ```
plugins.ngdesktopfile.showOpenDialog()
Now the tricky part. The customer got many of those files. So when the openDialog opens, he uses the windows search bar with the prompt ```
63*8010*200*01*
``` and then selects the right file.
Question. Can our solution somehow interact with the windows-search textfield of the openDialog window?
Best outcome would be: showOpenDialog() maybe with a parameter-object {searchParam: "63*8010*200*01*"}. So when the windows-dialog pops up, the search-field is already filled.
Maybe one of you guys have a idea.
Greetings and have a great day!
-Vik
Have you tried to supply an option-object to the function? We do something like this for saving files:
var homePath = plugins.ngdesktopfile.homeDir() + java.io.File.separator + fileName;
var fileOptions = {
title: 'Ausgabedatei',
defaultPath: homePath,
buttonLabel: 'Ok',
filters: [{name: 'Excel-Datei', extensions: ['xlsx']}]};
filePath = plugins.ngdesktopfile.showSaveDialogSync(fileOptions)
The object is explained here: dialog | Electron,
defaultPath string (optional) - Absolute directory path, absolute file path, or file name to use by default.
looks like it could fit your purpose.
Hi Vik,
like Robert pointed out there is documentation available on the options.
In case of the opendialog this is the link (mentioned in the function tooltip in Servoy): https://www.electronjs.org/docs/latest/ … ow-options
As far as I can see there is no way to pass in a filter on filenames, just for named (group of) extensions.
I think so far for the easy solution.
Looking at the available functions in the plugin, you can create your own file open dialog by using the listDir function.
For each name that is returned, you can then ask for its properties using the getFileStats function, this contains information about whether its a file or a folder.
You can already filter down the list of names as you like from the result of the listDir function.
I’d do your own file management. So have a settings area in the app to let the customer pick the root folder for document management. Say they pick “c:\docs”
Then in the area where they manage the files, have them enter in the filename in the app, and mimic your own file save dialog system, then make ng desktop calls to write it to disk. This way you can do a folder system and when they enter 63_8010_200_01_XX_XY.docx for the file name, you save it to “c:\docs\63_8010_200_01\63_8010_200_01_XX_XY.docx”. Then when they want to open a file, you can let them pick from files in ""c:\docs\63_8010_200_01". Or even automate that and pull the list of files and show it in a custom pick list screen in your app. That way the file management feels more integrated.
Hi guys, thanks for the input!
I guess we have to do or own “selectDialog”.
Im gonna put this request on the backburner for now. The customer needs to do one more mouse-click and use the windows-search field for now.
When i have time for that, i´ll get you updated how we did the workaround for this!
Greetings and have a nice week ![Smile :)]()
Vik