| grandMA3 ユーザマニュアル » プラグイン » Lua 関数 - Object API » Import(handle, string, string) | Version 2.2 |
Import 関数は、XML形式で記述されたオブジェクトをインポートします。
|
|
制限 |
| インポートするファイルは、すでに存在している必要があります。 |
|
|
重要 |
| Import は、確認ポップアップなしで、XMLファイルの内容をオブジェクトにマージします。 |
XMLファイルの内容を選択されているシーケンスにインポートします。ファイル名は "MySelectedSequence" で、"../gma3_library/datapools/sequences" にあります。ファイルは、Export 関数の例を用いて作成できます。
Lua |
return function() --SelectedSequence() creates a handle to the selected sequence. -- The imported object will be merged into this sequence. local selectedSequence = SelectedSequence() -- Check if there is a selected sequence - if not then exit the function. if selectedSequence == nil then ErrPrintf("The selected sequence could not be found.") return end --The path is stored in a variable. local path = GetPath(Enums.PathType.UserSequences) --The actual import function. local success = selectedSequence:Import(path, "mySelectedSequence.xml") --Print some feedback. if success then Printf("The sequence is imported from: " .. path .. GetPathSeparator() .. "mySelectedSequence.xml") else ErrPrintf("The object could not be imported.") end end |
Export - XMLテーブルをエクスポートするためるオブジェクト関数。