[JW Lua] FCFileOpenDialog

Charles O. Lawrence charlesolawrence at bellsouth.net
Sat Oct 17 16:41:50 CEST 2015


Thanks for the new betas 0.40/0.41.  A massive update!  You have been busy.

 

I cannot get the following code to work as intended.  If I select only one
file in the dialog box, it correctly displays the chosen file name.  If I
select more than one file, it reports that only one file was selected and
displays the directory name.  What am I missing?  On the same subject, after
retrieving a filename, or several, how then does one use that filename to
actually open a Finale file, say a MUSX file, from within Finale?

 

Thanks,

Charles

 

 

-- Create the dialog object

local dialog = finale.FCFileOpenDialog(finenv.UI())

-- Set the window title

local windowtitle = finale.FCString()

windowtitle.LuaString = "Open some Lua files"

dialog:SetWindowTitle(windowtitle)

-- Set the filter

local filter = finale.FCString()

filter.LuaString = "*.lua"

local filterdescr = finale.FCString()

filterdescr.LuaString = "Lua Files (*.lua)"

dialog:AddFilter(filter, filterdescr)

-- Allow multiple file selection

dialog.MultiSelect = true

-- Display the dialog to the user 

if dialog:Execute() then

    -- Get the names of the selected files and display the names

    local filenames = finale.FCStrings()

    dialog:GetFileNames(filenames)

    print ("Number of files chosen",filenames.Count)

    for fname in each(filenames) do

        print (fname.LuaString)

    end

end

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20151017/78a965e4/attachment-0002.html>


More information about the JWLua mailing list