Save incremental with 3 digits???

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
JokerMartini's picture

alright

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.

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Anubis's picture

oh, man... fn

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.

my recent MAXScripts RSS (archive here)

JokerMartini's picture

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.

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Anubis's picture

use FormattedPrint

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

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.