Help with first Adobe Script for AE?

Hey,
I'm trying to create a script that will allow me to set a certain number of layer markers at an even interval to mark out a song. Could someone help me troubleshoot this script? I've been working on it for ages now, and I'm about to snap. I've basically gone from HTML and CSS, to javascript and Adobe scripting in the past few hours, and I cannot figure this out for the life of me.
I want to create a dialog with two fields, the number of markers to place, and the tempo of the song. Tempo is pretty simple, its just the number of beats per minute. The script is meant to start at a marker that I have already placed, and set a new marker at incrementing times. Its mainly to help me see what I'm trying to animate too, even if the beat is a little hard to pick up every once in a while.
Also, is there a better way to do this? This script will help me in the long run because I will need to do this pretty often, but I'm wondering if there was something that I could not find online that would have saved me these hours of brain-jumbling?
Thank you very much for any help you can offer.
    // Neo_Add_MultiMarkers.jsx
    //jasondrey13
    //2009-10-26
    //Adds multiple markers to the selected layer.
    // This script prompts for a certain number of layer markers to add to the selected audio layer,
    //and an optional "frames between" to set the number of frames that should be skipped before placing the next marker
    // It presents a UI with two text entry areas: a Markers box for the
    // number of markers to add and a Frames Between box for the number of frames to space between added markers.
    // When the user clicks the Add Markers button,
    // A button labeled "?" provides a brief explanation.
    function Neo_Add_MultiMarkers(thisObj)
        // set vars
        var scriptName = "Neoarx: Add Multiple Markers";
        var numberOfMarkers = "0";
        var tempo = "0";
        // This function is called when the Find All button is clicked.
        // It changes which layers are selected by deselecting layers that are not text layers
        // or do not contain the Find Text string. Only text layers containing the Find Text string
        // will remain selected.
        function onAddMarkers()
            // Start an undo group.  By using this with an endUndoGroup(), you
            // allow users to undo the whole script with one undo operation.
            app.beginUndoGroup("Add Multiple Markers");
            // Get the active composition.
            var activeItem = app.project.activeItem;
            if (activeItem != null && (activeItem instanceof CompItem)){
                // Check each selected layer in the active composition.
                var activeComp = activeItem;
                var layers = activeComp.selectedLayers;
                var markers = layers.property("marker");
                //parse ints
                numberOfMarkers = parseInt (numberOfMarkers);
                tempo = parseInt (tempo);
                // Show a message and return if there is no value specified in the Markers box.
                if (numberOfMarkers < 1 || tempo < 1) {
                alert("Each box can take only positive values over 1. The selection was not changed.", scriptName);
                return;
                if (markers.numKeys < 1)
                alert('Please set a marker where you would like me to begin.');
                return;
                var beginTime = markers.keyTime( 1 );
                var count = 1;
                var currentTime = beginTime;
                var addPer = tempo/60;
                while(numberOfMarkers < count)
                markers.setValueAtTime(currentTime, MarkerValue(count));
                currentTime = currentTime + addPer;
                if (count==numberOfMarkers) {
                    alert('finished!');
                    return;
                else{
                    count++;
            app.endUndoGroup();
    // Called when the Markers Text string is edited
        function onMarkersStringChanged()
            numberOfMarkers = this.text;
        // Called when the Frames Text string is edited
        function onFramesStringChanged()
            tempo = this.text;
        // Called when the "?" button is clicked
        function onShowHelp()
            alert(scriptName + ":\n" +
            "This script displays a palette with controls for adding a given number of markers starting at a pre-placed marker, each separated by an amount of time determined from the inputted Beats Per Minute (Tempo).\n" +
            "It is designed to mark out the even beat of a song for easier editing.\n" +
            "\n" +
            "Type the number of Markers you would like to add to the currently selected layer. Type the tempo of your song (beats per minute).\n" +           
            "\n" +
            "Note: This version of the script requires After Effects CS3 or later. It can be used as a dockable panel by placing the script in a ScriptUI Panels subfolder of the Scripts folder, and then choosing this script from the Window menu.\n", scriptName);
        // main:
        if (parseFloat(app.version) < 8)
            alert("This script requires After Effects CS3 or later.", scriptName);
            return;
        else
            // Create and show a floating palette
            var my_palette = (thisObj instanceof Panel) ? thisObj : new Window("palette", scriptName, undefined, {resizeable:true});
            if (my_palette != null)
                var res =
                "group { \
                    orientation:'column', alignment:['fill','fill'], alignChildren:['left','top'], spacing:5, margins:[0,0,0,0], \
                    markersRow: Group { \
                        alignment:['fill','top'], \
                        markersStr: StaticText { text:'Markers:', alignment:['left','center'] }, \
                        markersEditText: EditText { text:'0', characters:10, alignment:['fill','center'] }, \
                    FramesRow: Group { \
                        alignment:['fill','top'], \
                        FramesStr: StaticText { text:'Tempo:', alignment:['left','center'] }, \
                        FramesEditText: EditText { text:'140', characters:10, alignment:['fill','center'] }, \
                    cmds: Group { \
                        alignment:['fill','top'], \
                        addMarkersButton: Button { text:'Add Markers', alignment:['fill','center'] }, \
                        helpButton: Button { text:'?', alignment:['right','center'], preferredSize:[25,20] }, \
                my_palette.margins = [10,10,10,10];
                my_palette.grp = my_palette.add(res);
                // Workaround to ensure the editext text color is black, even at darker UI brightness levels
                var winGfx = my_palette.graphics;
                var darkColorBrush = winGfx.newPen(winGfx.BrushType.SOLID_COLOR, [0,0,0], 1);
                my_palette.grp.markersRow.markersEditText.graphics.foregroundColor = darkColorBrush;
                my_palette.grp.FramesRow.FramesEditText.graphics.foregroundColor = darkColorBrush;
                my_palette.grp.markersRow.markersStr.preferredSize.width = my_palette.grp.FramesRow.FramesStr.preferredSize.width;
                my_palette.grp.markersRow.markersEditText.onChange = my_palette.grp.markersRow.markersEditText.onChanging = onMarkersStringChanged;
                my_palette.grp.FramesRow.FramesEditText.onChange = my_palette.grp.FramesRow.FramesEditText.onChanging = onFramesStringChanged;
                my_palette.grp.cmds.addMarkersButton.onClick    = onAddMarkers;
                my_palette.grp.cmds.helpButton.onClick    = onShowHelp;
                my_palette.layout.layout(true);
                my_palette.layout.resize();
                my_palette.onResizing = my_palette.onResize = function () {this.layout.resize();}
                if (my_palette instanceof Window) {
                    my_palette.center();
                    my_palette.show();
                } else {
                    my_palette.layout.layout(true);
            else {
                alert("Could not open the user interface.", scriptName);
    Neo_Add_MultiMarkers(this);

You should ask such questions over at AEnhancers. I had a quick look at your code but could not find anything obvious, so it may relate to where and when you execute certain functions and how they are nested, I just don't have the time to do a deeper study.
Mylenium

Similar Messages

  • [solved]Need help with a bash script for MOC conky artwork.

    I need some help with a bash script for displaying artwork from MOC.
    Music folders have a file called 'front.jpg' in them, so I need to pull the current directory from MOCP and then display the 'front.jpg' file in conky.
    mocp -Q %file
    gives me the current file playing, but I need the directory (perhaps some way to use only everything after the last  '/'?)
    A point in the right direction would be appreciated.
    thanks, d
    Last edited by dgz (2013-08-29 21:24:28)

    Xyne wrote:
    You should also quote the variables and output in double quotes to make the code robust, e.g.
    filename="$(mocp -Q %file)"
    dirname="${filename%/*}"
    cp "$dirname"/front.jpg ~/backup/art.jpg
    Without the quotes, whitespace will break the code. Even if you don't expect whitespace in any of the paths, it's still good coding practice to include the quotes imo.
    thanks for the tip.
    here it is, anyhow:
    #!/bin/bash
    filename=$(mocp -Q %file)
    dirname=${filename%/*}
    cp ${dirname}/front.jpg ~/backup/art.jpg
    then in conky:
    $alignr${execi 30 ~/bin/artc}${image ~/backup/art.jpg -s 100x100 -p -3,60}
    thanks for the help.
    Last edited by dgz (2013-08-29 21:26:32)

  • Help with a startup script for monitorix

    How can I deal with a perl script that doesn't acknowledge a query for pidof?
    $ ps aux | grep monitorix
    root 1089 0.0 1.2 16280 6556 ? Ss 09:54 0:00 /usr/bin/monitorix -c /etc/monitorix.conf
    So it's running... but I can't find it with pidof:
    $ pidof /usr/bin/monitorix
    Here is the /etc/rc.d/monitorix I've been using but that doesn't stop the program (since it has no PID).
    #!/bin/bash
    . /etc/rc.conf
    . /etc/rc.d/functions
    PID=`pidof -o %PPID /usr/bin/monitorix`
    MARGS="-c /etc/monitorix.conf"
    case "$1" in
    start)
    stat_busy "Starting Monitorix"
    if [ -z "$PID" ]; then
    /usr/bin/monitorix $MARGS
    fi
    if [ ! -z "$PID" -o $? -gt 0 ]; then
    stat_fail
    else
    PID=`pidof -o %PPID /usr/bin/monitorix`
    echo $PID > /var/run/monitorix.pid
    add_daemon monitorix
    stat_done
    fi
    stop)
    stat_busy "Stopping Monitorix"
    [ ! -z "$PID" ] && kill $PID &> /dev/null
    if [ $? -gt 0 ]; then
    stat_fail
    else
    rm_daemon monitorix
    else
    rm_daemon monitorix
    stat_done
    fi
    restart)
    $0 stop
    sleep 1
    $0 start
    echo "usage: $0 {start|stop|restart}"
    esac

    According to the man page, the -p flag will let you generate a PID file.
    You have a few logical errors in your rc.d script and a syntax error (double else in stop). I've been using a template similar to the below in cleaning up a few of the packages I maintain...
    #!/bin/bash
    . /etc/rc.conf
    . /etc/rc.d/functions
    pidfile=/run/monitorix.pid
    if [[ -r $pidfile ]]; then
    read -r PID < "$pidfile"
    if [[ ! -d /proc/$PID ]]; then
    # stale pidfile
    unset PID
    rm -f "$pidfile"
    fi
    fi
    args=(-c /etc/monitorix.conf -p "$pidfile")
    case "$1" in
    start)
    stat_busy "Starting Monitorix"
    if [[ -z $PID ]] && /usr/bin/monitorix "${args[@]}"; then
    add_daemon monitorix
    stat_done
    else
    stat_fail
    exit 1
    fi
    stop)
    stat_busy "Stopping Monitorix"
    if [[ $PID ]] && kill $PID &> /dev/null; then
    rm_daemon monitorix
    stat_done
    else
    stat_fail
    exit 1
    fi
    restart)
    $0 stop
    sleep 1
    $0 start
    echo "usage: $0 {start|stop|restart}"
    esac
    please also fix the PKGBUILD:
    install=('readme.install')
    This is not valid, and pacman 4 will not let you declare install as an array.
    Last edited by falconindy (2011-09-25 15:05:02)

  • Help with a shell script for schroot

    Since I replaced dchroot with schroot I have a problem.
    In /usr/bin I have a script run32.sh to run 32 bit applications, and symbolic links like acroread32 pointing to run32.sh, firefox32 pointing to run32.sh etc.
    Here is the run32.sh I had before
    #!/bin/bash
    cmd=`basename $0 | sed -n s/32//p`
    for (( i=1; $i<=$#; i=$i+1 )); do
    esc[$i]=$(sed -e 's#\([^[:alnum:]]\)#\\\1#g' <<<${!i})
    done
    exec schroot -p "$cmd" "${esc[@]}"
    The for loop is a trick I stole from the web for escaping some characters.
    But this is not working anymore with schroot.
    So I modified run32.sh like this:
    #!/bin/bash
    cmd=`basename $0 | sed -n s/32//p`
    ct=0
    arg=\"
    for i in "$@"
    do
    ct=$(($ct+1))
    if [ $ct -eq 1 ]
    then
    arg="$arg$i"
    else
    arg="$arg $i"
    fi
    done
    arg=$arg\"
    echo exec schroot -p $cmd $arg
    exec schroot -p $cmd $arg
    Notice that at the end I echo the exec command and then I execute it.
    It works fine for simple arguments, like
    acroread32 foo.pdf
    but not for composite arguments like
    acroread32 foo boo.pdf
    or
    acroread32 foo\ boo.pdf
    (this last one is when I use the tab key to complete the name of the file).
    The thing that I really don't understand is that, typing
    acroread32 foo boo.pdf
    the echoed command is
    exec schroot -p acroread "foo boo.pdf"
    and I get an error
    I: [Arch32-8398824e-10d9-4adf-a299-10c09116e262 chroot] Running command: "acroread foo boo.pdf"
    but then, if i type directly to the command line
    exec schroot -p acroread "foo boo.pdf"
    it opens the file!
    Has somebody a solution to deal both with files like "foo.pdf" and "foo boo.pdf"?

    jacko wrote:Is there any reason your choosing to use acroread over some other form of pdf viewer via a chroot?
    Usually I use kpdf but for some particular features acroread is better. But it's not the point, acroread is just an example. You can do another example with firefox 32 bit, that I use for flash and jre, and mplayer 32 bit, that I use for some win32 codecs.

  • Need help with a activation code for Adobe Acrobat X Standard for my PC,, Don't have older version serial numbers,  threw programs away,  only have Adobe Acrobat X Standard,  need a code to unlock program?

    Need help with a activation code for Adobe Acrobat X Standard for my PC, Don't have older Version of Adobe Acrobat 9, 8 or 7. 

    You don't need to install the older version, you only need the serial number from your original purchase. If you don't have them to hand, did you register? If so, they should be in your Adobe account. If not you really need to contact Adobe, though it isn't clear they will be able to do anything without some proof of purchase etc.

  • Help with opening Adobe Reader and downloading updates

    I can not open Adobe .pdf files any longer (this started yesterday, prior to that I could open adobe files).
    When I double click a .pdf file I get this notice on my screen: Windows cannot access the specified device path or file. You may not have the appropriate permission to access file.
    So I went to the Adobe download site to download a new copy of Adobe.  When I start the download I get this on the screen:  The instruction at "0x0e3a0068" referenced memory at "0x0e3a0068."  The memory could not be written.  Then two options are listed: click OK to terminate or cancel to debug.  So I click on cancel and I get this on my screen: Internet Explorer has closed this webpage to help protect your computer.   A malfunctioning or malicious addon has caused I.E. to close this webpage.
    I don't have AVG running, I do have avast but I've disabled it.  I ran Registry Mechanic and an I.E. erasure program but nothing helps.
    I have gone into I.E. and reduced the security level to its lowest state but no joy.
    So, any ideas or suggestions on what's the problem and how to overcome it would be appreciated.  Thanks, in advance, for your reply.  Jim R.

    Hi Mike..tried that as well but no joy.  A friend of mine was looking at it all and noticed that it was an I.E. thing as far as not letting me redownload the reader so I went to Mozilla Firefox and I could download a new version but....whenever I attempt to open a .pdf file I get that message, "Windows can not open the specified device, path or file. You man not have the appropriate permissions to access the item." 
    Damn...this is irritating as I need to get to some of thos files as I need them for a Journal I'm working on as editor-in-chief. 
    It all worked just fine last Saturday but starting Monday when I was on my flight out to D.C.  no joy. 
    Sigh...Jim R.
    Jim R.
    Date: Tue, 1 Dec 2009 14:50:27 -0700
    From: [email protected]
    To: [email protected]
    Subject: Help with opening Adobe Reader and downloading updates
    Under the help menu, there is an option to repair the installation of reader. Did you try that?
    >

  • I need help in Downloading Adobe Elements for my Mac & Adobe Acrobat for my laptop...I have been battling for the last day.

    I need help in Downloading Adobe Elements for my Mac & Adobe Acrobat for my laptop...I have been battling for the last day.

    ~graffiti wrote:
    PjonesCET wrote:
    I know if you attempt to download and exe file to Mac from a Mac Partition you'll get something like. Cannot not understand file format octet-stream. This means it does not recognize MS execute files.
    Not necesarily. I've done it a few times.
    PjonesCET wrote:
    I'm not sure you can download a PC copy of Acrobat 9 unless you operating from bootcamp or other such application and running the PC partition.
    Yes. You can.
    I've learned something. New. This must be recently changed. That last time I clicked on a Link I though was a dmg file and turned out it was and exe file my Macs wouldn't allow me to do so. But haven't tried recently everytime and exe file comes up I cancel. I gues I am used to the time everytime a Virus or some other nasty was downloaded it was packaged in and exe file and Macs owuldn't allow it. I suppose with the INtel guts now they can no longer refuse to download.

  • Help writing first Java Script

    HELP!! I am writing my first Java Script for a class but cannot figure out what I am doing wrong. I have created a from and need to write a script to verify that all form entries are filled before allowing the data to submit. Can some one please look at my code below and tell me what I am doing wrong!! Thank you
    <HTML>
    <HEAD>
    <TITLE>Project 8 IT 117 Section 01 6/13/2003</TITLE>
    </HEAD>
    <BODY BGCOLOR="#007FFF">
    <FONT FACE="Arial">
    <STRONG><UL>
    <LI>Search our stock
    </UL>
    <UL>
    <LI>Place an order
    </UL>
    <UL>
    <LI>Out-of-print searches
    </UL>
    <UL>
    <LI>Events calendar
    </UL></STRONG>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function submit() {
         alert("Information submitted!")
    function verify() {
         if document.info.elements[0].value=="" ||
         document.info.elements[1].value=="" ||
         document.info.elements[2].value=="" ||
         document.info.elements[3].value=="" ||
         document.info.elements[4].value=="" ||
         document.info.elements[5].value=="" ||
         document.info.elements[6].value=="" {
              alert("Please complete each field")
         }     else {
              submit()
    //-->
    </SCRIPT>
    <H2>Sign up for our mailing list.</H2>
    <FORM NAME="info">
    <STRONG>First Name:<INPUT TYPE="TEXT" SIZE="20" NAME="FIRSTNAME">
    Last Name:<INPUT TYPE="TEXT" SIZE="20" NAME="LASTNAME"><BR>
    Street Address:<INPUT TYPE="TEXT" SIZE="50" NAME="ADDRESS"><BR>
    City:<INPUT TYPE="TEXT" SIZE="20" NAME="CITY">
    State:<INPUT TYPE="TEXT" SIZE="6" NAME="STATE">
    Zip Code:<INPUT TYPE="TEXT" SIZE="15" NAME="ZIPCODE"><BR>
    E-Mail:<INPUT TYPE="TEXT" SIZE="50" NAME="E-MAIL">
    <BR>Click here to submit this information. <INPUT TYPE="BUTTON" VALUE="Send now!" onClick="SUBMITTED()"></STRONG>
    </FORM>
    </FONT>
    </BODY>
    </HTML>

    Just a thought, but shouldn't you be calling "verify()" instead of "SUBMITTED()" in your onClick handler? And warnerja is right, javascript is not really java.

  • I think I need help with driver (software) settings for D110a

    I think I need help with driver (software) settings for D110a all-in-one
    Product: D110a all-in-one
    OS: Windows XP Professional
    Error messages: None
    Changes before problem appeared: None--new installation
    The quality of photo images (mostly JPG files) in printouts is awful even though the files display beautifully on the PC screen. I am using
    IrfanView software for displaying/printing. As far as I can tell, IrfanView is not the problem.
    When I print the same images on a Deskjet 5150 attached to a different PC also running XP Pro and IrfanView, the quality of the printouts is at
    least acceptable, Some would probably say good or very good.
    It's dificult to explain in words the problem with the printouts. A picture of really pretty vegetables (squashes, tomatoes, watermelon, etc) comes
    out much too red. Moreover, the red, which appears shaded on the screen, seems to be all one shade in the D110a printouts.
    Something similar happens to a view of a huge tree in full leaf. On screen, there are subtle variations in the "greenness" of the leaves. In the
    printout, all green is the same shade. In the same printout, the trunk of the tree is all a single shade of grey. It isn;t even obvious that the
    trunk is a round, solid object.
    I liken the effect to audio that disappears entirely when you lower the volume and gets clipped into square waves in even moderately loud passages.
    I don't know whether the D110a driver software permits adjusting the parameters that appear to be set incorrectly, and if adjustments are possible,
    how I would identify which parameters to adjust, how I would access them, or how I would adjust them. I'm hoping that someone can help. Thanks.
    I forgot to mention that I have used the diagnostic application and it tells me that there are no problems.
    e-mail me at [email protected]

    brazzmonkey wrote:
    Hi everyone,
    I noticed the following message when network starts on my gateway
    Warning: This functionality is deprecated.
    Please refer to /etc/rc.conf on how to define a single wired
    connection, or use a utility such as netcfg.
    Then I realized the way network settings should be written in rc.conf has changed. But I can't figure out how this should be done.
    Currently, my set up is the following (old way):
    INTERFACES=(eth0 eth1)
    eth0="dhcp"
    eth1="eth1 192.168.0.10 netmask 255.255.255.0 broadcast 192.168.0.255"
    ROUTES=(!gateway)
    eth0 is on DHCP because the IP is dynamically assigned my ISP.
    eth1 has a fix IP because it's on the LAN side.
    No problem to use DHCP on eth0 with the new settings.
    But for eth1, I don't know what I am supposed to write for gateway.
    Wiki isn't clear on that one either, and it looks like many articles still refer to the old way.
    Any guidance appreciated, thanks.
    brazzmonkey,
    you can't define 2 interfaces the old way (even though I saw some tricky workaround somewhere in the forums).
    Use, f.e., netcfg:
    Comment your old lines.
    In /etc/rc.conf insert:
    NETWORKS=(Eth0-dhcp Eth1-static)
    DAEMONS=(..... !network @net-profiles ....)
    In /etc/network.d create 2 files:
    First one is named  Eth0-dhcp.
    Contents:
    CONNECTION="ethernet"
    DESCRIPTION="Whatever text"
    INTERFACE=eth0
    HOSTNAME="your hostname"
    IP="dhcp"
    DHCP_TIMEOUT=15
    Second one is named Eth1-static.
    Contents:
    CONNECTION='ethernet'
    DESCRIPTION='whatver'
    INTERFACE='eth1'
    HOSTNAME='hname'
    IP='static'
    ADDR='192.168.0.10'
    GATEWAY='192.168.0.1' # your gateway IP
    DNS=('192.168.0.1') # your DNS server
    The names Eth0-dhcp and Eth1-static are not magic. They just must be the same in rc.conf and in /etc/network.d.
    Hope it helps.
    mektub
    PS: netcfg must be installed.
    Last edited by Mektub (2011-07-20 14:07:05)

  • I need help with activating Adobe MC CS4

    Good day! I need help with activating Adobe MC CS4. Recent installation was not deactivated.I have Adobe License Certificate ID and other data and can provide it. Now activation not accept serial number provided in certificate.

    What message do you get when the serial number is not accepted?

  • I need help with downgradeing my ios for my ipod touch 4th gen

    i need help with downgradeing my ios for my ipod touch 4th gen

    As has alwys been the case, you cannot go back.
    Sorry

  • Help needed with a PS script for network share documentation

    I found a nice PS script that will do what I want, however the output portion seems to be broken. It will output the permissions and details, but not list what share it is referring to... Can anyone help with this?
    Thanks!
    https://gallery.technet.microsoft.com/scriptcenter/List-Share-Permissions-83f8c419#content
    <# 
               .SYNOPSIS  
               This script will list all shares on a computer, and list all the share permissions for each share. 
               .DESCRIPTION 
               The script will take a list all shares on a local or remote computer. 
               .PARAMETER Computer 
               Specifies the computer or array of computers to process 
               .INPUTS 
               Get-SharePermissions accepts pipeline of computer name(s) 
               .OUTPUTS 
               Produces an array object for each share found. 
               .EXAMPLE 
               C:\PS> .\Get-SharePermissions # Operates against local computer. 
               .EXAMPLE 
               C:\PS> 'computerName' | .\Get-SharePermissions 
               .EXAMPLE 
               C:\PS> Get-Content 'computerlist.txt' | .\Get-SharePermissions | Out-File 'SharePermissions.txt' 
               .EXAMPLE 
               Get-Help .\Get-SharePermissions -Full 
    #> 
    # Written by BigTeddy November 15, 2011 
    # Last updated 9 September 2012  
    # Ver. 2.0  
    # Thanks to Michal Gajda for input with the ACE handling. 
    [cmdletbinding()] 
    param([Parameter(ValueFromPipeline=$True, 
        ValueFromPipelineByPropertyName=$True)]$Computer = '.')  
    $shares = gwmi -Class win32_share -ComputerName $computer | select -ExpandProperty Name  
    foreach ($share in $shares) {  
        $acl = $null  
        Write-Host $share -ForegroundColor Green  
        Write-Host $('-' * $share.Length) -ForegroundColor Green  
        $objShareSec = Get-WMIObject -Class Win32_LogicalShareSecuritySetting -Filter "name='$Share'"  -ComputerName $computer 
        try {  
            $SD = $objShareSec.GetSecurityDescriptor().Descriptor    
            foreach($ace in $SD.DACL){   
                $UserName = $ace.Trustee.Name      
                If ($ace.Trustee.Domain -ne $Null) {$UserName = "$($ace.Trustee.Domain)\$UserName"}    
                If ($ace.Trustee.Name -eq $Null) {$UserName = $ace.Trustee.SIDString }      
                [Array]$ACL += New-Object Security.AccessControl.FileSystemAccessRule($UserName, $ace.AccessMask, $ace.AceType)  
                } #end foreach ACE            
            } # end try  
        catch  
            { Write-Host "Unable to obtain permissions for $share" }  
        $ACL  
        Write-Host $('=' * 50)  
        } # end foreach $share
    This is what the output looks like when ran with 'RemoteServer' | .\Get-SharePermissions.ps1 | Out-File 'sharepermissions.xls'
    FileSystemRights  : Modify, Synchronize
    AccessControlType : Allow
    IdentityReference : Everyone
    IsInherited       : False
    InheritanceFlags  : None
    PropagationFlags  : None

    Actually it is not being written only with Write-Host.  The last line of the loop is this "$ACL"  which ius an array of objects. 
    Here is a version that gets the info more easily and produces flexible objects.  It should be easier to modify into what is needed.
    # Get-ShareSec.ps1
    [cmdletbinding()]
    param(
    [Alias('ComputerName')]
    [Parameter(
    ValueFromPipelineByPropertyName=$True
    )]$Name=$env:COMPUTERNAME
    Process {
    Write-Verbose "Computer=$name"
    $shares =Get-WMiObject Win32_Share -ComputerName $name -Filter 'Type=0' -ea 0
    foreach($share in $shares){
    $sharename=$share.Name
    Write-Verbose "`tShareName=$sharename"
    $ShareSec = Get-WMIObject -Class Win32_LogicalShareSecuritySetting -Filter "name='$ShareName'" -ComputerName $name
    try {
    foreach ($ace in $ShareSec.GetSecurityDescriptor().Descriptor.DACL) {
    $props=[ordered]@{
    ComputerName=$name
    ShareName=$sharename
    TrusteeName=$ace.Trustee.Name
    TrusteeDomain=$ace.Trustee.Domain
    TrusteeSID=$ace.Trustee.SIDString
    New-Object PsObject -Property $props
    catch {
    Write-Warning ('{0} | {1} | {2}' -f $Computer,$sharename, $_)
    Get-Adcomputer -Filter * | .\Get-ShareSec.ps1 -v
    ¯\_(ツ)_/¯

  • Need help with a basic script to resize image then resize the canvas

    I am new to photoshop scripting, and have come across a need to force an image to be 8"x10" at 300dpi (whether it is vertical or horizontal)
    I need to maintain the correct orientation in the file, so an Action will not work, I believe I have to implement a script to accomplish this.
    I have the below script so far, but I am not certain of how to input the variables / paramters
    doc = app.activeDocument;
    if (doc.height > doc.width) doc.resizeImage("2400 pixels","3600 pixels", "300", "BICUBIC");
    if (doc.height > doc.width) doc.resizeCanvas("2400 pixels","3000 pixels", "MIDDLECENTER");
    if (doc.height < doc.width) doc.resizeImage("3600 pixels","2400 pixels",300,"BICUBIC");
    if (doc.height < doc.width) doc.resizeCanvas(3000,2400,"MIDDLECENTER");
    When I run this script, I get the following error:
    Error 1245: Illegal argument - argument 4
    - Enumerated value expected
    Line: 5
    if (doc.height < doc.width) doc.resizeImage("3600 pixels","2400 pixels",300,"BICUBIC");
    The fact that its failing on lien 5 lets nme know that I have the "If" portions of my script correct, I just dont know how to accomplish the functions correctly.
    Any help would be appreciated!
    Thanks,
    Brian

    I know I'm late here but it seems to me your trying to automate a 8"x10 or 10"x8 300DPI  print.
    To do that you must first crop your image to a 4:5 aspect ratio to prevent distortion unless your shooting with a 4" by 5" camera.   I wrote a Plugin script a couple years ago that could help you do a centered crop.  You could do the whole process by recording a simple Photoshop action that uses two  Plugin Scripts only four steps would be needed.
    Step 1 Menu File>Automate>AspectRatioSelection  (My script based of Adobe Fit Image Plugin script) Set 4:5 Aspect ratio, center,  Rectangle, Replace, no feather. Llike Fit Image this script woks on both Landscape and Portrait images. The Selection will be correct for the images orientation.
    Step 2 Menu Image>Crop
    Step 3 Menu File>Automate>Fit Image set 3000 PX height and 3000 PX width the Image will be Resample so its longest side will be 3000 pixels.  Adobe Fit Image Plugin Script always uses BICUBIC resampling.  I have a modified version of Fit Image  that uses Bicubic Sharper whebndownsizing and BicubicSmoother when up sizing.
    Step 4 Menu Image>Size un check resample set resolution to 300 DPI.
    When you play the actions the Script Dialogs will not be displayed and the setting use when you recorded the action will ne used.
    The Plugin Script are included in my crafting actions package:
    http://www.mouseprints.net/old/dpr/JJMacksCraftingActions.zip
    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. This file has some additional comments I inserted describing how the actions work.
    12 Scripts for actions
    My other free Photoshop downloads cam be found here: http://www.mouseprints.net/Photoshop.html

  • Adobe script for rotation and position

    I am new to adobe script and actions (very new. like starting today, right now).
    First I just want to know if what I'm trying to do it even possible.
    Imagine a simple rectangle in photoshop.
    I have a table of angles and coordinates (could be an an excel file or any kind of text file). let's say 10 rows. column A = angles and columns B and C are x and y coordinates, respectively.
    I want to somehow have photoshop read this list, and make 10 layers that have the rectangle at the position and angle specified by each row of the table.
    then, I want a timeline with 10 frames, each one having only the appropriate, sequential layer visible.
    Is that possible?
    If so, does anyone have any suggestions. I've never written script in adobe, but do have some programming experience in other oldschool languages.
    and maybe a link that explain how to use the script once it's written?
    thanks

    It is not so good to provide the first post in a thread one has started oneself. Edit: At least that’s my opinion on this issue.
    The Forum has been made worse recently in some regards, one of which makes it less easy to notice that the OP has posted a reply and not someone else.
    Anyways, maybe this helps.
    It uses and array or arrays of the basis of the transformation of the active layer.
    // 2014, use it at your own risk;
    #target photoshop
    if (app.documents.length > 0) {
    var originalRulerUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    var myDocument = app.activeDocument;
    var theLayer = smartify2010 (myDocument.activeLayer);
    var theW = theLayer.bounds[2] - theLayer.bounds[0];
    var theH = theLayer.bounds[3] - theLayer.bounds[1];
    var theCenter = [theLayer.bounds[0] + theW/2, theLayer.bounds[1] + theH/2];
    var theValues = [[0, 0, 15], [100, 100, 30], [300, 300, 45]];
    for (var m = 0; m < theValues.length; m++) {
    myDocument.activeLayer = theLayer;
    duplicateMoveRotateScale (theValues[m][0] - Number(theCenter[0]), theValues[m][1] - Number(theCenter[1]), 100, 100, theValues[m][2]);
    app.preferences.rulerUnits = originalRulerUnits;
    ////// duplicate and transform layer //////
    function duplicateMoveRotateScale (theX, theY, theScaleX, theScaleY, theRotation) {
    try{
    // =======================================================
    var idTrnf = charIDToTypeID( "Trnf" );
        var desc10 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref6 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref6.putEnumerated( idLyr, idOrdn, idTrgt );
        desc10.putReference( idnull, ref6 );
        var idFTcs = charIDToTypeID( "FTcs" );
        var idQCSt = charIDToTypeID( "QCSt" );
        var idQcsa = charIDToTypeID( "Qcsa" );
        desc10.putEnumerated( idFTcs, idQCSt, idQcsa );
        var idOfst = charIDToTypeID( "Ofst" );
            var desc11 = new ActionDescriptor();
            var idHrzn = charIDToTypeID( "Hrzn" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc11.putUnitDouble( idHrzn, idPxl, theX );
            var idVrtc = charIDToTypeID( "Vrtc" );
            var idPxl = charIDToTypeID( "#Pxl" );
            desc11.putUnitDouble( idVrtc, idPxl, theY );
        var idOfst = charIDToTypeID( "Ofst" );
        desc10.putObject( idOfst, idOfst, desc11 );
        var idWdth = charIDToTypeID( "Wdth" );
        var idPrc = charIDToTypeID( "#Prc" );
        desc10.putUnitDouble( idWdth, idPrc, theScaleX );
        var idHght = charIDToTypeID( "Hght" );
        var idPrc = charIDToTypeID( "#Prc" );
        desc10.putUnitDouble( idHght, idPrc, theScaleY );
        var idAngl = charIDToTypeID( "Angl" );
        var idAng = charIDToTypeID( "#Ang" );
        desc10.putUnitDouble( idAngl, idAng, theRotation );
        var idIntr = charIDToTypeID( "Intr" );
        var idIntp = charIDToTypeID( "Intp" );
        var idbicubicAutomatic = stringIDToTypeID( "bicubicAutomatic" );
        desc10.putEnumerated( idIntr, idIntp, idbicubicAutomatic );
        var idCpy = charIDToTypeID( "Cpy " );
        desc10.putBoolean( idCpy, true );
    executeAction( idTrnf, desc10, DialogModes.NO );
    } catch (e) {}
    ////// function to smartify if not //////
    function smartify2010 (theLayer) {
    // make layers smart objects if they are not already;
      app.activeDocument.activeLayer = theLayer;
    // process pixel-layers and groups;
          if (theLayer.kind == "LayerKind.GRADIENTFILL" || theLayer.kind == "LayerKind.LAYER3D" || theLayer.kind == "LayerKind.NORMAL" ||
          theLayer.kind == "LayerKind.PATTERNFILL" || theLayer.kind == "LayerKind.SOLIDFILL" ||
          theLayer.kind == "LayerKind.TEXT" || theLayer.kind == "LayerKind.VIDEO" || theLayer.typename == "LayerSet") {
      var id557 = charIDToTypeID( "slct" );
      var desc108 = new ActionDescriptor();
      var id558 = charIDToTypeID( "null" );
      var ref77 = new ActionReference();
      var id559 = charIDToTypeID( "Mn  " );
      var id560 = charIDToTypeID( "MnIt" );
      var id561 = stringIDToTypeID( "newPlacedLayer" );
      ref77.putEnumerated( id559, id560, id561 );
      desc108.putReference( id558, ref77 );
      executeAction( id557, desc108, DialogModes.NO )
      return app.activeDocument.activeLayer
      if (theLayer.kind == LayerKind.SMARTOBJECT || theLayer.kind == "LayerKind.VIDEO") {return theLayer};

  • Need help making a simple script for my webcam

    Hey everyone, fairly new to applescript programming. I just bought a usb camera for my macbook because I use it for video conferencing/playing around, and it is better quality than the built in isight. However, in order to use this camera I need to use drivers from a program called camTwist. This being said camTwist needs to be opened first and the usb camera must be selected from camTwist Step 1 list in order for any other application to use the camera. I just want to make a simple program that would open camTwist first, then select "webcam" from the list (double click it like I always have to in order to select it) in order to activate the driver, and then open photo booth which would then be using the camTwist driver in order to take pictures.
    I made a crude program but it does not automatically select "webcam" from the Step 1 list in camTwist:
    tell application "CamTwist" to activate
    delay 10
    tell application "Photo Booth" to activate
    that’s basically it. I set the delay to 10 seconds so that when camTwists boots up first I can manually select my webcam. HOWEVER, I would like to make a script that would boot up CamTwist first, select my webcam from the list automatically, and then open Photo Booth with the CamTwist webcam driver already selected.
    Don't know much about applescript so any help to make a working script to solve my problem would be greatly appreciated! Thanks!

    Solved my problem but now I need help with something else! First I used CamTwist user options to create user defined hot keys with the specific purpose to load the webcam. I chose Command+B. I tested it out in CamTwist and it worked. The program follows a logical order from there. First it loads CamTwist, then after a short delay it presses the hot keys in order to load the webcam from the video source list, then another short delay and Photo Booth is opened with the driver loaded from camTwist. Everything works Perfect! Here's the code:
    tell application "System Events"
    tell application "CamTwist" to activate
    delay 0.5
    --Press command+b which is a user defined hot key to load webcam
    key code 11 using command down
    end tell
    delay 0.5
    tell application "Photo Booth" to activate
    My Next question is, would it be possible with this same script to have both applications quit together. For example I always quit Photo Booth first, so when I quit photo booth is there a way to make CamTwist also quit and keep everything within the same script? Please let me know. This forum has been very helpful and lead me to a solution to my problem! Hoping I can solve this next problem as well! Thanks everyone.

Maybe you are looking for