General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Getting CRCL Resource locator from file path

  • markposton

    Getting CRCL Resource locator from file path

    Participants 2
    Replies 3
    Last Activity 12 years, 2 months ago

    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

    Reply

    murray

    Reply to: Getting CRCL Resource locator from file path

    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.

    Reply

    markposton

    Reply to: Getting CRCL Resource locator from file path

    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

    Reply

    murray

    Reply to: Getting CRCL Resource locator from file path

    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 );
    }

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support