Make a script looks for a more up to date version of itself on a server

I've got some max scripts I've done and I've put them available on the server drive at work for everyone else to use. I'd like to add some lines to the scripts so that the script in the macroscript folder of max on every users computer would first looks for itself on the shared drive in a specified folder and would, if it finds the file, then compare its own modification date to the one on the drive. If the date on the drive is more recent than the one on the user's computer, it would either ask to manually update the script or would update it by itself if that's possible.

Would anyone have any idea how to do that? I've already done it with javascript for Photoshop so I guess there must be a way also with maxscript, but I just don't know the codes I need.

(Is there some reference site someplace with all maxscript codes?)

Thanks

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Admin's picture

Have you thought of simply

Have you thought of simply using a batch file on system startup? You could simply batch a file copy of scripts / plugins / etc from the file server down to the local desktops.

I actually do something similar for our SketchUp assets - we have 12 offices with a WAN connection to a central server. I have SketchUp check a single file modification date on the server and if its newer than the local file then it kicks off the batch file to get new updates. You could do something similar in max, and kick off a batch file to actually get the updates. Only reason I find batch files useful for this is you can use robocopy which intelligently copies files / directories and handles all the newer vs. older by itself (ie only overwrite old files but skip copying unchanged files to save bandwidth)

Alternative #1: if you'd like to skip all the hard work , how about setting up your script directory to be a folder on the server? 3ds would just startup and always load the scripts over the network... Scripts are really low bandwidth and the network performance / hit shouldn't be noticable...

Alternative #2: if you're really set on using maxscript, there are methods for checking file attributes such as date modified and you can find examples / info in the maxscript help under the topic index 'external file access' then 'external file methods' ... Off the top of my head you would create a loader maxscript to check the date, then copy a new file to the max scripts folder then do a 'include' of that file... So you could have a single macroscript file that did a file version check in the header then the individual macroscript definitions would just have 'include filename.ms' instead of the actual code...

Christopher Grant
Admin, ScriptSpot.com

FausseFugue's picture

Hi Christopher, Thanks a lot

Hi Christopher,

Thanks a lot for the reply.

Unfortunately, I had seen that tutorial but the problem is that my scripts are on a drive on the server, so it's mapped as a drive on everyone's computer, so what I would need is for the script to look on drives and not on http sites with active x. I guess it must be possible to keep some parts of that script from Rod Green but most of it is not useful for me. What I'd need is not know how to make maxscript search for files on the drive so it can copy it from there. Also, the version date wouldn't be from things on the site but from the "modified date" of the file in windows explorer.

Thanks!

Admin's picture

Fortunately, most of the

Fortunately, most of the work has already been done. There is a tutorial on ScriptSpot from Rod Green here:

 

Christopher Grant
Admin, ScriptSpot.com

FausseFugue's picture

Or is there a way to load a

Or is there a way to load a javascript from a maxscript? That way I could use the code I already have because the part of the javascript that I'm using to check the version doesn't have any Photoshop functions, it only looks for files on the drives. The maxscript would load the javascript, which would then return a value to the maxscript ("Up to date" or "not up to date") and depending on the value the maxscript would either continu or stop.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.