diff --git a/CAMAuto/ManProcOneMachGroup.lua b/CAMAuto/ManProcOneMachGroup.lua index 970858e..9a3ce9b 100644 --- a/CAMAuto/ManProcOneMachGroup.lua +++ b/CAMAuto/ManProcOneMachGroup.lua @@ -8,12 +8,38 @@ EgtEnableDebug( false) -- scelta della macchinata da aprire -local sOpenDirPath = 'C:\\EgtData\\EgtWindowMaker\\Projects\\*.bwe' -sOpenFilePath = EgtFileDialog( true, sOpenDirPath, "Window Project Files (*.bwe)|*.bwe||") +local sOpenDirPath = EgtGetStringFromIni( 'Window', 'LastJwdDir', 'C:\\EgtData\\EgtWindowMaker\\Projects', EgtGetIniFile()) +if EgtEndsWith( sOpenDirPath, '\\') then + sOpenDirPath = sOpenDirPath .. '*.bwe' +else + sOpenDirPath = sOpenDirPath .. '\\*.bwe' +end +sOpenFilePath = EgtFileDialog( true, sOpenDirPath, "Window MachGroup Files (*.bwe)|*.bwe||") if not sOpenFilePath then return end +local sDir = EgtSplitPath( sOpenFilePath) +EgtWriteStringToIni( 'Window', 'LastJwdDir', sDir, EgtGetIniFile()) +-- eventuale copia dell'originale +local sOrigFile = EgtChangePathExtension( sOpenFilePath, '.omgr') +if not EgtExistsFile( sOrigFile) then + EgtCopyFile( sOpenFilePath, sOrigFile) +end + +-- cancello eventuali vecchi file con lo stesso nome +local vFiles = EgtFindAllFiles( EgtChangePathExtension( sOpenFilePath, '*')) +for i = 1, #vFiles do + local sFileToErase = sDir .. vFiles[i] + if string.upper( sFileToErase) ~= string.upper( sOrigFile) then + EgtEraseFile( sFileToErase) + end +end + +-- copio l'originale come nuovo file di partenza +EgtCopyFile( sOrigFile, sOpenFilePath) + +-- lancio local _, sBaseDir = EgtEndsWith( EgtGetSourceDir(), '\\') _G.WIN = { BASEDIR = sBaseDir,