Skip to content

Instantly share code, notes, and snippets.

@deathponta
Last active November 19, 2016 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deathponta/488e26b9884b031500c7b08b8154401f to your computer and use it in GitHub Desktop.
Save deathponta/488e26b9884b031500c7b08b8154401f to your computer and use it in GitHub Desktop.
【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