-- Matt's Save Archive -- Version 0.1 - May 18th, 2015 -- Saves a dated and versioned file in a parallel 'archive' folder alongside max file. macroScript saveArchive category:"MattsScripts" tooltip:"Save Archived File" Icon:#("SetProjectFolder",1) ( local presentTime = getLocalTime() local presentYear = presentTime[1] as string local presentMonth = if presentTime[2] < 10 then presentMonth = "0" + presentTime[2] as string else presentMonth = presentTime[2] as string local presentDay = if presentTime[4] < 10 then presentDay = "0" + presentTime[4] as string else presentDay = presentTime[4] as string local presentDate = (presentYear + "-" + presentMonth + "-" + presentDay) local presentFile = maxFileName local presentFileName = getFilenameFile presentFile local presentFilePath = maxFilePath local presentArchivePath = presentFilePath + "archive\\" local presentArchiveFileName = presentArchivePath + presentFileName + "_" + presentDate + "_" local fileCheck = true local presentArchiveVersionString = "01" local newArchiveFileName = " " fn checkForArchive = ( for presentArchiveVersion = 1 to 99 while fileCheck do ( presentArchiveVersionString = if presentArchiveVersion < 10 then presentArchiveVersionString = "0" + presentArchiveVersion as string else presentArchiveVersionString = presentArchiveVersion as string newArchiveFileName = presentArchiveFileName + presentArchiveVersionString + ".max" fileCheck = doesFileExist newArchiveFileName ) makeDir presentArchivePath saveMaxFile newArchiveFileName clearNeedSaveFlag:false useNewFile:false quiet:false ) checkForArchive() )