General XMetaL Discussion
markposton July 30, 2010 at 11:15 am
Getting CRCL Resource locator from file pathJuly 30, 2010 at 11:15 amParticipants 2Replies 3Last Activity 12 years, 6 months ago
I am wanting to get the CMS locator for the active document.
I am trying this:
but I seem to get an empty response back.
Is this the correct method to use?
markmurray August 3, 2010 at 9:03 pm
Reply to: Getting CRCL Resource locator from file pathAugust 3, 2010 at 9:03 pm
I believe you can use:
If it is null, the document was opened from the file system, if it is not null the document was opend from the repository and it contains the CRCL Resource Locator.markposton August 4, 2010 at 1:56 pm
Reply to: Getting CRCL Resource locator from file pathAugust 4, 2010 at 1:56 pm
Thanks for the tip.
I get returned back an object but can't see how to get the actual locator. The Programmer's guide has nothing documented except that it's an internal use only property.
The only examples I can find of this in the JS code in XMetaL is:
CRLocator.CRinstanceID which returns an integer, and
CRLocator.resourceId which returns the path to the active doc, not the CMS locator.
There seems to be some other methods to get the locator from the file path but not sure how to use these either.
The reason I want to do this is to provide some functionality to return metadata from the CMS for the active doc. I therefore need to send a request back into my CMS to get this metadata.
Markmurray August 4, 2010 at 8:06 pm
Reply to: Getting CRCL Resource locator from file pathAugust 4, 2010 at 8:06 pm
The following code works for me. Note that it will do nothing if the file was opened from the file system because Application.ActiveDocument.CRLocator will be null. However if the file was opened from the repository it should display the repository id of the active document.
// XMetaL Script Language JSCRIPT:
if( Application.ActiveDocument.CRLocator )
Application.Alert( Application.ActiveDocument.CRLocator.resourceID );
- You must be logged in to reply to this topic.