variable, open and save as scene troubles

variable, open and save as scene troubles

manue154
Enthusiast Enthusiast
401 Views
1 Reply
Message 1 of 2

variable, open and save as scene troubles

manue154
Enthusiast
Enthusiast

 Hello everybody! i'm trying to make a maxscript to open a scene and save it, do you know where i'm wrong? because nothing is working 😞
by advance, thank you to make my dream become true...

-- prompt user to ask a number of a plan
 rollout LL_Layout "Enter Plan to open"
 (
  edittext plan_name "plan"
  button open_plan "OPEN"
  on open_plan pressed do
  (
   if plan_name.text != "" do
    
    -- get the number entered and make a variables:
    planName = plan_name.text
    camName = "108_"+ planName
   
    -- path for open scene:
    LoadPath = getFiles "E:\\"+camName+"\\"+camName+"*.max"   
    -- path for save as scene
    SaveASPath = "E:\\Users\\"+camName+"\\"
      
   -- open last scene by date founded:
    if LoadPath .count == 1 do (
    for f in LoadPath do (loadMAXFile f)
    
    -- get the variable and make another:
    OldcamName = "Old_" + camName
    
    extName = "_v000.max"
    SaveFile = camName+extName
    saveScene = SaveASPath + SaveFile
        
    -- make folder:
    makeDir SavePath
        
    --  save as the scene  in the folder created:    
    saveMaxFile saveScene
    )
  )--end on
 )--end rollout
createDialog LL_Layout 250 75

0 Likes
402 Views
1 Reply
Reply (1)
Message 2 of 2

manue154
Enthusiast
Enthusiast

a wonderful cat give me the solution, if someone somehere need it, read this, it's working:

 

-- prompt user to ask a number of a plan
global LL_Layout
try(destroyDialog LL_Layout)catch()
rollout LL_Layout "Enter Plan to open"
(
	edittext plan_name "plan"
	button open_plan "OPEN"
 
	on open_plan pressed do
	(
		if plan_name.text != "" do
		(
			-- get the number entered and make a variables:
			planName = plan_name.text
			camName = "108_"+ planName
			-- path for open scene:
			LoadPath = getFiles ("E:\\"+camName+"\\"+camName+"*.max")
			-- path for save as scene
			SaveASPath = "E:\\Users\\"+camName+"\\"
			-- open last scene by date founded:
			if LoadPath.count == 1 do 
			(
				for f in LoadPath do 
				(
					resetMaxFile #noPrompt
					loadMAXFile f quiet:true
					-- get the variable and make another:
					OldcamName = "Old_" + camName
					extName = "_v000.max"
					SaveFile = camName+extName
					saveScene = SaveASPath + SaveFile
					-- make folder:
					--	"SAVEPATH is not defiend.Use the proper variable."
					--	"makeDir SavePath"
					if makeDir SaveASPath == true then
					(
						-- save as the scene in the folder created:
						if (saveMaxFile saveScene quiet:true) == true then
							format "SAVED: %\n" saveScene
						else
							format "NOT SAVED: %\n" saveScene 
					)
					else
					(
						format "Can't create folder: % \n" SaveASPath
					)
				)
			)
		)
	)--end on
)--end rollout
createDialog LL_Layout 250 75
0 Likes