ScriptSpot home

Forum topic · General Scripting

Save incremental with 3 digits???

By JokerMartini · 2011-02-23

Description

This script works great so far I just want to make it save foo_001.ax instead of what it does now which is foo_1.max


fn CopyRenderToClipboard =
(
local RImage = getLastRenderedImage()
files = (getFiles (maxFilePath + "\\Renders\\" + "*.jpg")).count
makeDir (maxFilePath + "Renders")
RImage.fileName = maxFilePath + "\\Renders\\" + getFilenameFile maxFIleName + "_" + files as String + ".jpg"
save RImage
true
)
CopyRenderToClipboard()

Comments (4)
JokerMartini

alright i see how that works. I was trying to place it in the wrong place and it was bugging out after it saving 010.
Thanks anubis for the help on this one.

Panayot Karabakalov

oh, man...

fn SaveLastRendered = (
   local RImage = getLastRenderedImage()
   if RImage != undefined and maxFileName != "" do (
      saveDir = maxFilePath + "Renders"
      if not doesFileExist saveDir do makeDir saveDir
      filesCount = (getFiles (saveDir + "\\*.jpg")).count
      imgName = maxFileName + "_" + (FormattedPrint filesCount format:"3.3d") + ".jpg"
      RImage.fileName = saveDir + "\\" + imgName
      save RImage
   )
)
-- return True if success, Undefined otherwise.
JokerMartini

input

so how would i input that into the code. Because i have it count the amount of files that are jpg in the folder and then just increment the suffix.

Panayot Karabakalov

use FormattedPrint

for i = 0 to 10 do
format "%\n" (formattedPrint i format:"3.3d")