Replace document name

How could I replace a open document name with a new name?
I have a script that creates the new name but I can't figure out how to send the new name back to photoshop replacing the open document name.
Here is the current script:
layerN = activeDocument.activeLayer.name
var doc = app.activeDocument
var fname = doc.name.split(".")
var fname = fname[0]
var newDoc = doc.duplicate(fname+layerN,true)
//var newDoc = (fname+layerN,true)
app.activeDocument.name = newDoc
newDoc.flatten();
Right now this one makes a duplicate of the original document with the document name like I want, but I would rather just rename the original document instead of making a duplicate.
Any help is appreciated.

Because the document is a new document a that was created as a dup of some othere document there is no File assocated with this new document.  When you created the document  you could have named it anything you wanted.  Also because the is no file associated with this document I beleive that if you save the document with the name you want that Photoshop will basicly rename the document to match the file it is now associated with. I think this is something that Photoshop does when a document with no file assocation gets assocated with a file. For example if I open one of my Camera RAW file through ACR into Photoshop the name in the image window title will be RAW_FILENAME.CR2  while it looks like there is a file assocation the document does not have a file assocation for Photoshop can not write CR2 raw file.  The document just needed a name so Photoshop gave it the raw file fame. Now if I save that Document as xxx.tif Photoshop will save the xxx.tif file and change the document  name from RAW_FILENAME.CR2 to xxx.tif and you will see the in the image window title.  While the Document name object is read only to scripts its not read only to Photoshop when there is no file assocation. Once there is a file assocation the document name is set and is read only to Photoshop now too.  Even if the document had a lot of changes and I go to the history Palette and see the RAW_FILENAME.CR2 snap shot followed by the open and history. If I step back to the open the name remains xxx.tif.
So if there is no assocated file all you need do is to save the document to the filename you want the document to have and Photoshop will rename the document for you if the document truly had never been saved and has no file assocated with it.

Similar Messages

  • Cannot open Pages documents that I've worked on.  I open a new document, work on it, then save and close it.  When I try to open the document again, I get the following message: The document "[name]" could not be opened. The file isn't in the correct form

    I cannot open Pages documents that I have worked on and saved.  When I try to reopen Pages documents that I've saved, I get the following
    message:
    "The document “[name of document]” could not be opened. The file isn’t in the correct format.
    The file might be corrupted, truncated, or in an unexpected format."
    I have downloaded the latest update to iWork, but that doesn't help.
    I use Mac OSX 10.6.7
    I am using Pages '09 version 4.0.5 (852)
    If anyone can help, I would greatly appreciate it.
    Best regards,
    New York Mac User

    A few general trouble shooting tips that may apply here:
    1. If you used Software Update to do the OS update(s) to reach 10.6.7, go to http://support.apple.com/downloads/ and download and apply the Mac OS v10.6.7 Combo Updater. The Combo Updater contains some fixes that were not included in the incremental updaters used by Software Update.
    1a. Check that you have the current version of Pages (and of the other iWork applications) installed. All three applications' current version numbers end in .0.5
    2. A common cause of malfunctioning applications is a corrupted preferences file (.plist file). Your Pages '09's plist is at yourname > Library > Preferences > com.apple.iWork.pages.plist
    Quit Pages, locate the file and Drag it to the Desktop (or to the Trash).
    Restart Pages and attempt to open one of the files.
    If all is well, Trash the plist file and empty the Trash.
    If there's no change, AND you've made changes to the Preferences that you wish to keep, drag the file back to its previous location, replacing any new one that has been created.
    Regards,
    Barry

  • Document Creation error - "We're sorry. We can't open document name because we found a problem with its contents"

    Morning Friends,
    I have created a SharePoint 2010 "Site Workflow" that is designed to take information from a form and create a Word doc with the gathered information and store this Word doc in a document library.
    I am using Sharepoint 2013 with Office 2013 
    I understand there are a lot of steps (19) outlined below and I can provide more information as needed but the bottom line is this, workflow successfully takes info from an initiation form, uses the info to create a Word doc. Places this Word doc in a library.
    When attempting to open / edit doc, receive error
    "We're sorry. We can't open <document name> because we found a problem with its contents"
    Details - No error detail available.
    Any info or advice would be greatly appreciated. 
    Very high level view of what I have done:
    1 - Created content type called "Letters"
    2 - Added site columns " First Name" and "Last Name"
    3 -  Created and saved to my desktop a very basic Word document (Letter.docx) that says "Hello, my name is XXXX XXXX"
    4 - In the advanced settings of the "Letters" content type I uploaded this "Letter.docx" file as the new document template.
    5 - Created a new document library called "Letters"
    6 - In Library Settings - Advanced Settings, clicked "Yes" to enable the management of content types.
    7 - Then I clicked "Add from existing content types" and added the "Letters" content type
    8 - Back in the advanced settings of the "Letters" content type I selected "Edit Template" and replaced the first XXXX with the Quick Part "First Name" and the second XXXX with the Quick part "Last Name"
    9 - Created a new 2010 Site workflow called "Create a Letter"
    10 - To the workflow I added the action "Create List Item"
    11 - Configured the action to create Content Type ID "Letters" in the document library "Letter" 
    12 - For the "Path and Name" I gave it a basic name of "Letter to"
    13 - The next step was to create the Initiation Form Parameters and added to form entries "First Name" and "Last Name"
    14 - I then linked the initiation form fields to the data source "Workflow Variables and Parameters" to their respective Field from Source parameters
    15 - Went back to the "Path and Name" and modified the basic name of "Letter to" to include the first and last name parameters.
    16 - Saved - published and ran the work flow.
    17 - As expected, Initiation Form prompts for First and Last Name. ("John Doe") Then click "start
    18 - Go to document library "Letters" and see a new Word document created titles "Letter to John Doe" 
    19 - Go to open / edit the Word document and receive the following error
    thoughts? Any info or advice would be greatly appreciated. 

    See this MS support article for SP2010 workflows and generating Word docs:
    https://support.microsoft.com/kb/2889634/en-us?wa=wsignin1.0
    "This behavior is by design. The Create
    List Item action in the SharePoint
    2010 Workflow platform can't convert Word content type file templates to the correct .docx format."
    I've had success in using SP 2013, Word 2013 (saving a .docx as the template instead of .dotx for the document library content type), and an SP 2010 workflow using SP Designer 2013.

  • Changing Document Name of unsaved File

    Hi,
    is it possible to change the name of an opened but not saved document?
    If I open a photo from ACR as an object, PS will append "as object" to the document name.
    I'd like to delete that part of the document name, BEFORE it will be saved.
    Or is there another way to do that?
    app.activeDocument.name is read only...
    Thanks!

    Try this:
    -X
    var original = app.activeDocument;
    var newDoc = original.duplicate(original.name.replace(' as object', ''));
    original.close(SaveOptions.DONOTSAVECHANGES);

  • A Script to Find and Replace Layer Names

    Are there any scripts to find and replace layer names?
    There is an excellent script available for Photoshop which allows you to not only replace words in layer names, but also insert words as Prefixes, Suffixes and Sequential Numbers.
    The illustrator version of this script only allows sequential numbering: It doesn't offer find and replacing of words.
    Ideally, it would be great if there was something that could do multiple find and replaces in one go:
    (e.g.
    You have layers like this Car, Dog, Bat
    You enter: car(Option1), dog(Option2), Bat(Option3)
    Your layers then become: Option1, Option2, Option3).

    big_smile, that's a very good start! Step 1 of Learning How To Script is indeed, adjusting an existing simple script to make it do more complicated things. (And usually then "break something", which is also a required part of the process.)
    You are correct in your observation this is repetitive stuff. For one or two different items that wouldn't be a problem, but in longer lists you soon get lost.
    The usual way of working with find-change lists is to build an array:
    var layernames = [
    [ 'FHairBowlBoy *Hair', 'Hairboy1' ],
    [ 'FHairCurlyafroBoy *Hair', 'Hairboy2' ],
    [ 'FHairSpikyBoy *Hair', 'Hairboy3' ],
    The general idea is to loop over all names, check if the current layer name is "layernames[i][0]" (the left column) and if so, rename it to "layernames[i][1]" (the right column). If you know how to write a loop in Javascript, then you can implement this right away.
    However ..
    A more advanced way to do this doesn't even need loop to over all layernames -- instead you can immediately "get" the correct name per layer! It's magic! Almost!
    The trick is to use a Javascript object instead of an array. Javascript objects are nothing special; Illustrator's 'layers' is an array of objects, and each object "layer" has a property "name", whose value you can read and set. What I do here is create a new object, where the "name" part is the original layer name and its value is the new layer name. All you need to check for per each layer is if there is a property 'object.originalLayerName', and if so, assign its value to that layer name.
    This looks a bit like the array above, except that (1) you use {..} instead of [..] to create an object, and (2) you add "name:value" pairs instead of "value" only (actually, the 'name' of a value in an array is simply its number).
    So this is what it looks like:
    // JavaScript Document
    var doc = app.activeDocument;
    // name indexed object
    var layernames = {
    'FHairBowlBoy *Hair':'Hairboy1',
    'FHairCurlyafroBoy *Hair':'Hairboy2',
    'FHairSpikyBoy *Hair':'Hairboy3'
    // loop through all layers
    for (var i = 0; i < doc.layers.length; i++)
    //Set up Variable to access layer name
    var currentLayer = app.activeDocument.layers[i];
    if (layernames[currentLayer.name])
      currentLayer.name = layernames[currentLayer.name];
    Enjoy!

  • Replace document fonts in InDesign CS6, js

    Hi,
    I need to replace document fonts in InDesign. I get the existing fonts with following script, but not sure how to replace let's say Helvetica Regular with Aria Regular:
    for(var counter = 0; counter < document.fonts.length; counter++){
                //If the <fontFamily> element for this font family does not already exist in the XML, add it.
                if(counter > 0){
    fontFamilyName = document.fonts.item(counter).fontFamily;
                        fontFamilyName.toString().replace(/\s*\(TT\)$/gi, "");
                        alert (fontFamilyName);
                        fontName = document.fonts.item(counter).name;
                alert (fontName);
                fontName = fontName.split("\t");
                fontStyle = fontName[1];
                if(fontStyle == "BoldBold"){
                    fontStyle = "Bold";
                fontName = fontName[0];
                alert (fontName);
    Thank you.
    Yulia

    Yuliart please mark as correct
    Virender,
    I didn't put in the font style because it wasn't asked for but if you are finding both the font and the style as in your example then you don't need to do a separate line for the style
    Just use
    app.findTextPreferences.appliedFont = "Arial\tRegular";
    I.e. the font name seperate from its style by a tab \t
    You only need to use a separate line fontStyle if you are looking for that style irrespective of which font the style is applied to although some might argue to use it for readability.
    Regards
    Trevor

  • Server 2012 Event 307 - Printed Document Name

    I created a printer monitoring system that pulls events from the event logs of a server and then compiles this information into reports.  I can tell how many pages printed per printer for a period of time, I can tell what users are my highest printers
    and once in awhile for some reason I would actually review what was printed.
    I use this data to determine when another printer is needed or not needed.  I used the printed document name to justify not replacing a $5000 color laser printer. because they printed personal stuff more than business. 
    This process worked great until I installed Windows Server 2012, and I have tested this on Windows 8 and have the same result. (I only care about the server though.  ;) )
    In the event log: Microsoft-Windows-PrintService/Operational
    In server 2003, event 10: Had printed document name
    Server 2008 and Server 2008 R2: Had printed document name. 
    Why is this no longer there, or was this an oversight? 
    I asked this at TechEd and there was not a Microsoft person there who could answer my question and they referred me to the forums.  Can someone tell me what I can do to turn this on, was this an oversight, bug, etc.
    -------------------------------------------------- Michael Moore, MBA, MCITP, MCSE, MCTS, MCSA, MCP.

    Hi,
    What are the models of your printers?
    I would like to confirm that have you update the printer drivers from the printer manufacturer for Windows Server 2012?
    In addition, if you have Windows Server 2003, 2008, and 2012 in the same envirment? If so, you may try to get the event information from the previous operating system.
    Regards,
    Arthur Li
    TechNet Subscriber Support
    If you are
    TechNet Subscriptionuser
    and have any feedback on our support quality, please send your feedback here.
    Arthur Li
    TechNet Community Support

  • When I try to open a document created in Pages, I get an error message saying "[Document Name" can't be opened."  I don't want to lose hours of work; has anyone else encountered this?

    When I try to open a document created in Pages, I get an error message saying "[Document Name" can't be opened."  I don't want to lose hours of work; has anyone else encountered this?

    A few general trouble shooting tips that may apply here:
    1. If you used Software Update to do the OS update(s) to reach 10.6.7, go to http://support.apple.com/downloads/ and download and apply the Mac OS v10.6.7 Combo Updater. The Combo Updater contains some fixes that were not included in the incremental updaters used by Software Update.
    1a. Check that you have the current version of Pages (and of the other iWork applications) installed. All three applications' current version numbers end in .0.5
    2. A common cause of malfunctioning applications is a corrupted preferences file (.plist file). Your Pages '09's plist is at yourname > Library > Preferences > com.apple.iWork.pages.plist
    Quit Pages, locate the file and Drag it to the Desktop (or to the Trash).
    Restart Pages and attempt to open one of the files.
    If all is well, Trash the plist file and empty the Trash.
    If there's no change, AND you've made changes to the Preferences that you wish to keep, drag the file back to its previous location, replacing any new one that has been created.
    Regards,
    Barry

  • Problems with replace file name with starting and ending Bates number

    When applying Bates numbers to a set of Acrobat pdf files I am unable to replace file names with the starting and ending Bates number. This is important
    for me in a legal application.
    The Bates numbers are applied to each page of each of file without any problem as required.
    The Bates log file indicates that the files have been renamed as I wanted.
    I am running Adobe Acrobat Professional 9 with the update to 9.1.9 and Windows XP Service Pack 3 (the last or current service pack)
    In all other respects Adobe Acrobat 9 is running to my satisfaction.
    Has anyone else had this problem and found a solution?
    HRKExon

    Thanks for asking the question, I hadn't heard of Bates numbers before and this gave me a chance to look up something new.
    When I googled for ' bates number legal index ' I found this document:
    http://www.adobe.com/devnet/acrobat/pdfs/batesnumbering9.pdf
    Maybe that will help.
    Scott Bonacker CPA
    Springfield, MO

  • How to open a Numbers doc after message "The document (name) could not be opened." is received?

    I opened an Excel file with multiple worksheets by doubleclicking on it, saved it as a Numbers file and made lots of changes to it. Now I can't open it at all. All I get is the message "The document (name) could not be opened."
    Any ideas?

    It seems that your doc is corrupted.
    Try to rename it from ********.numbers to ********.numbers.zip
    then double click it
    You will get a new ********.numbers file with the structure 'package'.
    Try to open it by double-click.
    Sometimes it works.
    Yvan KOENIG (VALLAURIS, France) jeudi 22 décembre 2011 13:16:28
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • For four days I have been unable to open a lot of documents. When I try I get a message "The document "name" could not be opened. You don't have permission. This has happened to an important letter which I corrected four times. My Mac has altered the name

    This problem began when I typed in an address http www etc., making one mistake in the address. I corrected it and then tried to copy the address because it was long (I wanted to be able to acces it another time), and that's when the trouble starrted. I just copt documents to get a new one because it's quicker, but it is unorthodox, I know. Since then whenever I copy a document i cannot open it, and it often puts a gobledegook ending to the document name. I've started emailing texts to myself so as to keep them, but I MUST be able to use documents normally. I hava a MacBook Pro, using OS Mountain Lion 10.8.5. I don't like it. It's fairly new, and has messed up my system of documents : the size is alll wrong and the tabulations are worse than ever. I use text edit because I wanted to use Macdictate because I am handicapped (arthritis and firbomyalgia) but I have never been able to get it to work. Since I changed OS I cannot use Text edit properly any more. Please help me. I think it must be a bug that came through when I was putting this address in four days ago. I went to the site once I'd corrected the address and it was perfectly normal. I shall ring them today and ask them if this has happened to anyone else. I live in France. Thank you for your advice. Because I am handicapped and I do not dirve, it is very difficult to get to a Mac store. I deleted Mac cloud documents because I don't want to use it and I thought it might solve the problem, but it didn"t.

    Back up all data.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
    I've tested these instructions only with the Safari web browser. If you use another browser, they may not work as described.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. To do that, unlock the preference pane using the credentials of an administrator, check the box marked Allow user to administer this computer, then reboot. You can demote the problem account back to standard status when this step has been completed.
    Triple-click anywhere in the following line on this page to select it. Copy the selected text to the Clipboard (command-C):
    { sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -R $UID:staff ~ $_ ; sudo chmod -R u+rwX ~ $_ ; chmod -R -N ~ $_ ; } 2> /dev/null
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V). You'll be prompted for your login password. Nothing will be displayed when you type it. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command will take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2 (optional)
    Take this step only if you have trouble with Step 1 or if it doesn't solve the problem.
    Boot into Recovery. When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    res
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password window will open. You’re not going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • Query Print Layout - Generated PDF Document Name?

    Hi All,
    Query Print Layouts associated to my user queries work great for printing...but does anyone know if there is a way to set a more appropriate document file name when attaching an edited PDF report to an email? It seems to always automatically create a document name starting with 'Query Manager_-1_12' or something similar when attaching the report document directly to email.
    I do realize that I can save the file locally, choose any name I like, then attach to email... but this defeats the purpose of being able to send the query report directly to the email icon.
    If anyone knows how I can do this it would be much appreciated. There seems no option in the QPLD document properties.
    Best regards,
    John

    Hello,
    Yes, I have the same question. It could be great being able to choose the name of the document when creating a pdf. Even better if you could chose fields of the document for the name of the pdf, such as, name of customer, number of document, date, etc.
    Is there any way for doing this?
    Thanks in advance,
    Javier.
    Hi All,
    Query Print Layouts associated to my user queries work great for printing...but does anyone know if there is a way to set a more appropriate document file name when attaching an edited PDF report to an email? It seems to always automatically create a document name starting with 'Query Manager_-1_12' or something similar when attaching the report document directly to email.
    I do realize that I can save the file locally, choose any name I like, then attach to email... but this defeats the purpose of being able to send the query report directly to the email icon.
    If anyone knows how I can do this it would be much appreciated. There seems no option in the QPLD document properties.
    Best regards,
    John

  • HT4689 With mission control in Mountain Lion, is there a setting that displays a document name when it is selected?

    For example, if I have 4 word documents open, and go to mission control so they are all displayed, can I turn a feature on that displays the document name when my mouse is over each document?
    Like in the picture, if I have my mouse over a document, the name of the document isn't displayed.  Can I change this?

    Hey! 
    I just got a new mac and was trying to figure out the same thing today!! I went from an older version to this 10.9.  I called apple support, the tech had no idea what I was talking about.  I was transferred to a manager who told me that it is not feature available on the new models.  After a 40 minute conversation I was about to let it go and then I saw this post and became determined LOL ... and I figured it out (SMH apple support).  So here is how you do you it:
    system preferences > trackpad > you want to make sure the "App Expose" is checked off > and you're done!!
    I am not able to upload a 2 photos so I will post a second screenshot of what it looks like once the preferences are set.

  • Displaying Document Name With The Summary in a Single Column Using Document Library View.

    Hi All,
    I have a question that relates to SharePoint Document Library Views. I want to view the Documents name with the summary in a single column. Below image shows an example of it. I need this within a SharePoint Document Library. Also I want the height of the
    row to be increased more than the default height. I cannot figure it out how to do that? Could you someone help me to do this. I have inserted the Document Library as an App Part to the page. 
    So could you someone help me to solve this matter?
    Thanks and regards,
    Chiranthaka

    HI Chiranthaka,
    You can create DataView webpart using SPD and then modify the display template according to your need.
    http://deannaschneider.wordpress.com/2012/07/10/item-counts-dvwp-sp2010/
    Hope this will help to solve your problem.
    Best Regards,
    Brij K

  • Displaying Document Name & The Summary in a Single Column Using Document Library View

    Hi All,
    I have a question that relates to SharePoint Document Library Views. I want to view the Documents name with the summary in a single column. Below image shows an example of it. I need this within a SharePoint Document Library. Also I want the height of the row
    to be increased more than the default height. I cannot figure it out how to do that? Could you someone help me to do this. I have inserted the Document Library as an App Part to the page. 
    So could you someone help me to solve this matter?
    Thanks and regards,
    Chiranthaka

    HI Chiranthaka,
    You can create DataView webpart using SPD and then modify the display template according to your need.
    http://deannaschneider.wordpress.com/2012/07/10/item-counts-dvwp-sp2010/
    Hope this will help to solve your problem.
    Best Regards,
    Brij K

Maybe you are looking for