Is there a way to count and access Action items as array elements and select them randomly.
DoAction(ActionName, ActionSetName) can access actions by name, but that is not good enough.
I would like to create script with something like this completely made-up pseudo-code:
var myAction = app.doc.actions["Standard Set"];
var myStep = myAction[round(myAction.length * Math.random())];
DoAction(myAction, myStep);
PS. If that is not possible, may be random Action from specific set can be done?
Of course I can do the whole thing by correctly naming actions and running below code, but that is funny way to work...
myNumber = GetRandom(1, 12)
doAction(myNumber.toString(),"Random");
function GetRandom(myMin, myMax)
{
myMax = myMax - myMin;
var myNum = Math.random()*myMax;
myNum = Math.round(myNum)+myMin;
return myNum;
}
Random Action Step or Random Action.
-
Mike Hale
Random Action Step or Random Action.
If you do a search here you will find code to get the installed actionSets and actions. That will give you the info you need to run a random action from a set or even random set.
Or better yet, download xtools. It has that code and much, much more.
But you have random action step in the subject line and I haven't seen a way to do that posted anywhere.
Or better yet, download xtools. It has that code and much, much more.
But you have random action step in the subject line and I haven't seen a way to do that posted anywhere.
-
xbytor
Random Action Step or Random Action.
But you have random action step in the subject line and I haven't seen a way to do that posted anywhere.
It can be done but it takes a bit of work. I think Andrew did it way back in the day and it can been done with xtools. Also, you probably mean to randomly execute an active step as opposed to a disabled or stop/comment step.
It can be done but it takes a bit of work. I think Andrew did it way back in the day and it can been done with xtools. Also, you probably mean to randomly execute an active step as opposed to a disabled or stop/comment step.
-
Mike Hale
Random Action Step or Random Action.
Yeah, I guess I wasn't clear. I was thinking of what could be done without reading the atn file itself. It seems to me that executing a random action step wouldn't be a good thing to do as it may depend on the previous steps in the action to have the document in a certain state and throw an error.
Playing a random action would be safer but it also may fail but it can be done without accessing the atn file. I didn't think it would be worth the effort needed to play a single random step.
Playing a random action would be safer but it also may fail but it can be done without accessing the atn file. I didn't think it would be worth the effort needed to play a single random step.