ScriptSpot

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 · 2011-02-24

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.

Anubis · 2011-02-24

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.

input

JokerMartini · 2011-02-24

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.

use FormattedPrint

Anubis · 2011-02-23

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