Pages: 1
Print
Author Topic: Getting CRCL Resource locator from file path  (Read 5307 times)
markposton
Member

Posts: 10


« on: July 30, 2010, 05:15:47 AM »

Hi,
I am wanting to get the CMS locator for the active document.
I am trying this:
    repoService.getCRCLLocator(ActiveDocument.Name);
but I seem to get an empty response back.                                                                                                                                                                                                                                                                                                                                                 
Is this the correct method to use?
Regards
mark
Logged
murray
Member

Posts: 23


« Reply #1 on: August 03, 2010, 03:03:22 PM »

I believe you can use:

Application.ActiveDocument.CRLocator

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.
Logged
markposton
Member

Posts: 10


« Reply #2 on: August 04, 2010, 07:56:40 AM »

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.

Cheers

Mark
« Last Edit: August 04, 2010, 08:26:48 AM by markposton » Logged
murray
Member

Posts: 23


« Reply #3 on: August 04, 2010, 02:06:12 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 );
}
Logged
Pages: 1
Print
Jump to: