Bridge: Can I get the keywordsManager script functions and its arguments?

  • 2
  • Question
  • Updated 4 years ago
On ESTK, running over Bridge CS6, this fives me a function:
$.writeln(app.document.keywordsManager.renameKeyword)

I get on console:

function renameKeyword() {
[native code]
}

How can I get the native code of that function?
I do not know how the arguments are organized and how it can be used.

I can also get my active app Bridge keywords like this:
app.document.keywordsManager.serializeToXML()

and I have also other functions I would like to test and learn on how to use them, like
addKeyword(??), renameKeyword(??), deleteKeyword(??)

I'm using CS6
Photo of Pedro Marques

Pedro Marques

  • 161 Posts
  • 25 Reply Likes

Posted 5 years ago

  • 2
Photo of Pedro Marques

Pedro Marques

  • 161 Posts
  • 25 Reply Likes
I solve it.

Here are the functions and its arguments:


  • app.document.keywordsManager.addKeyword (keywordPath:String, useHierarchicalPath:Bollean)


  • app.document.keywordsManager.deleteKeyword (keywordPath:String, useHierarchicalPath:Bollean)


  • app.document.keywordsManager.renameKeyword (oldName:String, newName:String, useHierarchicalPath:Bollean)

  • app.document.keywordsManager.serializeToXML()



Note regarding sub keywords creation:
when useHierarchicalPath is true, the function will seek the keywordPath string and if it detects a vertical slash (for example "aaa|bbb") that means a keyword "aaa" and a sub keyword "bbb" will be created. "aaa" is created if doesn't exist.
This is the same logic used on deleteKeyword and renameKeyword.

Examples:

addKeyword
app.document.keywordsManager.addKeyword ("some words", true); // adds the keyword "some words"
app.document.keywordsManager.addKeyword ("things|some words", true); // adds the keyword "things" and the sub keyword "some words"
app.document.keywordsManager.addKeyword ("things|some words", false); // this adds the keyword "things|some words" and ignores the vertical dash

deleteKeyword
app.document.keywordsManager.deleteKeyword ("aaa|bbb", true); // delets the sub keyword "bbb"
app.document.keywordsManager.deleteKeyword ("aaa", true); // delets the keyword "aaa" and all its sub keywords

renameKeyword
app.document.keywordsManager.renameKeyword ("aaa|bbb", "aaa|ccc", true); // rename the sub keyword "bbb" to "ccc"
app.document.keywordsManager.renameKeyword ("aaa", "a11", true); // rename the keyword "aaa" to "a11"

serializeToXML
app.document.keywordsManager.serializeToXML(); // returns the xml of all the keywords structure