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

Hi there.
I have a folder of 200+ similar images (taken in a photobooth).
I have made 8 seperate actions within the same set that apply slightly different textures to a image. Actions are titled 1, 2, 3 ...etc.
I am wanting a way to get all the images to have one of the actions (randomly selected) applied to them.
I'm pretty confident that this could be achieved with scripting, but have no idea how to write one.
If the images were sequecnially applied to action 1 then 2 then 3 and so on (repeating when back to 8) this would also be suitable.
I am fairly new to scripting so please keep answers simple where possible,
Many thanks.
Wil Stevens

Something like this?
// 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<files.length;f++){
        // open a file in the files array
        var currentDoc = app.open(files[f]);
        // generate a random number between 0 and 7 ( array index is zero based )
        var rand = Math.floor((8)*Math.random());
        // apply a random action to the opened document
        app.doAction(actionArray[rand], actionSet );
        // make variable for the new file path
        var saveFile = new File(processedFolder+'/'+files[f].name);
        // save the file
        SaveAsJPEG( saveFile, 8, true );
        // close the doc
        currentDoc.close(SaveOptions.DONOTSAVECHANGES);
        // done with this file so loop to next
     }// end of loop
    // done with all the files in the files array
    alert('Done');
}// end of if valid folder
// function to save jpeg
function SaveAsJPEG( inFileName, inQuality, inEmbedICC ) {
var jpegOptions = new JPEGSaveOptions();
jpegOptions.quality = inQuality;
jpegOptions.embedColorProfile = inEmbedICC;
app.activeDocument.saveAs( File( inFileName ), jpegOptions );

Similar Messages

  • Open multiple PDFs in Photoshop at specific size for use with Actions

    I am having a bit of a roadblock with batch Automate in Photoshop. I'd like to open multiple PDFs at 630p x 630p, 72 dpi in greyscale. I have 2000 files to do this on. If files are already open, the rest of my action works, does a few things, then saves for web as PNG. It is just the open which is not working. It tries to give all files the same filename. Taking the filename out of the Action is not an option. Scan of msg boards say that this feature stopped working around CS3. Any ideas? Much appreciated.

    Open opens images the same size and resolution they are saved. If you want the images to be a particular size you need to do that in the action.
    If you download my crafting actions package.  You will find the there are over a dozen scripts I wrote to be used with in action.  One is a plugin script that would be particularly helpful to you to do the resize you want to do.  The first three steps would be Step 1 menu File>Automate>AspectRatioSelection....  You would set in a 1 to  1   Aspect ratio. Centered, rectangle. replace, selection and 0 feather. In its dialog.  Those settings will be recorded into the Actions step. Step 2 menu Image Crop. that will make you image square. Step 3 menu File>Automate>Fit Image...  In the Fit image dialog you would set 630 in the width and height fields.  These settings will be recorded into the actions step.    When the action is played no dialog will be displayed. The recorded settings will be used.
    Crafting Actions Package UPDATED Aug 10, 2014 Added Conditional Action steps to Action Palette Tips.
    Contains
    Action Actions Palette Tips.txt
    Action Creation Guidelines.txt
    Action Dealing with Image Size.txt
    Action Enhanced via Scripted Photoshop Functions.txt
    CraftedActions.atn Sample Action set includes an example Watermarking action
    Sample Actions.txt Photoshop CraftedActions set saved as a text file.
    More then a dozen Scripts for use in actions
    Example
    Download

  • I have an external hard drive that was formatted by a PC and has files and directories etc. I want to format it and use it on my IMAC for backup but I can't seem to write to it nor can I delete current content. How do I initialize it for use with the MAC?

    I have an external hard drive that was formatted by a PC and has files and directories copied to it etc. I want to use it on my IMAC for backup. I see it on my my IMAC . I can open files etc.  But I can't seem to write to it nor can I delete current content. I don't care if I lose current content. How do I initialize it for use with the MAC?

    You can't write to it because it's formatted as NTFS which OS X will read but not write to. If you want to continue using the drive with both a PC and OS X you will need to download and install NTFS-3G so you can then write to it from your Mac. You can get NTFS-3G at:
    http://www.macupdate.com/app/mac/24481/ntfs-3g
    If you want to use the drive exclusively with your Mac then move the data off it and reformat it in Disk Utility (Applications - Utilities - Disk Utilities) as Mac OS Extended (Journaled.)

  • How can I add SCOM 2012 Alert Context within a SCOM Alert When using a cusom powershell script in a two state monitor?

    Hello, we have a two state monitor and I would like to channel the Alert Context to Alert Description.
    The powershell script being used to find the stopped services is pasted below:
    $API = new-object -comObject "MOM.ScriptAPI" 
    $bag = $api.CreatePropertyBag()
    $ServiceStatus = Get-WmiObject -class win32_service |where {$_.startmode -eq'Auto'-and $_.State -eq 'Stopped' -and
    $_.name -ne 'wuauserv'}
    if (!$ServiceStatus) #if there are no automatic services that are stopped, we are healthy.
    write-host "good"
    $bag.addvalue("State","good")
    if ($servicestatus) #if there are any automatic services that are stopped, we are unhealthy.
    write-host "bad"
    $bag.addvalue("State","bad")
    foreach ($service in $servicestatus) #enumerate the stopped services
    $bag.addValue("$($Service.Name):","$($Service.state)")
    $bag
    $API.Return($BAG)
    The results of the services that are stopped are being captured in the Alert Context”. How can I pipe the Alert Context to “Alert Description” to obtain a meaningful alert?
    Alert Context data:
    Property Name                              Property Value
    State                                                  
    bad
    clr_optimization_v4.0.30319_32: Stopped
    clr_optimization_v4.0.30319_64: Stopped
    How can I pipe to Alert Description in SCOM 2012?
    Thanks,
    Kapil Dham
    Kapil Dham

    you don't need write-host
    you should create
    $bag.addvalue("ServiceName1","StateOK")
    $bag.addvalue("ServiceName2","StateStopped")
    and in alert description you will see
    ServiceName1  
    StateOK
    ServiceName2  
    StateStopped
    So try $bag.addValue($Service.Name,$Service.state)
    and $Data/Context/Property$

  • How can I partition the remaining space on an external hard drive for use in Time Machine?

    I backed up files from my old macbook to this external drive.  I want to use all remaing space for time machine on my new Air that runs OSX Lion.  Please help

    It is usually recommended that your keep a clone of your HD and your Time Machine backup on different drives.
    You don't want your backup drive to fail and lose both your clone and your TM backup.
    The answer to your question is to use Disk Utility to partition your drive. Again, you should have a backup of your drive before you partition it.
    Launch Disk Utility, select your external drive > Partition > Resize the partition by sliding the tab at the lower right corner of the image > Create a new partition with the space that has been freed up.

  • How can I convert a 0-50mA signal to 0-5 VDC for use by a PCI-6014 DAQ?

    I have a PCI-6014 DAQ card. I am trying to measure the output of a closed-loop current sensor, which has an output of 0-50mA. When I tried using a 100 ohm resistor as a load (to measure across the resistor to get a voltage input for the DAQ) I get an AC voltage reading! I do not know how to convert the AC Voltage to a varying DC voltage. Most AC-DC converters output a fixed DC voltage (3.3V, 12V, 15V, etc.). Can the PCI-6014 measure the current directly OR is there a method to measure the VARYING 0-5 volt AC voltage? Please be specific, if possible. Thanks in advance!

    Hello,
    PCI-6014 can measure an AC voltage directly. The Test Panels in MAX will show the peak voltage level of a signal, and not the root mean square (RMS) voltage. For example, if you measure the 120 VAC 60 Hz sinusoidal waveform that is available from a standard North American wall outlet, you will see a wave with a peak of about 170 V.
    The conversion between VRMS and Vo is VRMS = Vo/√2.
    You will need to determine whether you expect your AC signal to be in units RMS or peak-voltage and make the conversion, if necessary, using the formula above.
    -Arun V

  • Using nsMail email server, works fine in ns email tool, as of yesterday TBird 31.3.0 can not send or receive email. Have verified all setting for IMAP/SMTP OK.

    Will not retrieve incoming emails. When I try to send one, error message appears: "Sending of message failed.
    The message could not be sent using SMTP server smtp.ullisart.com for an unknown reason. Please verify that your SMTP server settings are correct and try again, or contact your network administrator." I have checked all IMAP/SMTP settings and they are fine. I can receive and send emails to the same address via the email server provider's email tool. Using nsMail, WIndows8, Firefox, latest version of TBird. All worked fine two days OK and have made no known changes to computer installation since.

    ExchangeITPro,
    Thank you for your reply.
    >what SP are you at?
    As noted in the first paragraph: "We have an Exchange 2010 server, running under Windows 2008R2. Both
    the server and Exchange are current for Windows and Exchange updates. Exchange is on SP3 installed about a month ago with no errors reported in the event logs."
    >try restarting the transport services.
    Done previously as well as the entire server. No change.

  • Select nested WMS layers with specific SRS value using XQuery

    A WMS getcapabilities document contains a nested list of Layers. I need to get a list of layers for which is true: - It is queryable and - It has an SRS value of EPSG:28992 or any of it's parent layers (or parents parents etc) has an SRS value of EPSG:28992.
    I came up with this query which I'm not very happy with because it only allows for three nested Layers.
    select t.*
            from xmltable(xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
                          ,'for $d in /WMT_MS_Capabilities/Capability/Layer[SRS="EPSG:28992"]
                            where $d/@queryable="1"  return $d'
                          passing p_xml columns name varchar2(100) path 'Name'
                          ,title varchar2(100) path 'Title'
                          ,url varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                          ,style xmltype path 'Style') as t
          union all
                select t.*
                     from xmltable(xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
                                ,'for $d in /WMT_MS_Capabilities/Capability/Layer/Layer
                                  where $d/@queryable="1"
                                    and (/WMT_MS_Capabilities/Capability/Layer/SRS="EPSG:28992"
                                         or /WMT_MS_Capabilities/Capability/Layer/Layer/SRS="EPSG:28992") return $d'
                                passing p_xml columns name varchar2(100) path 'Name'
                                ,title varchar2(100) path 'Title'
                                ,url varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                                ,style xmltype path 'Style') as t
          union all
                   select t.*
                      from xmltable(xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
                                ,'for $d in /WMT_MS_Capabilities/Capability/Layer/Layer/Layer
                                  where $d/@queryable="1"
                                    and (/WMT_MS_Capabilities/Capability/Layer/SRS="EPSG:28992"
                                         or /WMT_MS_Capabilities/Capability/Layer/Layer/SRS="EPSG:28992"
                                         or /WMT_MS_Capabilities/Capability/Layer/Layer/Layer/SRS="EPSG:28992") return $d'
                                passing p_xml columns name varchar2(100) path 'Name'
                                ,title varchar2(100) path 'Title'
                                ,url varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                                ,style xmltype path 'Style') as t;I'm wondering if there is a better approach using Oracle 10.2.05.

    A couple of options (both quite slow unfortunately) :
    XQuery recursive function :
    select x.*
    from tmp_xml t
       , xmltable(
           xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
         , 'declare function local:getLayer($e as element(Layer)*) as element(Layer)*
              for $i in $e
              where $i/SRS = "EPSG:4269"
              return $e[@queryable="1"] | local:getLayer($i/Layer)
            local:getLayer( /WMT_MS_Capabilities/Capability/Layer[SRS="EPSG:4269"] )'
           passing t.object_value
           columns name  varchar2(100)  path 'Name'
                 , title varchar2(100)  path 'Title'
                 , url   varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                 , style xmltype        path 'Style'
         ) x
    Ancestor axis :
    select x.*
    from tmp_xml t
       , xmltable(
           xmlnamespaces('http://www.w3.org/1999/xlink' as "xlink")
         , 'for $i in /WMT_MS_Capabilities/Capability/descendant::Layer
            where $i/@queryable = "1"
            and exists($i/ancestor-or-self::Layer[SRS="EPSG:4269"])
            return $i'
           passing t.object_value
           columns name  varchar2(100)  path 'Name'
                 , title varchar2(100)  path 'Title'
                 , url   varchar2(4000) path 'Style[1]/LegendURL/OnlineResource/@xlink:href'
                 , style xmltype        path 'Style'
         ) x
    ;Tested on a modified version of this document (stored in an XMLType table) :
    http://wms.ess-ws.nrcan.gc.ca/wms/toporama_en?VERSION=1.1.1&request=GetCapabilities&service=wms

  • How can I hide the menu bar of better a specific option without using an addon?

    For security purpose on my environment, I would like to hide the Menu Bar option or (better) restrict the right to install an add-on, change the proxy configuration etc..
    I dont want to use an add-on for that as it will perhaps not work anymore if I update my firefox.
    So i am searching for a registry/file user preference solution or anything else that will let me doing that.
    Thank you for your help
    == This happened ==
    Every time Firefox opened
    == everytime ==
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; MS-RTC LM 8; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

    You can hide the menu bar and other toolbars with code in [http://kb.mozillazine.org/UserChrome.css userChrome.css] below the @namespace line.
    See http://kb.mozillazine.org/Editing_configuration#How_to_edit_configuration_files
    <pre><nowiki>@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    #toolbar-menubar {display:none!important;}</nowiki></pre>
    See also http://kb.mozillazine.org/Locking_preferences

  • Can i place my profile in dropbox for use by multiple macs (1 at a time)?

    I want to use Thunderbird as my mail application on my desktop Mac and my Macbook Air. If I put my profile in dropbox, will this sync the profiles between the two computers? Is there a better way? I want to have all my mail with me, when I use Thunderbird on my MBA, while traveling. Thanks, in advance, for any suggestions.

    Yes, but&hellip;
    You'll be copying huge files up and down between Dropbox and your computers. Email is stored by concatenating many messages into a single file, so a small change to that file, such as the addition of one small message, results in the whole file needing to be up/downloaded.
    I use IMAP and Local Folders to handle this. If I'm travelling and can get online, IMAP lets me see my online message store. If I know that I won't have internet connectivity, there is a reasonably up-to-date copy of my correspondence in my Local Folders. I use other tools (gContactSync, caldav) to keep Address Books and calendars in sync.
    What happens if you can't get online to access dropbox?

  • I have an iPhone 4 and have upgraded to iOS 6.  Based on posts regarding battery life after this update, I want my setting for "Use Cellular Data for" iCloud Documents to remain off.  However, it keeps turning back on...can I avoid this?

    I also wanted to note that this setting goes back to On even if I have not turned off the phone...but it also does this when the phone is turned off and then back on.

    I am seeing the exact same thing on iOS 6.0.1 on my iPhone 4 and iPhone 4S.
    Steps to reproduce:
    In Settings:General:Celluar, check to be sure the following is off:
    iCloud Documents
    iTunes
    Passbook Updates
    Reading List
    Check back to the same screen after 5 minutes (while not on Wifi) and iCloud Documents is back on.
    It's burning through data like mad.
    I know I could kill iCloud on my devices or turn off Cellular data, but neither is a solution.
    Apple, are you aware of this? I think most people assume that users just don't know how to turn this off. That's not the case, it's coming back on by itself.

  • How can I view and convert .264 files from my security cameras for use on my Mac and the web?

    My security cams record in a .264 file format HD.  I want to view, edit, etc on my Mac, what software will do that and are there any easy tips to do this?  I'm new to Mac's so I'm not sure what is the best format to convert to?  mp4?  Suggestions?
    Thanks in advance.  I do love the Mac so far.

    I have downloaded the trail....and it won't recognize my .264 files....not sure what the deal is?  Here is a screen shot-they files are "grayed" out....and won't highlight.  Do you see anything wrong?  I'm pulling the files off of a Lorex DVR security system.  LHD200

  • How can I see the selected tags in the tag bar clearly

    How can I see the selected tags in the tag bar clearly (they used to be in black, now they do not change color; a highlight or Bold would help)

    The History menu lets you revisit the page where you can drag any page element from it.
    How would you sort through thousands (tens of thousands) of files found in a cache?

  • Interaction ID is used in multiple projects / can´t overwrite Interaction ID

    Hi folks,
    I have several projects in Captivate. No I tried to customize the Interaction ID in one of my newest projects. The quizes consist of 20 questions each.
    I have to face following issues:
    - When I open up quiz A and change question 16 from Interaction ID 40408 to ISDXR16_ it changes that value in quiz B for question 1 to the same value.
    - If I try to change Interaction ID 40408 to ISDXR16 (without underscore) it does not change (it seems, that Captivate blocks that special ID).
    Who can help? Thanks in advance.
    Captivate 7.01
    Windows

    User.lib as mentioned by the others is the way to go if you have no issues reagarding sharing the contents of user.lib across multiple machines. The complications I have seen with this is that if I move an application to my customer's machine and some of the VI's were stored in user.lib the application will not find them unless I thought ahead and pulled out the parts the app needs. I also do not want to give away my entire re-use library everytime I include one of the containded functions.
    If you just want to pull out elements from your collection then templates can be of some use.
    If you need to selectively pull out parts of your archieve for use when required, then a "Tree.VI" can help. A Tree.VI is a VI that contains all of the top level and dynamixally loaded VI's used by the function to operate correctly. By opening the Tree.VI and doing a "Save with options"... single prompt preserve hiarchy... the requred VI's are copied to the new location and saved with the relative paths adjusted to point at the new location. This takes care of the cross linking issues.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Can't download iTunes, error message "Key not valild for use in specified state"

    I can't download iTunes, keep getting error message "Key not valid for use in specified state"  I uninstalled and tried reinstalling but same issue.

    For "Key not valid for use in specified state" errors try moving the folder RSA from C:\Users\<User>\AppData\Roaming\Microsoft\Crypto\RSA to say C:\<User>\RSA (just in case there should be a need to restore it) then try installing again. This folder appears to act as a cache and should be rebuilt automatically as required.
    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down the page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    tt2

Maybe you are looking for

  • How to emulate CSS fixed position in Flex 3

    Does anyone know how to emulate CSS fixed positioning in Flex 3? Canvas (absolute layout) uses coordinates same as HTML/CSS absolute positioning. How do I achieve fixed positioning where the panel is taken out of the flow and positioned relative to t

  • Mail not showing up on my iPad?

    I am setting my old iPad up for my mother. I added her two email accounts with accurate id's and passwords. But when I go to the mail icon, no mail shows up in her mailboxes. I checked from my desktop and there is mail in her inbox. I went to through

  • .swf files

    I am trying use flash buttons from Dreamweaver but when I insert them they are not showing up up in my web page. I am using both safari and firefox to preview the page and it still doesnt show up. If I use an .swf file however that shows up in my pag

  • I would like to make a directory using groups from my address book.

    How do you merge information from contacts in the address book with a document?

  • Issues with "Verify Disk" in Disk Utility under Mavericks

    When I run the verify disk option in the disk utility I get different functions listed each time I run and sometimes it does not run to completion;  however, when it runs to completion it states that everything is okay. I did not have this issue befo