ft_version = "v0.41" -- Changelog -- v0.33 -- Reading actual status of autoBack from Maxconfig and show it when run first time -- Added A WARNING MESSAGE when tunning Autoback off, or when you run the script and it's set to OFF. -- v0.33d -- Added Refresh Ui to keep the Filename in sync most of time using the scripting and refresh filename at any button press -- - Control AutoBack Time -- - Keep Track MaxFile Size -- - Use 3 HOLD and FETCH instead of ONE with OSD Labels feature -- - Turn on/off Autoback with Smart Check and Warning when it´s OFF -- - Control number of Autoback Files -- - FLAG Button and FLAG+DATE to put a TAG on important files ! -- v0.34 - Open MaxPath Opens Windows Explorer too -- V0.4 - Changed the FLAG concept by a Major Version/Minor Version format and added 2 buttons for control that. -- - Explore MaxFile Folder using Open MaxPath button majv = 0 minv = 0 ft_uwidth = 210 ft_uheight = 360 fn existFile fname = (getfiles fname).count != 0 fn dorefresh fname = (maxfilepath + (getFilenameFile maxFileName) +".max" != ftgetfile) if maxfilepath != "" then ( if doesFileExist (maxfilepath + (getFilenameFile maxFileName)+".max") == true do ( ft_getfile = maxfilepath + (getFilenameFile maxFileName) +".max" ft_filename = getFilenameFile maxFileName + ".max" -- ft_flag_filename = maxfilepath + (getFilenameFile maxFileName) + "_FLAG" ) ) else MessageBox "Note: This max file was not saved Yet." if autosave.Interval == 2 do autosavinterval = 1 if autosave.Interval == 5 do autosavinterval = 2 if autosave.Interval == 10 do autosavinterval = 3 if autosave.Interval == 20 do autosavinterval = 4 if autosave.Interval == 30 do autosavinterval = 5 if autosave.Enable == false do MessageBox "WARNING !\n Autoback is turned OFF, if Max Crash in this meantime you'll loose your progress." holdpointer = 1 lblversion = 1 -- Yes numofiles = autosave.NumberOfFiles -- Check Number of Autoback files and show it on ui ft_getfile = "Not Saved Yet" ft_filename = "Not Saved Yet" fn checkmaxfile = ( filebase = "kb" if maxfilepath != "" then ( if doesFileExist (maxfilepath + (getFilenameFile maxFileName)+".max") == true do ( ft_getfile = maxfilepath + (getFilenameFile maxFileName) +".max" ft_filename = getFilenameFile maxFileName + ".max" -- ft_flag_filename = maxfilepath + (getFilenameFile maxFileName) + "_FLAG" ) if doesFileExist (maxfilepath + (getFilenameFile maxFileName)+".mx") == true do ( ft_getfile = maxfilepath + (getFilenameFile maxFileName) +".mx" ft_filename = getFilenameFile maxFileName + ".mx" ) ) else ( ft_getfile = "Not Saved Yet" ft_filename = "Not Saved Yet" ) ft_maxrawfilesize = (getfilesize ft_getfile /1024) as integer if ft_maxrawfilesize > 1024 then ( ft_maxrawfilesize = ft_maxrawfilesize/1024 filebase = "Mb" ) else ( ft_maxrawfilesize = ft_maxrawfilesize filebase = "Kb" ) if ft_maxrawfilesize > 1048576 do ( ft_maxrawfilesize = ft_maxrawfilesize/1048576 filebase = "Gb" ) global ft_maxfilesize = "~" + (ft_maxrawfilesize as string) + filebase if findstring ft_filename "_v" != undefined then ( -- Check if the Max filename has the Major and Minor Version set on Name majv = substring ft_filename (findstring ft_filename "_v"+2) 2 as integer minv = substring ft_filename (findstring ft_filename "_v"+5) 2 as integer ) else Messagebox "Please, to have versioning feature working,\nPlease add _v##_## to the name of the file.\n(e.g. myscene_v01_01.max)." ) fn savemajorminor = ( ft_filename = replace ft_filename (findstring ft_filename "_v") 7 ("_v"+formattedPrint majv format:"02u" +"_"+formattedPrint minv format:"02u") if existFile (maxfilepath+ft_filename) == false then ( saveMaxFile (maxfilepath+ft_filename) useNewFile:true MessageBox ("New Max file version Created: "+"\n\n"+ ft_filename) ) else MessageBox ("WARNING !"+"\n"+" The file... "+"\n\n"+ ft_filename+"\n\n"+"ALREAD EXIST in this path."+"\n"+"I will not overwrite files.") ) bkppath = GetDir #autoback + "\kumohold"+holdpointer as string +".mx" if autosave.Enable == true then autosavstatus = 1 else autosavstatus = 2 checkmaxfile() try(DestroyDialog FileTools)catch() rollout FileTools ("FileTools "+ ft_version) ( Group "AutoBack Setup" ( spinner spn_numberofbkp "# of Files:" range:[0,30,numofiles] width:105 align:#right tooltip:"Number of AutobackFiles" pos:[95,25] type:#integer radiobuttons rad_savebkp "Autoback :" labels:#("ON ", "OFF ") align:#left pos:[10,25] default:autosavstatus radiobuttons rad_savetime "Interval (min) :" labels:#("2 ","5 ", "10","20","30") align:#left default:autosavinterval ) Group "Load/Save Hold Versions" ( radiobuttons rad_pointer "" labels:#("1 ", "2 ","3 ") align:#left default:holdpointer button bt_hold "HOLD" width:40 pos:[120,120] Tootip:"Hold/save actual Scene on temporary file" button bt_fetch "FETCH" width:40 pos:[163,120] Tootip:"Fetch/load saved Scene from temporary file" radiobuttons rad_holdlabel "Label Hold Version ?" labels:#("Yes ", "No ") align:#left default:lblversion Tootip:"OSD Viewport Label on Saved Scene" ) Group "Save/Versioning (_vmv_mv)" ( button btft_major "+ MAJOR VERSION" width:(ft_uwidth*0.52) Tootip:"Save incremental Major Version _vxx.xx" pos:[10,205] button btft_minor "+ MINOR VERSION" width:(ft_uwidth*0.52) Tootip:"Increment Minor Version number" pos:[10,205+22] button bt_openmaxfilepath "Open MaxPath" width:80 Tootip:"Open Scene MaxPath" pos:[120,205] button bt_explore "Explore" width:80 Tootip:"Explore MaxPath" pos:[120,205+22] button bt_refreshfile "Refresh" width:(ft_uwidth-20) pos:[10,205+44] Tootip:"Update Script UI. Click when load a new project." button btft_2016 "Save 2016" width:(ft_uwidth/3.3) pos:[10,205+66] Tootip:"Save as Max 2016." button btft_2015 "Save 2015" width:(ft_uwidth/3.3) pos:[73,205+66] Tootip:"Save as Max 2015." button btft_2014 "Save 2014" width:(ft_uwidth/3.3) pos:[136,205+66] Tootip:"Save as Max 2014." label lbl_fname ft_filename label lbl_fsize ft_maxfilesize ) label lab1 "© Kumodot Tools - Marcelo Souza - 2015" -- Registry on spn_numberofbkp changed numofiles do autosave.NumberOfFiles = numofiles -- Number of Files on ft_chkdate changed ft_chkdatestatus do ( checkmaxfile() -- Refresh UI lbl_fname.text = ft_filename -- Refresh UI if ft_chkdatestatus == true then dateflag = 1 else dateflag = 0 -- Add Date ? ) on bt_hold pressed do ( checkmaxfile() -- Refresh UI lbl_fname.text = ft_filename -- Refresh UI if lblversion == 1 do ( if isValidNode (getnodebyName "Holdversion_script") != true then holdmark = sliderManipulator xPos:0.5 yPos:0.9 isSelected:off hide:true name:"Holdversion_script" else holdmark = getnodebyName "Holdversion_script" freeze (getnodebyName "Holdversion_script") if holdpointer == 1 do holdmark.sldName= "HOLD 01" if holdpointer == 2 do holdmark.sldName= "HOLD 02" if holdpointer == 3 do holdmark.sldName= "HOLD 03" ) if lblversion == 2 and isValidNode (getnodebyName "Holdversion_script") != false do delete (getnodebyName "Holdversion_script") saveMaxFile bkppath ------------------------------ pos = GetDialogPos FileTools destroyDialog FileTools -- createDialog FileTools ft_uwidth ft_uheight fgcolor:yellow -- destroyDialog FileTools createDialog FileTools ft_uwidth ft_uheight fgcolor:yellow SetDialogPos FileTools pos ------------------------------ ) on bt_fetch pressed do ( checkmaxfile() -- Refresh UI lbl_fname.text = ft_filename -- Refresh UI if isValidNode (getnodebyName "Holdversion_script") != false do holdmark = getnodebyName "Holdversion_script" if lblversion == 2 and isValidNode (getnodebyName "Holdversion_script") != false then delete (getnodebyName "Holdversion_script") if isValidNode holdmark != false and lblversion == 1 do ( if holdpointer == 1 do holdmark.sldName= "HOLD 01" if holdpointer == 2 do holdmark.sldName= "HOLD 02" if holdpointer == 3 do holdmark.sldName= "HOLD 03" ) loadMaxFile bkppath pos = GetDialogPos FileTools destroyDialog FileTools -- createDialog FileTools ft_uwidth ft_uheight fgcolor:yellow -- destroyDialog FileTools createDialog FileTools ft_uwidth ft_uheight fgcolor:yellow SetDialogPos FileTools pos ) on rad_holdlabel changed lblversionstate do ( checkmaxfile() -- Refresh UI lbl_fname.text = ft_filename -- Refresh UI lblversion = lblversionstate if lblversion == 2 and isValidNode (getnodebyName "Holdversion_script") != false then delete (getnodebyName "Holdversion_script") if lblversion == 1 and isValidNode (getnodebyName "Holdversion_script") != true then ( holdmark = sliderManipulator xPos:0.5 yPos:0.9 isSelected:off hide:true name:"Holdversion_script" freeze (getnodebyName "Holdversion_script") if holdpointer == 1 do holdmark.sldName= "HOLD 01" if holdpointer == 2 do holdmark.sldName= "HOLD 02" if holdpointer == 3 do holdmark.sldName= "HOLD 03" ) ) on rad_pointer changed holdpointerset do ( checkmaxfile() -- Refresh UI lbl_fname.text = ft_filename -- Refresh UI if isValidNode (getnodebyName "Holdversion_script") != false do holdmark = getnodebyName "Holdversion_script" if lblversion == 2 and isValidNode (getnodebyName "Holdversion_script") != false then delete (getnodebyName "Holdversion_script") -- if isValidNode holdmark != false do delete (getnodebyName "Holdversion_script") if holdpointerset == 1 do ( holdpointer = 1 print holdpointer -- if holdpointer == 1 do holdmark.sldName= "HOLD 01" ) if holdpointerset == 2 do ( holdpointer = 2 print holdpointer -- if holdpointer == 2 do holdmark.sldName= "HOLD 02" ) if holdpointerset == 3 do ( holdpointer = 3 print holdpointer -- if holdpointer == 3 do holdmark.sldName= "HOLD 03" ) -- if lblversion == 1 do freeze (getnodebyName "Holdversion_script") bkppath = GetDir #autoback + "\kumohold"+holdpointer as string +".mx" )--end on on rad_savebkp changed bkpsave do ( checkmaxfile() -- Refresh UI lbl_fname.text = ft_filename -- Refresh UI if bkpsave == 1 do ( autosave.Enable = true autosavstatus = 1 ) if bkpsave == 2 do ( autosave.Enable = false autosavstatus = 2 MessageBox "WARNING !\n Autoback will be turned OFF, if Max Crash in this meantime you'll loose your progress." ) )--end on on rad_savetime changed bkptime do ( checkmaxfile() -- Refresh UI lbl_fname.text = ft_filename -- Refresh UI if bkptime == 1 do ( autosave.Interval = 2 autosavinterval = 1 ) if bkptime == 2 do ( autosave.Interval = 5 autosavinterval = 2 ) if bkptime == 3 do ( autosave.Interval = 10 autosavinterval = 3 ) if bkptime == 4 do ( autosave.Interval = 20 autosavinterval = 4 ) if bkptime == 5 do ( autosave.Interval = 30 autosavinterval = 5 ) )--end on on bt_openmaxfilepath pressed do ( checkmaxfile() -- Refresh UI lbl_fname.text = ft_filename -- Refresh UI f = getOpenFileName caption:"Max Path Opener:" filename:ft_getfile ) on bt_explore pressed do ( checkmaxfile() -- Refresh UI lbl_fname.text = ft_filename -- Refresh UI shellLaunch "explorer.exe" maxfilepath ) on bt_refreshfile pressed do ( checkmaxfile() -- Refresh UI lbl_fname.text = ft_filename -- Refresh UI pos = GetDialogPos FileTools destroyDialog FileTools -- createDialog FileTools ft_uwidth ft_uheight fgcolor:yellow -- destroyDialog FileTools createDialog FileTools ft_uwidth ft_uheight fgcolor:yellow SetDialogPos FileTools pos if autosave.Enable == false do MessageBox "WARNING !\n Autoback will be turned OFF, if Max Crash in this meantime you'll loose your progress." ) on btft_major pressed do ( -- MAJOR checkmaxfile() -- Refresh UI majv = majv+1 minv = 1 savemajorminor() lbl_fname.text = ft_filename -- Refresh UI ) on btft_minor pressed do ( -- MINOR checkmaxfile() -- Refresh UI minv = minv+1 savemajorminor() lbl_fname.text = ft_filename -- Refresh UI ) on btft_2016 pressed do ( -- SaveAs Max 2016 checkmaxfile() -- Refresh UI lbl_fname.text = ft_filename -- Refresh UI saveMaxFile (maxfilepath+"Max2016_"+ft_filename) useNewFile:false saveAsVersion:2016 ) on btft_2015 pressed do ( -- SaveAs Max 2016 checkmaxfile() -- Refresh UI lbl_fname.text = ft_filename -- Refresh UI saveMaxFile (maxfilepath+"Max2015_"+ft_filename) useNewFile:false saveAsVersion:2015 ) on btft_2014 pressed do ( -- SaveAs Max 2016 checkmaxfile() -- Refresh UI lbl_fname.text = ft_filename -- Refresh UI saveMaxFile (maxfilepath+"Max2014_"+ft_filename) useNewFile:false saveAsVersion:2014 ) on FileTools open do ( if autosave.Enable == true then autosavstatus = 1 else autosavstatus = 2 -- Check AutoSave Status and show it on ui ----------------------------------------------- -- Check AutoSave time interval and show it on ui if autosave.Interval == 2 do autosavinterval = 1 if autosave.Interval == 5 do autosavinterval = 2 if autosave.Interval == 10 do autosavinterval = 3 if autosave.Interval == 20 do autosavinterval = 4 if autosave.Interval == 30 do autosavinterval = 5 -------------------------------------------------- holdpointer = 1 lblversion = 1 -- Yes numofiles = autosave.NumberOfFiles -- Check Number of Autoback files and show it on ui ft_getfile = "Not Saved Yet" ft_filename = "Not Saved Yet" checkmaxfile() ) )--end rollout createDialog FileTools ft_uwidth ft_uheight fgcolor:yellow