Skip to main content
Inspiring
January 18, 2019
Answered

Get names of actions in some set?

  • January 18, 2019
  • 1 reply
  • 1165 views

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

This topic has been closed for replies.
Correct answer sttk3

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 ;

}

1 reply

sttk3Correct answer
Legend
January 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 ;

}

Inspiring
January 19, 2019

Thank you.