Home Forums General XMetaL Discussion XMetaL 9 tab customizations Reply To: XMetaL 9 tab customizations

Derek Read

Reply to: XMetaL 9 tab customizations

Going back all the way to version 3 (the oldest version I have installed) I see that this API has always behaved this way.

I'll have to discuss with development whether or not it makes sense to alter the behaviour, and I think one can make an argument either way for Save. If the value you are setting is based on the file name (as in your case) then keeping it the same makes sense, but it might not make sense in other cases where the value is coming from somewhere else (saving might alter the document in a way that requires the value to change). It likely wouldn't hurt. Clients that want to change it on Save could still do so (see code below). However, for Save As it is likely that everyone would need to change it, even people basing the value on the file name. So in that case it doesn't save any scripting work.

The software has events in place specially designed to allow people to override what happens for most of the File menu items. This includes Save and Save As. So, the solution is quite simple, provided nothing in your solution is already using those events.

You can implement the following (or have SDL do it) application-level macro to handle Save and SaveAs to local files. SDL's entire solution is essentially application-level so it would likely be fairly trivial for them to put this in place. If they cannot then you can add an MCR into the Startup folder yourself. I've coded the whole file and quoted it below so you can copy and paste it into an empty file and stick that in the Startup folder, then restart and you are good to go. The one thing you will need to change is the portion I've indicated. This would likely need to match whatever script SDL has already coded up for you as part of their check-in code.

[code=Example — Manipulating Document Title (Tab Text) On Save and SaveAs Events]

ActiveDocument.Save(); //set the value that displays in the document's tab
//this is just an example and you would need to put your own logic in here
//depending on what you want to display
var strDocTitle = ActiveDocument.Name.substr(0,10);
ActiveDocument.Title = strDocTitle; ]]>

ActiveDocument.SaveAs(); //set the value that displays in the document's tab
//this is just an example and you would need to put your own logic in here
//depending on what you want to display
var strDocTitle = ActiveDocument.Name.substr(0,10);
ActiveDocument.Title = strDocTitle; ]]>

[/code]

Reply

Products
Downloads
Support