top of page

1

File/Folder

AZSTOKE_TextFileWirteRead

セーブデータ構築Part1-テキストファイルを書き出しと読み込み-

RANK

dofile(reaper.AZ_GetLuaInitPath())

require("reaper_AZSTOKE_SILVER")


fileName = "saveDate.txt"


folderPath,addPath = reaper.AZ_SetResoucePathFolder("AZSTOKE",0)

retval,inputList = reaper.AZ_GetUserInputList("Info",3,"Path:,Wav:,Count:","D:/,test,5")


if retval then 

   saveText = ""

   for i, value in pairs(inputList) do

       if i == 1 then

          saveText = value

       else

          saveText = saveText..","..value

       end

   end

   reaper.AZ_WriteFile(folderPath,fileName,saveText,0)

   saveText = reaper.AZ_ReadFile(folderPath,fileName)

   splitList = reaper.AZ_GetStringSplitList(saveText,",")

   for i, value in pairs(splitList) do

       Msg(splitList[i])

   end

end

dofile(reaper.AZ_GetLuaInitPath())

require("reaper_AZSTOKE_SILVER")


・SilverAPIを利用可能にする


fileName = "saveDate.txt"


・ファイル名を拡張子を入れて文字列「saveDate.txt」をfileNameに代入


folderPath,addPath = reaper.AZ_SetResoucePathFolder("AZSTOKE",0)


・リソースフォルダに"AZSTOKE"というフォルダを作成


retval,inputList = reaper.AZ_GetUserInputList("Info",3,"Path:,Wav:,Count:","D:/,test,5")


・UserInputで3つのインプット情報を設定、実行後に入力したものをinputListに代入


if retval then 


・GetUserInputListをキャンセルしていない場合


   saveText = ""


・空のsaveTextを用意


   for i, value in pairs(inputList) do


・inputList分ループ再生


       if i == 1 then

          saveText = value


・最初はsaveTextにそのままvalueを代入


       else

          saveText = saveText..","..value


・2回目以降はsaveTextに区切りの","を入れてからvalueを語尾に追記して代入


       end

   end

   reaper.AZ_WriteFile(folderPath,fileName,saveText,0)


・指定フォルダパスにsaveTextを記載したファイルを生成


   saveText = reaper.AZ_ReadFile(folderPath,fileName)


・さきほど生成したファイルを読み込みsaveTextに出力


   splitList = reaper.AZ_GetStringSplitList(saveText,",")


・saveTextの区切りをもとに配列に変更


   for i, value in pairs(splitList) do


・splitListごとにループ再生


       Msg(splitList[i])


・splitListごとにコンソール出力、出力されているか確認


   end

end

To use the API, you need to sign up for a plan.

Download the dedicated API

need to do it.

*SILVER is scheduled to be released in May.

- Script Code -
- Script Image -
- Warm Up -
- Script Detail -
- API -

LUA

​ReaScript File Download 👇

* A dedicated API is required to run this

- Script Image -
bottom of page