General XMetaL Discussion
XMetaL Community Forum › General XMetaL Discussion › Track changes default on
-
bjorn March 24, 2015 at 10:51 am
Track changes default on
March 24, 2015 at 10:51 amParticipants 9Replies 10Last Activity 8 years agoHi.
We uses XMetaL Version#: 9.0.0.053When we start XMetaL, we need it to default turn on track changes on startup. I'm have been looking a little bit around, and see if I could figure out where this could be set, without luck.
Do you know if this is possible, and how could this action be be triggered?
Thanks!
Regards,
Bjørnbarbwire March 24, 2015 at 12:06 pm
Reply to: Track changes default on
March 24, 2015 at 12:06 pmCreate macro, which tells:
[code]ActiveDocument.TrackRevisions = true;[/code]
http://xmetal.com/webhelp/en/xmetaldeveloper/pg/7.0/Document-TrackRevisions.html#xmetal.pg_document.trackrevisionsedit: put the macro to startup-folder for event which you like (maybe document open complete).
npalmer610 July 15, 2015 at 8:33 pm
Reply to: Track changes default on
July 15, 2015 at 8:33 pmHi. I'm a complete n00b to Xmetal macros, so please bear with me. I'm using Xmetal Version#: 9.0.0.053. I am trying to turn on Track Changes by default when opening files that already have tracked changes. I tried to follow the example, but I haven't the foggiest how to build it into a macro. Would anyone be kind enough to give me some guidance? I know this will ultimately go in my .mcr file, but I'm not quite certain how to construct it so that it is functional (other than knowing it needs a closing and opening
tag. Thanking you in advance for your help! barbwire July 16, 2015 at 6:26 am
Reply to: Track changes default on
July 16, 2015 at 6:26 am[code]
ActiveDocument.TrackRevisions = true;
]]>
[/code]
Hope this works. v_vnpalmer610 July 16, 2015 at 10:44 am
Reply to: Track changes default on
July 16, 2015 at 10:44 am[code]
ActiveDocument.TrackRevisions = true;
]]>
[/code]
Hope this works. v_vBarbwire, those are the most beautiful lines of code I've seen all morning: this worked perfectly. Thanks so much!!! ^ _ ^
npalmer610 July 16, 2015 at 1:34 pm
Reply to: Track changes default on
July 16, 2015 at 1:34 pmBarbwire, I did have one quick follow-up: is there a way to modify it so that it is only turned on by default if there are already tracked changes in the file?
barbwire July 17, 2015 at 6:15 am
Reply to: Track changes default on
July 17, 2015 at 6:15 amBarbwire, I did have one quick follow-up: is there a way to modify it so that it is only turned on by default if there are already tracked changes in the file?
Well, I think it is maybe possible by modifying macro, but I don't have time to do that. 😛
Derek Read July 20, 2015 at 9:39 pm
Reply to: Track changes default on
July 20, 2015 at 9:39 pmTry something like this:
[code]
var rng = ActiveDocument.Range; [/code]
rng.SelectAll();
var docStr = rng.TextWithRM;
//Application.Alert(docStr);
var has_change_mark = false;
if(docStr.search(/ -1) {
has_change_mark = true;
}
if(docStr.search(/ -1) {
has_change_mark = true;
}
if(has_change_mark) {
ActiveDocument.TrackRevisions = true;
}
//else: do nothing
]]>Note: The code above may look odd, and it is a bit unusual. Normally there are far better ways to find content (including PIs) in a document. The APIs getNodesByXPath() and GotoNext() work for PIs and would be preferable, but specifically do [u]not[/u] find Revision Marking PIs. The nature of the Revision Marking PIs makes that impossible as they exist outside of the main content of the DOM in XMetaL (for good reasons I won't try to explain). This script grabs the document's content as a string using the special TextWithRM property (to bring in the revision marks), then examines that text using JScript regular expressions (normally something that would be pretty dumb to do on an XML string but that is “good enough” for this case, and has the added benefit of being fast). There is a special PI for moving between revision marks named GotoNextChange(), but that results in a dialog being displayed when no revision marks are found and obviously you want this script to run silently.
lxsibi January 4, 2016 at 5:01 pm
Reply to: Track changes default on
January 4, 2016 at 5:01 pmOur XML files are in a content management system, Astoria, and we use XMetaL Version#: 8.0.1.041 to edit the files. We would like to turn on track changes as the default when editing files since it is quite possible that our writers may forget to turn it on. I tried using Barbwire's code and named the file TrackChangesOn.mcr which is placed in the Startup folder. But it didn't work.
Did I place the macro file in the wrong place, does it not work with Version 8, or do I need to place this code in another location?
Thanks for you help.
Derek Read January 5, 2016 at 12:50 am
Reply to: Track changes default on
January 5, 2016 at 12:50 amIt should work with any release. I can think of a few possibilities:
1) The Astoria code is interfering with the macro. You would need to follow up with them for help in this case. Perhaps their integration also uses this API or does something to interfere with it.
2) The macro file is not loading or some of its content is being ignored. This would suggest it is incorrectly formatted or there is some other issue with the file.
3) The specific version you are running has a bug. I'm not aware of any bugs related to this API however.barbwire January 5, 2016 at 5:26 am
Reply to: Track changes default on
January 5, 2016 at 5:26 amOur XML files are in a content management system, Astoria, and we use XMetaL Version#: 8.0.1.041 to edit the files. We would like to turn on track changes as the default when editing files since it is quite possible that our writers may forget to turn it on. I tried using Barbwire's code and named the file TrackChangesOn.mcr which is placed in the Startup folder. But it didn't work.
Did I place the macro file in the wrong place, does it not work with Version 8, or do I need to place this code in another location?
Thanks for you help.
Did you remember to put doctype and
?:
[code]ActiveDocument.TrackRevisions = true;
]]>
[/code] -
AuthorPosts
- You must be logged in to reply to this topic.