Notifications
Clear all

[Closed] Reading & Writting the Preferences -> Increment on save Property

Hi there,

I was doing a small script, where i have a dockable rollout with a check button on it (on, off). I want to link the check button with the “Increment on save” property, but for my surprise i haven’t found the property accesible from maxscript (or it’s not documented).

Does anyone know how can i read/writte the property?

Any help will be really apreciated

Thanx & bye!

ps: I’m working with 3dsmax 7.

2 Replies

I am pretty sure you cannot effectively set this setting via MAXScript.
You can however get it by reading the 3dsmax.ini file:

getIniSetting (getMAXIniFile()) “Performance” “AutoIncrement”

Unfortunately, setting this in the ini file will not update Max as the ini file is not being read all the time but just on startup. So you can display what the state of the checkbox is, but I don’t think you can change it.

Thank you for the answer Bobo

As it can't be done within max i've taken another route. Actually I've set the Increment on Save setting to false. And I'm going to do my increment on saves with max script. That's going to solve my versioning and sourcesafe problems... i expect. :)

Here is my increment on save script: (poorly commented, and in spanish)

    ----------------------------------------------------------------
    -- Increment on Save
    -- creator: Asier Illarramendi
    ----------------------------------------------------------------
    
    fn isNumber char =
    (
    	numbers = #( "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" )
    	
    	for i = 1 to numbers.count do
    	(
    		if numbers[i] == char then return true
    	)
    
    	return false
    )
    
    macroScript IncrementSave category:"My Scripts" tooltip:"Increment on Save"  buttontext:"Save  +" 
    (
    	if maxFileName == "" then
    	(
    		messagebox "The file is not saved."
    		return 0
    	)
    	
    	fileName = maxFileName
    	explodedName = filterString fileName "." 
    	
    	-- Sacar el nombre del fichero sin el .max
    	
    	baseName = ""
    
    	for i = 1 to explodedName.count - 1 do
    	(
    		baseName = baseName + explodedName[i]
    
    		if i != explodedName.count - 1 then
    			baseName = baseName + "."
    	)
    	
    	-- Ver en que posicion empieza el tema del numero :P
    	
    	local startChar
    	ignoreNewFinds = false
    
    	for i = baseName.count to 1 by -1 do
    	(		
    		if (isNumber baseName[i]) == true then
    		(
    			if ignoreNewFinds != true then startChar = i
    		)
    		else
    		(
    			if startChar != undefined then -- ya se ha encontrado un numero antes y ahora es un 'no numero', a partir de aqui ignorar los demas numero
    			(
    				ignoreNewFinds = true
    			)
    		)
    	)
    
    	if startChar == undefined then
    	(
    		messagebox "There is not any number in the file name." title:"Error!"
    		return 0
    	)	
    	
    	-- Sacar el string del numero
    	
    	num = substring baseName startChar ((baseName.count + 1) - startChar)	
    	
    	newNum = ("" as string)
    
    	if num.count < (((num as number) + 1) as string).count then
    		zeroNum = (((num as number) + 1) as string).count
    	else
    		zeroNum = num.count
    	
    	for i = 1 to zeroNum do newNum = newNum + "0"
    
    	num = ((num as number) + 1) as string
    	newNum = replace newNum ((newNum.count + 1) - num.count) num.count num
    	
    	-- New Name
    	
    	newFileName = (substring baseName 1 (startChar - 1)) + newNum + ".max"
    
    	-- Check if exists
    	
    	files = getFiles (maxFilePath + newFileName)
    	if files.count > 0 then
    	(
    		if (queryBox ("The file '"+ newFileName +"' already exists in the current directory. Overwrite?") title:"Error!") == false then
    		(
    			return 0
    		)
    	)
    
    	-- SAVE
    
    	saveMaxFile newFileName
    )