For the JS_Dialog_BrowseForOpenFiles-function, you can use the following code, to separate the filenames and path:
Code:
function SplitFilenameStringAtNULLBytes(splitstring)
-- if type(splitstring)~=nil
-- add a NULL-Byte at the end, helps us finding the end of the string later
splitstring=splitstring.."\0"
local count=0
local filenames={}
local temp, offset
-- let's get the path
local path, offset=splitstring:match("(.-)()\0")
splitstring=splitstring:sub(offset+1,-1)
-- let's get the filenames
while splitstring~=nil do
-- find the next filename
temp,offset=splitstring:match("(.-)()\0")
if temp~=nil then
-- if the next filename isn't nil, then add it fo filenames-array and count+1
count=count+1
filenames[count]=temp
splitstring=splitstring:sub(offset+1,-1)
else
-- if filename is nil, the string is probably finished splitting
break
end
end
return count, path, filenames
end