Attributes of external Links

Hi,

i've got a script that search for external links in specific project.
I want to get the Path of the module and the object ID, so far it works.

Further i need the information in the "External-Link"-Dialog (rightclick object -> properties -> Links -> Edit external) named "Name", "Description" and "Link Path".

Does anybody know how to get these? I've tried:
 

pragma runLim,0
 
Project p = project "/W221MOPF"
Item i
ExternalLink lnk
 
for i in p do
{
    if (type(i) == "Formal")
        {
                ModName_ tar = module(fullName(i))
                ModuleVersion modver = moduleVersion(tar)
                Module m = load(modver, false)
 
                Object o
 
                for o in m do
                {
                        for lnk in o -> "*" do
                        {
                                //These two prints work:
                                print fullName(i) "\n"
                                print o."Absolute Number" "\n"
                                
                                //Non working prints...
                                print lnk."Name" "\n"
                                print lnk."Description" "\n"
                                print lnk."Link Path" "\n\n"
                                
                        }
 
                }
 
                close(m)
        }
}

 


but i've got an 'unknown Link attribute (Name)' error..

Can anybody help?

Regards,
Manuel

 


ManuelFelger - Wed Jul 01 10:06:50 EDT 2009

Re: Attributes of external Links
llandale - Wed Jul 01 13:25:01 EDT 2009

I have not yet dealt with External Links, but your code attempts to get the 'Name', 'Description', and 'Link Path' of all links. These are not standard attributes of standard links, thus your error. This is the same error you'd get if you tried this: string Value = obj."NoSuchAttr".

You can probably trap and ignore these errors by inserting 'noError()' before these prints and 'lastError()' after. You may need to stage the values in variables, then print the variables.

I would be tempted to filter your link loop for External Links and dump only that information, but I don't know how to do that.

  • Louie

Re: Attributes of external Links
SystemAdmin - Wed Jul 01 14:07:02 EDT 2009

llandale - Wed Jul 01 13:25:01 EDT 2009
I have not yet dealt with External Links, but your code attempts to get the 'Name', 'Description', and 'Link Path' of all links. These are not standard attributes of standard links, thus your error. This is the same error you'd get if you tried this: string Value = obj."NoSuchAttr".

You can probably trap and ignore these errors by inserting 'noError()' before these prints and 'lastError()' after. You may need to stage the values in variables, then print the variables.

I would be tempted to filter your link loop for External Links and dump only that information, but I don't know how to do that.

  • Louie

Variable lnk is defined as ExternalLink, so the for loop handles only external links.

Re: Attributes of external Links
llandale - Wed Jul 01 17:07:16 EDT 2009

SystemAdmin - Wed Jul 01 14:07:02 EDT 2009
Variable lnk is defined as ExternalLink, so the for loop handles only external links.

Doh!

Don't see it in the DXL manual, but here are some commands available in the v9.1 doors.exe:

// Constants:
// Type name

ExternalLinkBehaviour openAsURL
ExternalLinkBehaviour none
ExternalLinkDirection outward
ExternalLinkDirection inward

// Functions:
// Return Type FunctionName(Parameters) Comment

ExternalLinkBehaviour behaviour(ExternalLink) ExternalLinkBehaviour
ExternalLinkDirection direction(ExternalLink) ExternalLinkGetDirection

string body(ExternalLink) ExternalLinkBody
string description(ExternalLink) ExternalLinkDescription
string name(ExternalLink) ExternalLinkName
string follow(ExternalLink) ExternalLinkFollow
Object target(ExternalLink) ExternalLinkTarget
Object source(ExternalLink) ExternalLinkSource

string source(ExternalLink) sourceExtLinkMod
ModName_ source(ExternalLink) sourceExtLinkDoc
ExternalLink current() CurrentExternalLink

string update(string description, string name, ExternalLinkDirection direction,
ExternalLinkBehaviour follow, string body, ExternalLink newLink) UpdateExtLink
string create(Object o,string description, string name,ExternalLinkDirection direction,
ExternalLinkBehaviour follow, string body, ExternalLink& newLink) MkExtLink

There are a few others.


So it looks like you get the 'description' of the ExternalLink via:
string ExDesc = description(l)

The 'body' I think you'll find is the URL or the 'Link Path' in the GUI; the 'name' is the name.

Play with it and let us know.

  • Louie