[JW Lua] AssureFileExtension()

Thomas Weber thomas.weber at notengrafik.com
Mon Aug 8 16:09:43 CEST 2016


There's definitely a flaw here.  I have a file "test.txt" in directory "E:\".  With your modified script, if I enter "test.txt", then I'm asked whether I want to replace that file.  If I only enter "test", I don't get the warning, but the returned file name is still "E:\test.txt".  This means, the safety net is bypassed and one can't be certain that the user actually agreed on replacing the file.

Not sure if that's a problem with how the dialog works or if it's some problem on JWLua's side.



Am 06.08.2016 um 17:04 schrieb Thomas Weber:
> You're totally right, Chris.  Then it is odd that calling it *before* Execute() also has an effect (the mentioned pre-filling of the input field).
>
> Thanks!
>
>
> Am 05.08.2016 um 18:50 schrieb Chris:
>> Thomas
>>
>> I think "AssureFileExtension" should be after "Execute"
>>
>> ------------------------------
>> local dialog = finale.FCFileSaveAsDialog(finenv.UI())
>>
>> local filter = finale.FCString()
>> filter.LuaString = "*.txt"
>> local description = finale.FCString()
>> description.LuaString = "text files (*.txt)"
>> dialog:AddFilter(filter,description)
>>
>> dialog:Execute()
>>
>> dialog:AssureFileExtension(".txt")
>> local fileName = finale.FCString()
>> dialog:GetFileName(fileName)
>> print(fileName.LuaString)
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
>




More information about the JWLua mailing list