[Solved] SystemFolderPicker with multiselectmode

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
sokolowitzky
Posts: 103
Joined: Mon Sep 15, 2014 7:34 pm

[Solved] SystemFolderPicker with multiselectmode

Post by sokolowitzky »

Hello,
SystemFolderPicker allows selecting multiple folders. But I can't manage displaying selected folder names. Since, probably, getdirectory command tries to convert the selection as one folder name.
Is there alternative command to solve this.

Code: Select all

Function getFoldersWSysFolderPicker AS String
   oPicker = CreateUnoService("com.sun.star.ui.dialogs.SystemFolderPicker")
   oPicker.multiselectionmode = true
      Dim fName() As Variant
   if oPicker.execute() then 
   getFolderWSysFolderPicker = oPicker.getdirectory()'.getDirectories()?

   
   msgbox getFoldersWSysFolderPicker
 end if
End Function
Last edited by sokolowitzky on Sun May 28, 2023 6:07 am, edited 1 time in total.
Win10-OpenOffice 4.1/LibreOffice 7.4
JeJe
Volunteer
Posts: 2763
Joined: Wed Mar 09, 2016 2:40 pm

Re: SystemFolderPicker with multiselectmode

Post by JeJe »

LO lets you select multiple folders but if you press the enter from within the textbox you get a message box saying its not a valid directory. So looks like not fully implemented.

Looking with MRI there is a getvalue method for you to explore which may allow you to get the text in that control - or may not.

An alternative would be your own dialog with a multiselect listbox to show the directories.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
JeJe
Volunteer
Posts: 2763
Joined: Wed Mar 09, 2016 2:40 pm

Re: SystemFolderPicker with multiselectmode

Post by JeJe »

It could be prettied up with an icon for the directories and checked for robustness... but for fun I've quickly implemented my last suggestion...
Attachments
dir dialog.odt
(13.39 KiB) Downloaded 59 times
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: SystemFolderPicker with multiselectmode

Post by Villeroy »

Slightly different appropach.
 Edit: Sorry, forgot to add routine "pickFolder". 
Attachments
dirs_dialog.odt
Second version
(13.86 KiB) Downloaded 56 times
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply