Create a gist now

Instantly share code, notes, and snippets.

【MaxScript】バッチ処理999迄対応
-- 現在開いているMaxファイルのフルパスゲット
baseFilePath = maxFilePath+maxFileName
-- 今回は150ファイル処理。001 - 150
for i=1 to 150 do(
--------------------------------------------------
-- 001 - 999 迄処理が行えます。今回は4桁の連番には対応しません。
if ( i<10 ) then(
filePath = ((Substring baseFilePath 1 (baseFilePath.count-5)) + (i as String)+".max")
)else if ( (i>9) and (i<100) ) then (
filePath = ((Substring baseFilePath 1 (baseFilePath.count-6)) + (i as String)+".max")
)else if ( i>99 ) then(
filePath = ((Substring baseFilePath 1 (baseFilePath.count-7)) + (i as String)+".max")
)else if ( i > 999 ) then(
print "連番が3桁以上の場合は処理しません"
)
--------------------------------------------------
LoadMaxFile filePath
------------------------------
-- ここに処理内容を書きます
Delete (for o in objects where classOf o == Text collect o)
------------------------------
CompleteRedraw()
SaveMaxFile filePath
)
-- ベースファイルを再度開く
loadMaxFile baseFilePath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment