Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Get names of actions in some set?

Participant ,
Jan 18, 2019 Jan 18, 2019

How I can get names of all actions in some set?

TOPICS
Scripting
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Jan 19, 2019 Jan 19, 2019

If it is saved, you can get it from preferences.

getAllAction() ;

function getAllAction() {

  var res = [] ;

  var pref = app.preferences ;

  var path = 'plugin/Action/SavedSets/set-' ;

 

  var currentPath, setName, actionCount, actions ;

  for(var i = 1 ; i <= 100 ; i++) {

    currentPath = path + i.toString() + '/' ;

    // get setName

    setName = pref.getStringPreference(currentPath + 'name') ;

    if(!setName) {break ;}

   

    // get actionNames

    actions = [] ;

    actionCount = Number(pref.getInteg

...
Translate
Adobe
Enthusiast ,
Jan 19, 2019 Jan 19, 2019

If it is saved, you can get it from preferences.

getAllAction() ;

function getAllAction() {

  var res = [] ;

  var pref = app.preferences ;

  var path = 'plugin/Action/SavedSets/set-' ;

 

  var currentPath, setName, actionCount, actions ;

  for(var i = 1 ; i <= 100 ; i++) {

    currentPath = path + i.toString() + '/' ;

    // get setName

    setName = pref.getStringPreference(currentPath + 'name') ;

    if(!setName) {break ;}

   

    // get actionNames

    actions = [] ;

    actionCount = Number(pref.getIntegerPreference(currentPath + 'actionCount')) ;

    for(var j = 1 ; j <= actionCount ; j++) {

      actions.push(pref.getStringPreference(currentPath + 'action-' + j.toString() + '/name')) ;

    }

    res.push({name: setName, actions: actions}) ;

  }

 

  return res ;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 19, 2019 Jan 19, 2019

Thank you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 20, 2019 Jan 20, 2019

Sorry.

Doesn't work for me (without futher informations).

Your code only returns:

Ergebnis: [object Object],[object Object],[object Object],[object Object],[object Object]

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 21, 2019 Jan 21, 2019
LATEST

alert(getAllAction()[0].actions.join('\r')) ;

/**

  * get all action of preferences

  * @return {Array} [{name: 'set1', actions: ['action1', 'action2'...]}...]

*/

function getAllAction() {

  var res = [] ;

  var pref = app.preferences ;

  var path = 'plugin/Action/SavedSets/set-' ;

  var currentPath, setName, actionCount, actions ;

  for(var i = 1 ; i <= 100 ; i++) {

    currentPath = path + i.toString() + '/' ;

    // get setName

    setName = pref.getStringPreference(currentPath + 'name') ;

    if(!setName) {break ;}

  

    // get actionNames

    actions = [] ;

    actionCount = Number(pref.getIntegerPreference(currentPath + 'actionCount')) ;

    for(var j = 1 ; j <= actionCount ; j++) {

      actions.push(pref.getStringPreference(currentPath + 'action-' + j.toString() + '/name')) ;

    }

    res.push({name: setName, actions: actions}) ;

  }

  return res ;

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines