random selection of action script

Hello

I've done 10 things with the brush definitions. I need a script for performing random action (instead of their execution on the Panel shares) if possible. Can someone show me how do or post a final example here?

I have very low knowledge for the script, please be gentle with me.

Thank you for your kindness,

Nick

This version requires that you change the variable based on your name of LayerSet.

#target photoshop;
if(documents.length){
    main();
    }else{
        alert("You need a document open to run this script!");
        }
function main(){
//////////////////////////////////////////////////////////////////////
// Change "Default Actions" to the name of your LayerSet
var ASname = "Default Actions";
/////////////////////////////////////////////////////////////////////
if(!checkActionExists(ASname.toString())) {
    alert("\"" +ASname+ "\"" + " does not exist!\nPlease check your spelling\nIt is case sensitive!")
    return;
    }
var ActionSets =getActionSets();
for(var a in ActionSets){
    if(ActionSets[a].toString() == ASname.toString()){
        var Actions = getActions(ActionSets[a].toString());
        var RA = Actions[Math.floor(Math.random() * Actions.length)];
        try{
        app.doAction(RA.toString(), ASname.toString());
        }catch(e){};
        break;
        }
}
};
function checkActionExists( setName, actionName ){
   var res = false;
   try{
      var ref = new ActionReference();
            if(actionName != undefined){
      ref.putName( charIDToTypeID( 'Actn' ), actionName );
      }
      ref.putName( charIDToTypeID( "ASet" ), setName );
      executeActionGet( ref );
      res = true;
   }catch(e){return false}
   return res;
};
function getActionSets(){
var aSets=[];
var z = 1;
while(true){
var ref = new ActionReference();
ref.putIndex(charIDToTypeID('ASet'), z);
try{
var desc = executeActionGet(ref);
var actName = desc.getString(charIDToTypeID('Nm  '));
aSets.push(actName);
z++;
}catch(e){return aSets;}
    }
};
function getActions(aSet){
var names = [];
var z =1;
while(true){
var ref = new ActionReference();
ref.putIndex(charIDToTypeID('Actn'), z);
ref.putName(charIDToTypeID('ASet'), aSet);
try{
var adesc = executeActionGet(ref);
var actName = adesc.getString(charIDToTypeID('Nm  '));
names.push(actName);
z++;
}catch(e){return names;}
    }
};

Tags: Photoshop

Similar Questions

  • Can a script to randomly select an action within a specific set for use on multiple images?

    Hello.

    I have a file of 200 + similar images (taken in a photo booth).

    I did 8 separate actions within the same series are slightly different textures for an image. Actions are labeled 1, 2, 3... etc.

    I am wanting a way to get all the images to have a (randomly chosen) actions applied to them.

    I'm pretty confident that this was possible with scripts, but have no idea how write a.

    If the images were sequecnially applied to action 1 then 2, then 3 and so on (repeat when 8) this would also agree.

    I am fairly new to scripting so please keep the answers simple if possible.

    Thank you very much.

    Wil Stevens

    Something like that?

    // make variable to hold the name of the action set
    var actionSet = "myActionSet";
    // make variable to hold an array of action names you want to use from that set
    var actionArray = ["Action 1","Action 2","Action 3","Action 4","Action 5","Action 6","Action 7","Action 8"];
    // either hard code the folder path
    // var sourceFolder = new Folder('~/desktop/booth');
    // or prompt for folder
    var sourceFolder = Folder.selectDialog("Select the booth pix folder");
    // if prompting user make sure they didn't cancel the dialog without selecting a folder
    if(sourceFolder != null ) {
        // make variable for processed folder
        var processedFolder = new Folder(sourceFolder+'/processed');
        // make sure it exists
        if(!processedFolder.exists) processedFolder.create();
        // get the files from the folder using a mask to only get certain file extensions
        var files = sourceFolder.getFiles(/\.jpg$/i);// here we are only getting jpeg files with .jpg or .JPG extension
        // now loop through the files and apply random action
        for(var f=0;f		   
  • Action Script to add a node value parent for the top node

    I need to add a new value of the node parent to a hierarchy to the top node.  The script parameters to add a node is "Add | Version | Hierarchy | Node | Parent Node. Property sheet. "  I am at a loss on what to do for the top node because there is no node Parent above this level, but the settings ask him.  I have reviewed the manual and the manual of admin, but did not help.  Can someone help me?

    Thank you!

    You have the answer with you, do not be confused between the Parent node and the top node context, when adding a new node, the node of your Top will become your Parent node.

    ' Add | Version | Hierarchy | Node | Parent Node. Property of the worksheet.

    If you're still confused, just do the following.

    1. right click on the node of your top and add a new worksheet or node branch manually

    2. Once added, go back to the homepage-> Script

    3. Select the Type of Source in the paper transactions, and then select the newly added node and load

    4. in the lower part select Script-> download-> Download Action Script.

    5. open in a Notepad and use to create your new script.

  • Selecting tools via scripts

    Hello personal greetings to all:

    Is it possible to select tools through scripting? I need to add the command a few buttons on a panel of HTML5. I tried to create action items for each of them, but some of them does not shares:

    They are:

    • The tool pen

    • The free pen tool

    • Add Anchor Point tool

    • Delete Anchor Point tool

    --------------------------------------------

    • The marquee tool

    • Elliptical selection tool

    ---------------------------------------------

    • The polygonal Lasso tool

    • The magnetic Lasso tool

    01.png

    I hope that these help...

    /////// Pentool
    var desc = new ActionDescriptor();
    var ref = new ActionReference();
    ref.putClass( app.stringIDToTypeID('penTool') );
    desc.putReference( app.charIDToTypeID('null'), ref );
    executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
    ////////freeform pentool
    var desc = new ActionDescriptor();
    var ref = new ActionReference();
    ref.putClass( app.stringIDToTypeID('freeformPenTool') );
    desc.putReference( app.charIDToTypeID('null'), ref );
    executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
    //////////Add anchor point tool
    var desc = new ActionDescriptor();
    var ref = new ActionReference();
    ref.putClass( app.stringIDToTypeID('addKnotTool') );
    desc.putReference( app.charIDToTypeID('null'), ref );
    executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
    //////////Delete anchor point tool
    var desc = new ActionDescriptor();
    var ref = new ActionReference();
    ref.putClass( app.stringIDToTypeID('deleteKnotTool') );
    desc.putReference( app.charIDToTypeID('null'), ref );
    executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
    //////////rectangular marquee tool
    var desc = new ActionDescriptor();
    var ref = new ActionReference();
    ref.putClass( app.stringIDToTypeID('marqueeRectTool') );
    desc.putReference( app.charIDToTypeID('null'), ref );
    executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
    //////////Elliptical Marquee Tool
    var desc = new ActionDescriptor();
    var ref = new ActionReference();
    ref.putClass( app.stringIDToTypeID('marqueeEllipTool') );
    desc.putReference( app.charIDToTypeID('null'), ref );
    executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
    //////////Polygonal Lasso Tool
    var desc = new ActionDescriptor();
    var ref = new ActionReference();
    ref.putClass( app.stringIDToTypeID('polySelTool') );
    desc.putReference( app.charIDToTypeID('null'), ref );
    executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
    //////////Magnetic Lasso Tool
    var desc = new ActionDescriptor();
    var ref = new ActionReference();
    ref.putClass( app.stringIDToTypeID('magneticLassoTool') );
    desc.putReference( app.charIDToTypeID('null'), ref );
    executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
    
  • Flash action script 3 settings

    How can I change the 3 action script settings? I want to make sure the default scene dimensions are different.

    This isn't really an Actionscript parameter. Open the Properties window for the movie, be sure that it says, 'Document' at the top of the window. In the Properties section, select the icon for key to the right of the dimensions of the stage. Which opens a new window. Here, you can define a new default step size, and then click make default in the lower left corner.

  • Advanced action scripts - y at - it a variable that tells me which button is clicked?

    Lilybiri gave me some great tips on the use of conditional tip action scripts. Now, I have another related question.

    I have three buttons A, B and C. Each button performs exactly the same series of actions to hide everything on the page, but shows another group of objects depending on which button was clicked - that is, to display the Group A and Group B group C.

    Currently, I have a separate advanced action script for each button (in fact a lot more than three) because of this difference, then want to combine in a single conditional script. However, I can't understand how I would like to know which button was clicked.  In other words, I think that my conditional script should look like this:

    The condition "always."

    If 1 is equal to 1

    [Script to hide all]...

    Continue

    Condition 'has '.

    If MyButton is equal to 'A '.

    See the group_A

    On the other

    Continue

    Condition 'B '.

    If MyButton is equal to 'B '.

    See the group_B

    On the other

    Continue

    Condition 'C '.

    If MyButton is equal to 'C '.

    See the group_C

    My problem is that I don't know how to set or get the value of MyButton to perform conditional tests. Is there a system variable that returns the value of a selected object? I looked at all the variables, and I don't see one. Or y at - it another way to do what I'm missing?

    You probably can find with Javascript, but not with advanced actions. All the available system variables that can be used - there are more - are in a table that you can download here: System variables in Captivate 8 - Captivate blog

    I have several articles on the shared use of stocks. You apply the same instance of a common action several times and don't have that to indicate parameters, in your case these parameters will be for most groups and objects. I hope that stocks shared will expand more in the future. They have several advantages: given that you use multiple instances of the same action that they do not increase the file size as duplicate advanced actions. In addition, you have them in the library that makes management much easier.

  • How t o create breadcrumbs in flash 5 action script 2.0 use cs?

    How t o create breadcrumbs in flash 5 action script 2.0 use cs?

    If the user is throungh go some buttons then there's finally breadcrumbs on the last stage (as it is selected 1, 2 or 3 buttons etc...) and then final should display last used button.

    Besically am looking for bread crumbs. Can anyone know how to create breadcrumbs with the help of the movie clip? or any other code?

    Can someone help me?

    Use swfaddress: http://fcontheweb.com/articles/swfaddress_as2/

  • Action script grayed out

    Just trying to make a button. Selection button. Action script of the alternatives all grayed out. All useful ideas.

    Looks like you post on Actionscript 3.  In AS3, all actions must be on the chassis.

    If you want to use the button actions, change the settings of publication in 1/2

  • masking a layer with an action script

    Hi all

    I did some research and it seems that you can't hide a layer using action script. I'll make a page with a lot of form controls to this topic, and when the user clicks on the button submit, I want that all the controls go away so that I can show something else.

    Really, I don't want to have to do control._visible = false for each item. I did see one person saying I could join these fields in form (movieclips) to a parent movieclip and then just do the parents visibl = false. What is the best way to hide a bunch of controls without explicitly defining each movieclip visibility? If so, how to do something the child of an element parent?

    Thank you

    Select the movieclip you placed in the properties panel and gives it an instance name.  Then, whenever you want to deal with something in it, use this instance name...

    yourInstanceName.cbox1.etc...

  • Flash beginner needs help with Movie Clips/Action script

    HI -.

    I'm having a problem with my video clips playing simultaneously and cannot, for the life of me, know what I did wrong. I'm new to flash so I can I have created something wrong but this is what I have so far:

    11 layers, total: 1 layer with 10 buttons, each button with the following actionscript code:


    on (release) {}
    gotoAndPlay (85);
    }


    When the number changes with regard to keyframes, the next film is about.

    I have 10 films, total, but they are only video clips, mainly photo slideshow with audio, does everything in the library.

    The problem occurs when I click on the second or third button. Not only the movie I selected starts to play, but all previous clips are as well, he has completely blurred all the sounds. I don't know what Miss me in action script, as my Action layer has a stop command to this topic at each keyframe where there is a new clip to play.

    I tried to add a stopAllSounds command, but I'm afraid that does nothing because it is not an "audio file" in itself playing in the timeline panel.

    I'm at the end of my rope and really need help to understand this one. My project is hanging in the balance on this point, I wrote everything correctly and it works beautifully.

    Help, please!

    Thank you
    Caroline

    Start your sounds in frame 2 and place stopAllSounds() on each keyframe where begins a movieclip.

  • LinkButton, using action script

    IId

    I am trying to create a button link using action script. Everything is going well except the icon. I don't know how to get it.
    Using mxml I can do simply by selecting the icon property and providing the path of the image.

    var closeText:LinkButton = new LinkButton();
    closeText.label = "close";
    closeText.labelPlacement = 'left ';
    closeText.setStyle("icon","images/close_ena.png");? do not know how to... It does not work...

    [Embed(source="images/close_ena.png")]
    [Bindable]
    public var imgCls: Class;

    var closeText:LinkButton = new LinkButton();
    closeText.label = "close";
    closeText.labelPlacement = 'left ';
    closeText.setStyle ("icon", "imgCls");

  • Restore the options popup after selecting "Non-action" and choose to use this option, whenever a device is plugged in USB?

    Restore the options popup after selecting "Non-action" and choose to use this option, whenever a device is plugged in USB?

    Hello

    Did you follow the "AutoPlay Repair Wizard"?

    You can follow the link provided in the previous post. Later, check to see if the problem persists.

    Hope the helps of information.

  • "Random selection" for "Transitions" in Windows Movie Maker?

    For all that I can tell, Windows Movie Maker doesn't have a 'Random' selection for transitions.  It is this true or am I missing where the selection within the program?

    Hello ugotano,

    Welcome to the Microsoft Answers Forum!

    If you are looking for the option on how to change or add the transition in Movie Maker, here are the steps:

    1. on the table of the storyboard / timeline, click the second of the two video clips, titles or images that you want to add a transition between.
    2. click on tools, then on Transitions.
    3. in the content pane, click the transition that you want to add. You can click Play under the monitor to see a preview of what looks like the transition.
    4. click on the Clip and then click Add to timeline or add to the storyboard table.

    Here is an article you can do references who will give you information on the transitions:

    http://Windows.Microsoft.com/en-us/Windows-Vista/add-transitions-and-effects-to-pictures-and-video-in-Windows-Movie-Maker

    By default, Windows Movie Maker does not include transitions random, pans and zooms.  Adding Pan/zooms and transitions must be picture.
    You can apply the same transition to all the clamps at the same time:
    1. click on the 1st box of transition on the storyboard table (small box between the clips)
    2. do one of the following:
    3 Ctrl + A to select
    4 shift-click on the last transition box to select everything in between
    5 Ctrl-click the transitional areas to add them to the selection one by one.
    6. right click on the desired Transition and select "apply to the Storyboard object.

    I hope this information helps.

    Thank you
    H Irfan, Microsoft Answers Support Engineer.
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • I try to install an air 320u sierra wireless card and I get an error message "could not access vb run time for custom action script. Cannot install the Manager of mobile broadband services.

    could not access vb run time for custom action script

    I try to install an air 320u sierra wireless card and I get an error message "could not access vb run time for custom action script.  Cannot install the Manager of mobile broadband services.  Any ideas?

    Hello

    I suggest you run the fixit and see if it helps:

    http://support.Microsoft.com/mats/Program_Install_and_Uninstall

    Also check out this link:

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-windows_programs/error-2738-could-not-access-VBScript-run-time-for/1a4499ae-8bc1-4534-9c6f-4d399ac70d9a

    It will be useful.

  • After you create the action script for the creation of user Oracle DB - connector DBUM

    Hello

    After we have set up a user of IOM in the database on the target system, you must insert the same user in the RLS_USER_GROUPS table. (INSERT INTO CAMPDB. The VALUES of RLS_USER_GROUPS ('DV < user name >', RLS_DEV');  )

    The requirement is available to the user of multiple databases (different values of SID). But, the user to insert in a table to a database (DB1).

    If I write an after create a file of Action with action script, it will fire for all databases?  How to trigger this script only on the DB1 database?

    (2) in the literature, it is mentioned as below

    (Q) I installed the connector only in IOM (there is no connector server). Thus, in the 3rd and 5th stage, what should I mention

    Key code?

    Decode?

    Please suggest

    Thank you

    This query has worked well.

    INSERT INTO CAMPDB. RLS_USER_GROUPS (USERNAME, GROUPNAME) VALUES ({__NAME__}, "RLS_DEV")

Maybe you are looking for

  • Unexpected Windows Update

    My automatic updates is set to inform and not to download or install. Today, after having been on the Internet for a few hours, I stop my PC and the button turn off was the notice that an update will be installed during shutdown. I restarted my PC, w

  • QuickTime gives error - 2048 when opening for mht files

    When you try to open a .mht file, "error - 2048: could not open the .mht file because it is not a QuickTime file.» This just started happening in the last week.  Any suggestions on how to fix?  I'm not finding anything.

  • Offline Files Option not available in the Folder Options

    I have a Dell Netbook XP Home Edition is installed.  I want to have the ability to have files available online, but the option does not exist when I go into Folder Options. Is this peculaiar for the home edition because the option exists on another l

  • My documents have a red exclamation mark on their icons symbol - it was not there before

    This could be trying to save with MacAfees online backup?  I couldn't complete the download because of an error.

  • Adding physical disk

    The current server configuration:Dell PowerEdge 510 with 12 hard drive on Controller PERC H700 bays.  4 berries are already used for operating system and Application installation.  Configured with RAID 10 I need to install harddisk 8 additional in th