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

Get names of actions in some set?

Participant ,
Jan 18, 2019 Jan 18, 2019

Copy link to clipboard

Copied

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

TOPICS
Scripting

Views

851

Translate

Translate

Report

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

Community Expert , 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

...

Votes

Translate

Translate
Adobe
Community Expert ,
Jan 19, 2019 Jan 19, 2019

Copy link to clipboard

Copied

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 ;

}

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Thank you.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Sorry.

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

Your code only returns:

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

Votes

Translate

Translate

Report

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 21, 2019 Jan 21, 2019

Copy link to clipboard

Copied

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 ;

}

Votes

Translate

Translate

Report

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