Converting a Real Name to a "full" Real Name

Last edited on

Overview

The Squish IDE offers to copy the real name of objects from the object map editor or the Application Objects view. However, these real names typically contain references to other objects. These references in turn are symbolic names as well.

This means that if you want to have a real name that does not contain any symbolic names anymore, you have to manually perform the transformation, replacing the symbolic names via copy and paste, which is a tiresome and error prone task.

Here is a little function that can do the transformation for you:

Python:

def abs_realname(n):
    """Return n as absolute Real Name"""

    s = objectMap.realName(n)
    while (s.find("=':") != -1):
        pre = s[0:s.find("=':")]
        pre = pre + "="
        post = s[s.find("=':") + 3:len(s)]

        # Skip over "\'":
        search_start = 0
        while True:
            if post.find("'", search_start) == post.find("\\'", search_start) + 1:
                search_start = post.find("'", search_start) + 1
            else:
                break
        sn = post[0:post.find("'", search_start)]
        sn = ":" + sn.replace("\\'", "'");
        post = post[post.find("'", search_start) + 1:]

        rn = objectMap.realName(sn)
        s = pre + rn + post
    return s
test.py

JavaScript:

/**
 * Return n as absolute Real Name
 */
function abs_realname(n)
{
    var s = objectMap.realName(n)
    while (s.indexOf("=':") != -1) {
        var pre = s.substring(0, s.indexOf("=':"));
        pre = pre + "=";
        var post = s.substring(s.indexOf("=':") + 3, s.length);

        // Skip over "\'":
        var search_start = 0;
        while (true) {
            if (post.indexOf("'", search_start) == post.indexOf("\\'", search_start) + 1) {
                search_start = post.indexOf("'", search_start) + 1;
            } else {
                break;
            }
        }

        var sn = post.substring(0, post.indexOf("'", search_start));
        sn = ":" + sn;
        post = post.substring(post.indexOf("'", search_start) + 1);
        var rn = objectMap.realName(sn);
        s = pre + rn + post;
    }
    return s;
}
test.js

The following workflow might be easiest: