Notifications
Clear all

[Closed] Custom gizmo?

If it is a scripted plugin, it MUST be installed as a plugin.
In other words, the .MS file must be in a Plugins folder or a Scripts\Startup folder so it gets loaded when Max starts. Otherwise it is like trying to load a scene with a missing DLL…

1 Reply
(@polimeno)
Joined: 11 months ago

Posts: 0

great, now it´s working.

thanks again Bobo !!

Ok,
so now i have a question:

how is the best way to copy/paste my customManip.ms file via MXS ??
i want to put it inside startup Script path automatically.

fileIn isn´t working as i expected…

get source path

main_Path = "Z:\\scripts"

get the .ms file

file_MXS = main_Path + "\\" + "customManip.ms"

copy the file from that and paste to startup Scripts
???


 StartupScripts_Folder = getDir #StartupScripts
 

thanks in advance

i can run it,
but i don´t know how to spread it inside the StartupScript directory…


  			-- source Directory
  			file_Type = "\\*.ms"
  			NetWork_Path = "W:\\Scripts_Max"
  			sub_Path = NetWork_Path + ("\\" + "custom_Manipulator")
			-- return
			--"W:\Scripts_Max\custom_Manipulator"
			
  			-- load all .ms files
  			load_MXS = getFiles (sub_Path + file_Type)
		   -- return
		   -- #("W:\Scripts_Max\custom_Manipulator\custom_Manipulator_07.ms", "W:\Scripts_Max\custom_Manipulator\custom_Manipulator_08.ms", "W:\Scripts_Max\custom_Manipulator\custom_Manipulator_CTRL.ms")
			
  			-- get StartupScript Path (target Directory)
  			StartupScripts_Folder = getDir #StartupScripts
		   -- return
		   -- "C:\Program Files\Autodesk\3ds Max 2009\scripts\startup"
			
  			-- get the last file
  			Count = load_MXS.count
  			customManip_MXS = load_MXS[Count]
  			-- return
			--3
			--"W:\Scripts_Max\custom_Manipulator\custom_Manipulator_CTRL.ms"

  				if (doesFileExist(customManip_MXS) == true )
  					then
  					(
  						-- test properties
  						getFileSize customManip_MXS
  						getFileAttribute customManip_MXS #directory
  						
  						-- load
  						File_In = fileIn customManip_MXS
  						
  						-- read & execute
  						File_Read = openFile customManip_MXS mode:"rt"
  						execute File_Read
  						File_Copy = save 
  						
  						format "% % % " (File_In as string) (File_Read as string) (StartupScripts_Folder as string)
  					)
  -- return
--CTRL_ <File:W:\Scripts_Max\custom_Manipulator\custom_Manipulator_CTRL.ms> C:\Program Files\Autodesk\3ds Max 2009\scripts\startup OK
--OK					

  

what am i missing ??

fileIn() SHOULD work.

You said it wasn’t working as expected, what did you get when you tried and what did you expect to get? When you get errors or unexpected results, please tell us about them

fileIn() is equivalent to opening a file in the editor and pressing Ctrl+E or selecting Run Script from the MAXScript menu. If I had to do what you are trying to do, I would have used it.

FileIn() loads AND EXECUTES the script in global scope. So you don’t have to execute() anything after that.

after reading and evaluating the file – wich is fine using FileIn() , as you said –
i want to spread the .ms file automatically to my local StartupScript directory (search, read, load, copy and paste).

so, how can i do that ??
any ideas ?

1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

You mean COPY the file to the directory?

copyFile sourceFilename targetFilename

testing :


  			-- source Directory
  			file_Type = "\\*.ms"
  			NetWork_Path = "W:\\Scripts_Max"
  			sub_Path = NetWork_Path + ("\\" + "custom_Manipulator")
  			
  			-- load all .ms files
  			load_MXS = getFiles (sub_Path + file_Type)
  			
  			-- get stdplugs stdscripts Path (target Directory)
  			root_Path = (getDir #maxroot) + "stdplugs" + "\\stdscripts"
  			load_StdScripts = getFiles (root_Path + file_Type)
  			load_StdScripts.count
  
  			-- get the last file
  			Count = load_MXS.count
  			customManip_MXS = load_MXS[Count]
  			
  			-- get file name
  			File_customManip = getFileNameFile customManip_MXS
  
  			-- copy file to its own directory
  			Copy_customManip = (getFileNamePath customManip_MXS) + "\\" + File_customManip + "_00.ms"
  			copyFile customManip_MXS Copy_customManip
  

– returns
“*.ms”
“W:\Scripts_Max”
“W:\Scripts_Max\custom_Manipulator”
#(“W:\Scripts_Max\custom_Manipulator\custom_Manipulator_07.ms”, “W:\Scripts_Max\custom_Manipulator\custom_Manipulator_08.ms”, “W:\Scripts_Max\custom_Manipulator\custom_Manipulator_CTRL.ms”)
“C:\Program Files\Autodesk\3ds Max 2009\stdplugs\stdscripts”
38
3
“W:\Scripts_Max\custom_Manipulator\custom_Manipulator_CTRL.ms”
“custom_Manipulator_CTRL”
“W:\Scripts_Max\custom_Manipulator\custom_Manipulator_CTRL_00.ms”
true

BUT if i change the part –copy file to its own directory

to this :

 
  		   -- copy file to target Directory
  			Copy_customManip = root_Path + "\\" + File_customManip + "_00.ms"
  			copyFile customManip_MXS Copy_customManip
  

– returns
“W:\Scripts_Max\custom_Manipulator\custom_Manipulator_CTRL.ms”
“custom_Manipulator_CTRL”
“C:\Program Files\Autodesk\3ds Max 2009\stdplugs\stdscripts\custom_Manipulator_CTRL_00.ms”
false
OK

or this :


 			-- other target Directory
 			StartupScripts_Path = (getDir #startupScripts) + "\\"
 			Copy_again = StartupScripts_Path + File_customManip + "_00.ms"
 			copyFile customManip_MXS Copy_again
 

–returns
“C:\Program Files\Autodesk\3ds Max 2009\scripts\startup”
“C:\Program Files\Autodesk\3ds Max 2009\scripts\startup\custom_Manipulator_CTRL_00.ms”
false

in both cases i got FALSE…
why ?? what am i missing ?

You can get false in several cases:

*The file is already there
*The path is wrong / folder does not exist yet
*You have no rights to write to that directory (which would be the case with Vista and UAC on since nobody can write to a Program Files subfolder).

Does any of these look like your case?

3 Replies
(@polimeno)
Joined: 11 months ago

Posts: 0

yes, the third one…

do i have other options ?
is there any chance to populate my plugIn using macros ?

(@bobo)
Joined: 11 months ago

Posts: 0

Of course you do, this has been changed since Max 9 even before Vista came out.
For Macros, Icons and Startup Scripts there are alternative User paths that should be used to place custom MacroScripts, Icons and Script files.

Instead of hard-coding your paths, use the methods to get the system settings:

getDir #userstartupscripts

–on my WinXP machine returns:
“C:\Documents and Settings\bpetrov\Local Settings\Application Data\Autodesk\3dsMax\2010 – 64bit\enu\scripts\startup”

whereas

getDir #startupscripts
–returns
“C:\Program Files\Autodesk\3ds Max 2010\scripts\startup”

On Vista, these paths will be slightly different (they are under C:\Users\UserName), but the general idea is that these paths are user-modifiable, while the C:\Program Files\ are not under Vista and Windows 7.

(@polimeno)
Joined: 11 months ago

Posts: 0

thanks a lot Bobo, now it´s working like a charm.

I downloaded the subscription video, and of course it’s great. But I don’t see the notes and project files available. Any way I can get those too?

Those are on the info page that pops up when you click the link from the training page, right under the Presenter Biography.

-Eric

Page 2 / 2