Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography



Maxunderground news unavailable

Looking for a way to adapt this script to add prefixes & current date
show user profile  jpedleham
Im struggling to find the correct place in this script to add the information i need.
I need the file to save with the prefix "JP_" And add the current date to the end of the filename.
I know the code to do this as its easy however i need to adapt the script for different people as the prefix will change for each person so i cant just type these upon save. Can anyone figure out the right place to put the prefix/suffix code in this script?
http://scripts.breidt.net/incrementalSave.mcr

Cheers
Jack

EDIT: I Have tried just adding a variable called 'initials' to the part where it assembles the filename but it throws the error 'no function '+' for undefined'

read 642 times
12/15/2014 12:18:38 PM (last edit: 12/15/2014 12:20:55 PM)
show user profile  reeves1984
newSaveName = saveName + incrementalSave_sepSym + (padNumber newNr incrementalSave_padLen) + ".max"

Do you mean you tried to add it on that line? That one looks likely to be the one to change.
Though what does it do, make a new scene and then rename it or something? I've made increment save scripts for xsi and maya this one seems a bit overly complex heh

--
Simon Reeves


www.simonreeves.com - VFX Artist & Blog
twitter


www.analogstudio.co.uk <-- I work here

read 628 times
12/15/2014 2:08:59 PM (last edit: 12/15/2014 2:08:59 PM)
show user profile  jpedleham
Yeah thats the one i tried to edit

Essentially the script increments the save but it keeps the newest save with the original name and moves previous saves into a folder and names them with incrementing numbers each time you save, however im working on a large model library and we use alot of xrefs and if a moddel gets the filename changed our replacer script wont pick it up. id like to be able to have each user include their initials before the name so future users can see who worked on it for new models.

For example the script will output a file named Testfile.max as the most recent, then in a folder in the same directory there will be further saves names Testfile_V001.max
I would like them to read JP_Testfile_v001_151214.max

I tried definiting an initial variable 'Initials = "JP_" and adding that as well as CurrentDate to that line but it throws that same error each time for some reason.
read 604 times
12/15/2014 9:07:19 PM (last edit: 12/15/2014 9:09:24 PM)
show user profile  Garp
Instead of trying to save all the information into a file name, which might not be the best place for it, you could use the regular incremental save and maintain a simple map in a text file with all the info that you want. File names are then just identifiers in the map and if later you want to change or add more info, it'll be a lot easier.
Just a thought.




read 593 times
12/15/2014 11:26:32 PM (last edit: 12/15/2014 11:26:32 PM)
show user profile  jpedleham
Could you explain further what you mean by map?
Just like a logbook of who worked on what and when?

Ive been specifically asked for this naming convention to be scripted and automatic you see. Basically because i know that scripts exist for things and can install them ive been dubbed as someone who knows how to actually script maxscript in my job haha
read 590 times
12/15/2014 11:52:24 PM (last edit: 12/15/2014 11:52:24 PM)
show user profile  Garp
'map' as in 'mapping' (from file name to data).
You could maintain a text file where each line would start with a file name followed by content ID, content description, author, revision, etc. Scripts could then read the file line by line, find the one starting with a given file name and retrieve the information into an array (better use array than struct, since arrays in mxs are really tuples).
You just have to define a data format. So map_lib[1] would be some ID or internal name, map_lib[2] a description string, map_lib[3] the original modeler, etc, you get the gist.
If later you want to add more fields to your data format, it doesn't break older scripts. Simple and flexible :)




read 586 times
12/16/2014 12:17:59 AM (last edit: 12/16/2014 12:17:59 AM)
show user profile  jpedleham
I kinda get what youre getting at but thats wayyyy too complex for my almost nonexistent maxscript skills haha. i think the system this script provides is great for what i need. Its just i cant figure out how to get my own prefix into the filename. Its a relatively small team anyway and the only reason we need this addition is so that in future we can query the right person or see who f****d up haha.
Ill keep trying with this script. It sounds like a good idea what youre proposing though. I suppose i could script something to create a simple log file with the filename, the date, time and then the user who saved the file. But then again they did specifically ask for it in the filename. Hmmmmm.
read 584 times
12/16/2014 12:23:46 AM (last edit: 12/16/2014 12:23:46 AM)
show user profile  Garp
> But then again they did specifically ask for it in the filename.

I see. It sounds like you have a 'manager' :). Stick to the script you have then.
You could still mention to they that a file name is not the proper place to store information.
Good luck!




read 584 times
12/16/2014 12:31:01 AM (last edit: 12/16/2014 12:31:01 AM)
show user profile  jpedleham
I do indeed have a manager and a team who like me, wouldnt remember to add the information to the filename. I think its just ease of access mainly. being able to search for a specific site model using the name and date would definitely be handy. I even thought it might be useful to store it as a popup note.
read 584 times
12/16/2014 12:36:11 AM (last edit: 12/16/2014 12:36:11 AM)
show user profile  jpedleham
I just tried adding a popup note programmatically. it worked but max as usual is being a complete fucking arse and for some reason wont save the author name. each time i add a note it sets the author name to a single digit and adds random crap into the comments section. it does this even when using the built in add note macro. i even tried editing the original add note macro to use strings instead of getting the author text from the file properties and it still somehow decides it would rather use a number than the name i have hard coded into the script. I dont understand the way max loads scripts either because i have edited the script, saved it, and then when i reopen the script in max's script window the changes arent there despite being in the actual file. Crazy.

EDIT: Managed to get it to keep the right name. Could anyone help me out with a callback snippet that will open a messagebox on file load?
read 570 times
12/16/2014 10:41:00 AM (last edit: 12/16/2014 12:39:53 PM)
show user profile  jpedleham
Ive inserted the code;

fn authortext =
(
messagebox "Last Edited By: " + sysInfo.username + " on " + localtime
--print "Last Edited By: " + sysInfo.username + " on " + localtime---
--callbacks.removeScripts id:#postfileCB
)

callbacks.addScript #filePostOpen "authortext()" id:#postfileCB persistent:true

I recieve the error;

-- Error occurred in anonymous codeblock
-- Frame:
-- authortext: undefined
>> MAXScript Callback script Exception:
-- Type error: Call needs function or class, got: undefined <<

What am i doing wrong? Probably something massive, im really fumbling my way through this. It it because the authortext function isnt loaded at startup because its in a different macro? Could i put the authortext function into its own script and then set that as a filepostopen callback?

read 558 times
12/16/2014 12:46:27 PM (last edit: 12/16/2014 12:56:32 PM)
show user profile  reeves1984
I have a callback script that works so you can compare...



fn GetCommentsPY = (
python.ExecuteFile "\\pathto\Analog_Pipe_GetComments.py"
)

callbacks.addScript #filePostOpen "GetCommentsPY()" id:#Analog_PipeSceneOpen

--
Simon Reeves


www.simonreeves.com - VFX Artist & Blog
twitter


www.analogstudio.co.uk <-- I work here

read 551 times
12/16/2014 1:02:32 PM (last edit: 12/16/2014 1:02:32 PM)
#Maxforums IRC
Open chat window


Support Maxforums.org