Duplicate layer to different document with new layer name.

I am trying to replicate the Photoshop function of "Duplicate Layer" where I can take a layer from an active document and duplicate it to a target document AND set the name of the new layer once it is copied.
Javascript is the language.
Windows CS4 if it matters.
Any suggested code snippets?
Thanks
-Mike

This will dupe the activeDocument to a new document.
function newDocFromLayer(docName,layerName){
     docName == undefined ? docName = "Untitled":docName;
     layerName == undefined ? layerName = activeDocument.activeLayer.name:layerName;
    var desc = new ActionDescriptor();
        var ref = new ActionReference();
        ref.putClass( charIDToTypeID( "Dcmn" ) );
    desc.putReference( charIDToTypeID( "null" ), ref );
    desc.putString( charIDToTypeID( "Nm  " ), docName );
         var ref1 = new ActionReference();
        ref1.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
    desc.putReference( charIDToTypeID( "Usng" ), ref1 );
    desc.putString( charIDToTypeID( "LyrN" ), layerName );
executeAction( charIDToTypeID( "Mk  " ), desc, DialogModes.NO );

Similar Messages

  • Help! Resizing different documents with different resolutions?

    Hello!
    Please help me with my situation:
    I was trying to make an action that will decrease 1 inch to all sides of my document (the document size was 12x36 inches) and hopefully to other documents.  I don't want to crop the image, I just want to resize the whole image to 10x24 inches, leaving a 1 inch transparent border (the gray and white checkerboard) to my document. I started resizing manually, but it was time-consuming so I tried to make the action I stated above. I was expecting that it would decrease a proportionate 1 inch to the top, bottom, left and right sides of other documents, but it didn't. Any procedure to make this happen in different documents with different sizes and resolutions?
    PS: All the the documents that I will resize would eventually be printed ( I don't know if this would help).
    Thank you for your help!

    Kursover wrote:
    I was trying to make an action that will decrease 1 inch to all sides of my document (the document size was 12x36 inches) and hopefully to other documents. I don't want to crop the image, I just want to resize the whole image to 10x24 inches, leaving a 1 inch transparent border (the gray and white checkerboard) to my document. I was expecting that it would decrease a proportionate 1 inch to the top, bottom, left and right sides of another document, but it didn't. Any procedure to make this happen in different documents with different sizes and resolutions?
    Easy to do in a script not so easy in an action unless you know that there is no background layer or that all have backgounds.  You can not add transparent canvas to a document with a background layer for brckground layers do not support transparence. Documents may or mant not have a background layer and background layers can be converted to a normal layer.  Actions can not use logic without using a script to see if there is a background.  My Crafting Actions package contains a utility script for actions that will convert background layers to a normal layer should a document have a background layer. Once you know there is no "Background" the rest is easy to do in an action with menu limage canvas size check relative and set width and height to 1" the will add 1"
    Decreasing -1" will CROP any layer the has not transparent pixels in the outter 1"
    Crafting Actions Package
    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.
    A script can retrieve the width and height of a document to changs size you need to resize the document this will not crop but will resample and you most matain aspect ratio elss resize will distort. Decreasing canvas size may crop...
    12 Scripts for actions
    Example
    Download

  • TextEdit: how save document with new name?

    I tryed in many ways to save modified document with new name with TextEdit but no one works for me.

    Use TextEdit > File > Duplicate.
    For this example, my original document is named Lorem.rtf. I open it with TextEdit, and then Duplicate it. A new TextEdit document window appears. Its default name is Untitled (Lorem copy). If you pass your pointer near the right parenthesis, a downward pointing triangle appears. Click that and the Name field has Lorem Copy preselected. Press the delete key to erase this name, and enter the new name — followed by a return to set it.

  • Saving documents with similar file names

    When saving documents with similar file names, I used to be able to hit save as button and go to the file folder I wish to use. I could then click an existing file in the folder to draw in the name and then just modify it slightly to create the new name.
    In Reader DC I get an error saying this is a read only file an can not be saved.  I can save the file if I use a different file name but then I have to go in and rename the file. i.e. if I have a weakly report that I save, I may have the file name "Installerspayroll.we.04.25.15.pdf."
    I used to be able to click on the existing file name to bring it into the name box and then just change the date. The updated version is not allowing me to do that, creating more work.

    I thought you were referring to an admin account within the Adobe program. I am an admin on the machine I am signed into and using while having these problems
    Thank you for this opportunity to share our expertise,
    Michael Mallary
    Treasurer
    Mallary Carpet & Flooring, Inc.
    410-766-6992
    www.mallarycarpet.com<http://www.mallarycarpet.com>
    Earning your unsolicited referrals
    is our number one priority

  • How to change the Existing alias with new alias name...MAXL SCRIPT

    HI Experts
    I need to change alias name of the existing member with new alias name.
    please send me maxl code to change the alias name .
    My thought is
    1) Old alias should be replaced with new alias name .
    2)There is one account that should be rolled out to another parent..these parents are already exsist
    3) I need a MAXL Script to change the new alias name .
    please suggest ASAP.
    Thanks
    USER

    John
    I heard that we can replace existing alias name with new alias thru MAXL
    i.e replace alias name XXXX member with YYYY ;
    please correct me if iam wrong ,might be Maxl command is wrong but this is the idea.
    Thanks
    USER

  • [svn:osmf:] 13083: Updated MASTAdapter class with new trait names and events.

    Revision: 13083
    Revision: 13083
    Author:   [email protected]
    Date:     2009-12-17 16:10:05 -0800 (Thu, 17 Dec 2009)
    Log Message:
    Updated MASTAdapter class with new trait names and events.
    Modified Paths:
        osmf/trunk/plugins/MASTPlugin/org/osmf/mast/adapter/MASTAdapter.as
        osmf/trunk/plugins/MASTPluginIntegrationTest/src/org/osmf/test/mast/TestMASTPluginInfo.as
        osmf/trunk/plugins/MASTPluginIntegrationTest/src/org/osmf/test/mast/adapter/TestMASTAdapt er.as

    Silviu!
    I'm really sorry, but as all the office is trying to fix the problem, someone replaced the url content with the stuff that was pointing to the local machine.
    I've fix it, and the video player is available here again: http://pp.player.webtv.flumotion.com/params/apiKey/5PzLR2ULL3z2rumJ/videoId/60
    If there are other references to the localhost, please do not bother with them, as they do not affect player functionality.
    The stream that it uses is an RTMPE, so i'm afraid it will only works with this player. Anyway, the stream url is as follows: rtmpe://87.248.205.81/a4349/e2/veo7/ondemandrtmpe/mp4/med/first-person-mario-4d8741aa.mp4
    I really appreciate your help!
    Thank you!

  • Hi Everyone,  I am using iPhone5, my question in how to display name and contact number both stored for incoming and outgoing calls? If I have saved five different numbers with a same name, how do I recognise that from which number caller is calling?

    Hi Everyone,  I am using iPhone5, my question in how to display name and contact number both stored for incoming and outgoing calls? If I have saved five different numbers with a same name, how do I recognise that from which number caller is calling?

    I have friends all over Europe, does it matter what number they use to call me? Nope! All incoming calls are free for me.
    The only time you ever have to worry about which number is if you get charged for incoming domestic/international calls.
    You can tag their number (work/home/iphone) and that may show on the CallerID accordingly.
    It should show, John Doe
    underneath,    work/home/mobile
    For example:
    http://shawnblanc.net/images/img-0009-1.png

  • Restore database with new DB name

    I'm trying to restore a database from a hot backup with a new database name. I'm trying to use the backup control file with the SET DATABASE in the control file. That works ok, but when I run RECOVER DATABASE USING BACKUP CONTROLFILE I get errors such as
    ORA-00279: change 1516911820 generated at 09/08/2006 17:14:43 needed for thread 1
    and ORA-00308: cannot open archived log
    Can anyone help me? I'm not using RMAN currently with the DUPLICATE command because I'm running on NetApp filers and it would be much faster to duplicate the database this way. Also, I'm duplicating on the same server so I need to use a different instance name.
    Thanks,
    Michael Cunningham

    Assuming source is in Archive Log mode.
    Your scenario is :-
    Cloning Database in the same server using OS copy.
    I believe you are stuck with recovery issues, what you need to do is feed the archive log that the database is asking for. You can also try giving it the redo logs.
    RECOVER DATABASE USING BACKUP CONTROLFILE;
    feed it the archive/redo logs. Till you get a Media recovery complete message.

  • WPC: unable to add different resources with the same name into a WPC page

    Hi,
    I got a WPC problem when adding different KM resources with the same name into a WPC page.  Only one KM resource is able to be added in WPC.
    For example:
    There two "article.html" with different content and RID:
    1. /company_a/article.html
    2. /company_b/article.html
    when adding these two html pages into a WPC page, only one page will be shown.
    This means that a WPC page is not able to contain resources with same file names.  I think the problem might lie on the resource-linking mechanism of WPC. WPC will add a resource link in the page folder, when a new resource is drag&dropped into WPC.
    Anyone has some good ideas to solve my problem? Thanks a lot.
    Regards
    Lei NING
    Edited by: Lei NING on Apr 15, 2008 4:16 PM

    As this is not possible and double entries cause this problem, why not just pu both napes in the contact details on the same number. IE John Smith & Peter Jones all in the first name, by doing this if you search your contacts either by searching for john, peter, smith or jones the number will show up and if either calls the number will show John Smith & Peter Jones, it may not be perfect but will work. As the phone only recognises a number if two seperate entries of the number exist with different names it cannot possibly know who is calling ?
    If I have helped at all, a click on the White Star is always appreciated :
    you can also help others by marking 'accept as solution' 

  • Flash gives me an error when I compile after I 'Saved As' the FLA with new file name

    This seems weird. My code worked in the original FLA (using AS3) but when I 'Save As' as a new doc,
    It gives me a compiling error below:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at flash_fla::MainTimeline/frame1()
    Any ideas why this happens?
    Does it have to do with path to the Library? Is there a way to reset this within Flash or do I have to copy and paste the code to a totally new AS3 file?
    Thanks

    kglad,
    It doesn't specify what line the error takes place.
    The weird thing is...
    when I copy and paste the code on a totally new AS3 document and rebuild the movie clips within that document, it works fine.
    but for some reason...when I 'Save As' to a new file name, it's like it doesn't acknowledge the MovieClips in the Library anymore..
    It's kind of frustrating...
    Not really a show stopper....but it does waste some time.
    I don't know if you run into anything like this before.

  • Saving File with new file name

    I am subclassing JFileChooser and implementing ActionListener for being able to save and open files.
    I am using different file extensions (.ac and .ps), and when saving, I first check that the file name has the right extension.
    If it doesn't, I add the right extension.
    But for some reason it doesn't show my saved new file, even though in the debugger it goes through all the code of saving.
    Here is the main portion of my code before the code of saving (adaptee is my JFileChooser):
    File ananyaFile = adaptee.getSelectedFile();
    String name = ananyaFile.getName();
    int l = name.length();
    if (!(l >= 4 && name.charAt(l - 3) == '.' &&
    ((adaptee.getFileFilter() == adaptee.acExtensionFilter &&
    name.charAt(l - 2) == 'a' && name.charAt(l - 1) == 'c') ||
    (adaptee.getFileFilter() == adaptee.psExtensionFilter &&
    name.charAt(l - 2) == 'p' && name.charAt(l - 1) == 's'))))
    if (adaptee.getFileFilter() == adaptee.acExtensionFilter)
    name = name + ".ac";
    ananyaFile = new File(name);
    adaptee.setSelectedFile(ananyaFile);
    else if (adaptee.getFileFilter() == adaptee.psExtensionFilter)
    name = name + ".ps";
    ananyaFile = new File(name);
    adaptee.setSelectedFile(ananyaFile);
    Why does it not show my saved new file? Do I have to set it somewhere else?
    Thanks for your time!

    Ok, I put the code which adds the extension
    File ananyaFile = this.getSelectedFile();
    if (ananyaFile == null)
       return;
    String name = ananyaFile.getName();
    int l = name.length();
    if (!(l >= 4 && name.charAt(l - 3) == '.'  &&
       name.charAt(l - 2) == 'a' && name.charAt(l - 1) == 'c')  
       name = name + ".ac";
       ananyaFile = new File(name);
       this.setSelectedFile(ananyaFile);
    }into the approveSelection method of my subclass of JFileChooser.
    If someone wants to open a file without writing the extension and the file with the extension (which was added in my code) exists, it does get opened.
    Also, if someone wants to save a file without writing the extension and the file with the extension (which was added in my code) exists, it does ask if you want to replace the file (as I have programmed).
    But if you say yes, or if you want to save a file without the extension that doesn't yet exists (with the extension), it doesn't save it.
    However, saving works fine if someone writes the full file name into the File name box.
    Well, I would like to allow the user not to write the extension not only for opening a file, but also for saving a file.
    Please help! I am getting pretty desperate! Thanks!

  • How to copy a files spotlight comments for an entire folder and place them in a different file with that same name

    I have the same question in a different discussion but I already marked it as solved because one of the questions was answered. Here's the linke to the other discussion if your interested https://discussions.apple.com/thread/5970421 
    I have movie covers saved as a jpeg for every movie my family and I own. There is about 700 and they each have a comment of the main actors, release dates, and descriptions. This makes it easy to find what to watch.Is there an applescript, automator, program I can download,  or program code supported in xcode that will do the following set of inscructions?
    Take the name of the picture file and spotlight comment, copy and paste it to a movie file's comments to a file with the same name but obviously has different extention. For an example
    In a Pictures folder
    Name: Dark Knight, The.jpeg       Comment: (2008) Genre: Action...             <- copy comment
    In a Movie Folder
    Name: Dark Knight, The.m4v       Comment:                                               <- paste
    and do this for all 700 files

    Clendenen02 wrote:
    where should I run the code? in the terminal, or an applescript, or should put it in xcode and run it from there or the terminal.
    What MrHoffman said.
    But if it's easier, you can wrap it in Automator and have Automator ask for the Folders: (Test on a sample of your files before running on all 700 files)
    (do you really own 700 movies??)
    The Workflow is:
    Put this in the Run Shell Script Action (and pass input as arguments":
    PicDir=$1
    MovDir=$2
    for f in $PicDir/*
    do
         if [ ! -d "$f" -a "${f##*.}" = "jpeg" ]; then
              comment=$(mdls -raw -name kMDItemFinderComment "$f")
              if [[ $comment != "(null)" ]]; then
                   picname=${f##*/}
                   movname=${picname%.*}.m4v
                   if [[ -e "$MovDir"/$movname ]]; then
    osascript <<-EOF
    tell application "Finder"
    set comment of file (POSIX file "$MovDir/$movname") to  "$comment"
    end tell
    EOF
                   fi
              fi
         fi
    done
    (BTW, I know that this is a bit of sloppy scripting (wraping an osascript in a Bash Script wrapped in Automator, but it does what you need)

  • Releasing new application with new "by" name

    i released 2 month ago an app with the name ***** and in by was my name....
    now i want to release a different app with general name in by ( not my name ).
    is it possible?

    Sorry, no one here can promise what will/won't be approved/rejected.
    See the App Store Review Guidelines for iOS Apps.

  • Create account with new domain names

    Hi there.
    I'm trying to create an account with the new domain names ([email protected]). .works is part of the new domains names available all over in recent months, but in the sign up form it says the email is invalid when it's working perfectly and it's totally valid. 
    I've tryed to contact support without sucess. do you have any idea how I can register an account with my [email protected] ?
    Best regards, 

    Hi, Cesarcouto.com, and welcome to the Community,
    Thank you for your report, which I have forwarded to those to whom I report.  Unfortunately, I do not know when this as well as many of the new domains will be recognized by Skype's new account creation system as valid.
    Regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • Replacing Exchange 2007 with another server with new server name

    I am working with a client to move Exchange from the server it is on now to another server. This will be new hardware and new name. The current server Exchange is on will still exist by I want to move Exchange completely off of that server. 
    Current Network Setup:
    Server 1: 1 SBS 2003 server is Domain Controller, Runs AD, DNS, DHCP, File Sharing, SharePoint 2003 and Remote Desktop
    Server 2: Server 2008 running Exchange 2007, Backup Domain Controller, File Sharing, SharePoint 2007, Terminal Services. 
    Current Plan:
    Introduce Server 3 to run just Exchange 2007. I would like to completely over a short period of time move exchange from Server 2 to Server 3. I have searched over the internet and found several articles but still have a few questions. There are roughly 75
    mailboxes with 50 actual users. Some users are using Outlook 2003 that came with the SBS 2003 and others are using Later versions of office. Server 3 will be a Server 2008 R2 system.
    1. What is the best method to perform this transfer. I found article TechNet
    Article that explains with 2 remote offices how to do this but not sure if the same will apply.
    2. Since I am not immediately decommissioning Server 2 how can I safely remove all the roles and add them to Server 3?
    3. For the end user impact. Will the change make Outlook automatically pickup the new server name or will each user need to reconfigure their outlook profiles?
    4. I will be moving OWA since there are several Remote and Terminal Service users that use OWA for email. I would like to keep the same certificate and domain name setup if possible. 

    Hi,
    According to your description, I recommend you install another exchange 2007 on server 3, the exchange server role as the same as server 2.
    And then, transfer all mailboxes and configurations(OWA,DNS..) from server 2 to server 3.
    Finally, decommission the server 2 .
    Thanks.
    Niko Cheng
    TechNet Community Support

Maybe you are looking for

  • QuickVPN 1.2.8 and Windows Vista

    Hi, I have managed to install QuickVPN on Windows Vista, but It won´t connect to my WRV200 router. I have have enabled that the if the router is pinged it will reply but QuickVPN does not get connected. I have also studied the readme file and it says

  • BADI  ME_GUI_PO_CUST not populating custom fields

    Hi!     I've created my custom fields in the Line item level for ME21n transaction. The custom fields are in the include structure CL_EKPODB for EKPO. I'm unable to populate my custom fields. Help needed.     My screen fields are named EKPO-ZZSTREET

  • Default settings in Reader

    Hi, Wher can you make default settings for page browsing in Adobe Reader? I remember being prompted to do this on an occasion after installing Adobe Reader. Now, I want to change the setting for page browsing but cannot find the place to do so. Thank

  • HT1926 iTunes installation/run failure due to C runtime library access failure

    iTunes update 11.1.4.62 fails when installing/running in Windows 7. System - see C++ Runtime Library error popup, below. I have tried uninstalling iTunes, rebooting, and re-installing with the same results. Any ideas?

  • MS Office crashes after SL upgrade

    After installing SL Office 2004 started randomly crashing, with the OS exiting back to the login screen. I repaired permissions and reinstalled Office but this did not help. Apple support recommended upgrading to Office 2008, saying that there was PP