Indesign CS2 "selection to new document" script?

Hi, just changing over to Indesign CS2 (i know! should be cs5 soon apparently), and noticed the scripting seems to be quite powerful with this software, i dont suppose anybody has created a script that would paste the currently selected object into a new document?  Would be handy when we're making templates for a self-build system to make it all on one document, then paste the various size boxes onto new documents ready to configure and upload!

Alison, you just have a minor omission… You have not declared your object to dupe… This worked with a little tweek…
--make a new document from selection
tell application "Adobe InDesign CS5"
set mySelection to selection
if (count of mySelection) = 0 then
display dialog "Nothing selected." & return & ¬
"Select something and then run the script." buttons {"OK"} cancel button {"OK"}
end if
set openDoc to document 1
tell openDoc
--make group in order to get width/height of selection
if (count of mySelection) > 1 then
set myItem to make group with properties ¬
{group itemsmySelection)}
else
set myItem to item 1 of selection
end if
set theBounds to geometric bounds of myItem
set theHeight to (item 3 of theBounds) - (item 1 of theBounds)
set theWidth to (item 4 of theBounds) - (item 2 of theBounds)
end tell
--make new document sized to the width/height of the selection
set myDoc to make new document with properties ¬
{document preferences:{page width:theWidth, page height:theHeight}}
--duplicate selection to new document
tell openDoc
set myDupe to duplicate myItem to page 1 of myDoc
--undo the grouping so selection is unchanged
undo
end tell
--re-posistion in new size doc
tell myDoc
move myDupe to {0, 0}
end tell
end tell
Sorry I've forgotten where you turn off the Emoticons… dammed : + (

Similar Messages

  • [AS][CS5] Duplicate selection to new document

    Hi everyone,
    I'm working on a script that will allow me to make a PDF or printout of a selection in InDesign by duplicating the selection to a new document.
    I'm having difficulty with the portion of the script that duplicates the selection to a new document.
    I'm trying to follow the instructions in the CS5 scripting guide but it's not working.
    Here's my code:
    --make a new document from selection
    tell application "Adobe InDesign CS5"
        set mySelection to selection
        if (count of mySelection) = 0 then
            display dialog "Nothing selected." & return & "Select something and then run the script." buttons {"OK"} cancel button {"OK"}
        end if
        tell document 1
            --make group in order to get width/height of selection
            if (count of mySelection) > 1 then
                set myItem to make group with properties {group items:(mySelection)}
            else
                set myItem to item 1 of selection
            end if
            set theBounds to geometric bounds of myItem
            set theHeight to (item 3 of theBounds) - (item 1 of theBounds)
            set theWidth to (item 4 of theBounds) - (item 2 of theBounds)
            --undo the grouping so selection is unchanged
            undo
        end tell
        --make new document sized to the width/height of the selection
        set myDoc to make new document with properties {document preferences:{page width:theWidth, page height:theHeight}}
        --duplicate selection to new document
        tell mySelection
            set myDupe to duplicate to page 1 of myDoc
        end tell
    end tell
    I get the following error:
    {«class crec» id 201 of «class sprd» id 186 of document id 2 of application \"Adobe InDesign CS5\", «class crec» id 202 of «class sprd» id 186 of document id 2 of application \"Adobe InDesign CS5\", «class crec» id 207 of «class sprd» id 186 of document id 2 of application \"Adobe InDesign CS5\"} doesn’t understand the duplicate message." number -1708 from {«class crec» id 201 of «class sprd» id 186 of document id 2, «class crec» id 202 of «class sprd» id 186 of document id 2, «class crec» id 207 of «class sprd» id 186 of document id 2}
    Thanks!

    Alison, you just have a minor omission… You have not declared your object to dupe… This worked with a little tweek…
    --make a new document from selection
    tell application "Adobe InDesign CS5"
    set mySelection to selection
    if (count of mySelection) = 0 then
    display dialog "Nothing selected." & return & ¬
    "Select something and then run the script." buttons {"OK"} cancel button {"OK"}
    end if
    set openDoc to document 1
    tell openDoc
    --make group in order to get width/height of selection
    if (count of mySelection) > 1 then
    set myItem to make group with properties ¬
    {group itemsmySelection)}
    else
    set myItem to item 1 of selection
    end if
    set theBounds to geometric bounds of myItem
    set theHeight to (item 3 of theBounds) - (item 1 of theBounds)
    set theWidth to (item 4 of theBounds) - (item 2 of theBounds)
    end tell
    --make new document sized to the width/height of the selection
    set myDoc to make new document with properties ¬
    {document preferences:{page width:theWidth, page height:theHeight}}
    --duplicate selection to new document
    tell openDoc
    set myDupe to duplicate myItem to page 1 of myDoc
    --undo the grouping so selection is unchanged
    undo
    end tell
    --re-posistion in new size doc
    tell myDoc
    move myDupe to {0, 0}
    end tell
    end tell
    Sorry I've forgotten where you turn off the Emoticons… dammed : + (

  • The following error occurs after Goodle News loads and I try to use the cursor to select a news item Script: chrome://vidbar/content/downloader.js:107

    Updated to the latest Version of Firefox and checked for updates on all apps but no change and the error occurs every time I select a news item or try to scan down or up the page.

    That issue is caused by the vidbar extension
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode

  • By default new document/templates start with above, How I change to be Strict 1.0 XHTML ?

    by default new document/templates start with above, How I change to be Strict 1.0 XHTML ?
    Tell me for Dw MX2004 & CS4 ?
    If I start with Transitional 1.0 XHTML and want to change to Strict 1.0 XHTML the only way is modify code or make a new doc ?

    Using CS4, there are a few ways to do it:
    1.  when creating a new document - you can select the doc type preference.
    2.  In your preferences, you can set up which document type will be opened when you select a new document.
    3.  If you start with one doctype and want to convert it to another use:

  • New Document without the Example?

    Is there a setting of Pages (08 or otherwise) that I can apply to be given a blank sheet upon selecting something like "Extreme Newsletter," and yet have the page formatted and prepared to act exactly like that type of document would? That is to say, am I to be treated to the default Lorem Ipsum example each time (with the exception of blank templates), then having to work from there to hack and slash at what I'm given to replace it with what I want? Or is there another way?

    Or go into Preferences, and select:
    For New Documents: Use Template
    It should already have the "Blank" template selected, but, if not, you an pick the right one my pressing the "Choose..." button.
    (Works in Numbers too, which is where I learned about it.)

  • New Document panel does not accept inputs

    I am new user of InDesign, newly installed.
    I cannot get the "New Document" panel to accept any keyboard entries except "Page size" label, "Orientation" and "Number of Pages".
    It will not accept width, height, column numbers or margins.
    Is there some setup procedure I am missing?
    Joe@

    Hi,
    Just want to confirm is it when you in InDesign clicked to file---> New---> Document?
    Are the fields coming gayed out(uneditable) or there are not fields.
    You can try trashing your preferences to begin with.. they may got corrupt...
    steps to trash preferences...
    Troubleshooting 101: Replace, or "trash" your InDesign preferences
    Let us know if it still persists....
    ~Monica

  • Use a pdf as a document template, New Document icon and action

    I am looking to use an editable pdf as a new document template for a content type.  I uploaded the pdf successfully, but when I select the new document from the template options, it attempts to open the pdf, and then provides the error message:
    Message from webpage
    The document could not be created. 
    The required application may not be installed properly, or the template for this document library cannot be opened.
    Please try the following:
    1. Check the General Settings for this document library for the name of the template, and install the application necessary for opening the template. If the application was set to install on first use, run the application and then try creating a new document
    again.
    2.  If you have permission to modify this document library, go to General Settings for the library and configure a new template.
    OK   
    I have already setup the docicon.xml with the following entry for pdf's:
    <Mapping Key="pdf" Value="pdficon_small.gif"/>
    PDF's are behaving appropriately throughout the environment, but I am unable to get the 'New Document' from a pdf template functioning.  Does this capability exist?
    Thanks!
    Jesse
    Jesse A. Brandenburg

    For Content Types, it only recognizes Office document types. In order to add PDFs, you would need to build a custom solution or purchase a 3rd party product (such as http://www.pdfshareforms.com/pdf-share-forms-enterprise/).
    See also:
    http://sharepoint20.blogspot.com/2012/08/how-to-use-pdf-as-sharepoint-content.html
    http://social.technet.microsoft.com/Forums/en-US/985bf92c-a718-4a90-ae95-b22600a75227/pdf-form-as-content-type-for-sharepoint-document-library?forum=sharepointgenerallegacy
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • InDesign CS2 - 100 document limit and compatibility with newer versions

    Hello,
    I have Adobe InDesign CS2 and am using it to compile a large report. I have come across a problem once i tried to add more than 100 documents to my book and now see there is a 100 file limit to books in CS2. Each document needs to stay as a single file so i am unable to join files to overcome this problem.
    I have a summary table at the beginning of the document detailing the title of each file in the book. I am unable to work out how to create page hyperlinks in the pdf to the second book (documents over the 100 mark).
    It has since come to fruition that my company has updates to CS3 and CS5 and that these new versions do not have a 100 file limit in creating books. This document i am creating is over 400 pages long so i am wary of upgrading to a new version when i am not far from publishing.
    Should i have any concerns in upgrading to a new version of InDesign when i have almost finished my report? Would it be better to just upgrade to CS3 and not make such a large jump to CS5? Or does anyone know how to create page hyperlinks in my pdf to the files contained in the second book?
    Thanks for any help! Much appreciated.

    Normally I would advise against changing versions in midstream on a project like this, but I'm not sure you have a choice. My instinct is there will be fewer issues moving to CS3 than CS5, but there are far more features in CS5 you might like to use...
    One way to limit the possible anomalies would be to export all the CS2 files to .inx na open those in CS5, rather than converting the .indd files directly, then save as new CS5 .indd files and add to a new book. One very serious issue you may run into wehn moving to a later version is that the text engines are updated and text won't necessarily flow exactly the same, particualry justified text, which can cause line endings to move and some paragraphs may gain or lose a line, which can have a really devastating effect on a long doc if it causes a page count to shift. The killer is that the changes normally don't happen until you start to edit text in that story. I believe the .inx route will force a recompose on opening, but I'm not dead certain, so take a look at http://indesignsecrets.com/force-text-reflow-when-indesign-forgets-to-flow-the-text.php to see how to force the recompose manually as soon as you open the file (you'd only need to do it once, before saving in the new version, for each file), then check carefully for oversets or other problems. Live preflight in CS5 can help with that.
    As you can tell, a successful move to a newer version is likely to be a lot of careful work preparing and checking the files. Some of it can be automated (the export to .inx, the recompose, and the save in the new version) by scripting, but in all honesty you're going to need to check every page when you are done.
    One of the others who uses Hyperlinks will need to weigh in on ID's native abilities and linking to other files in a book. I know that doing that with cross-references (which don't even exist natively prior to CS4) is extremely likely to break down at some point and leave you trying to remake them all, and large numbers of links across docs is likely to slow CS5 in particular to a crawl unless all files (at least the ones to which there are links in the doc you are editing) in the book are open.

  • How to place a word document in a TextFrame with InDesign CS2 scripting (JavaScript)?

    I´m newbie with InDesign CS2 Scripting (JavaScript). I need some help to understand the way to place a Word document in an indesign template, using JavaScript(.jsx).
    Thank you for the help,
    Peter

    //PlaceTextFileInFrame.jsx
    //An InDesign CS3 JavaScript
    //Places a text file in a text frame.
    var myDocument = app.documents.add();
    //Set the measurement units to points.
    myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
    myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
    //Create a text frame.
    var myTextFrame = myDocument.pages.item(0).textFrames.add({geometricBounds:myGetBounds(myDocument, myDocument.pages.item(0))});
    //Place a text file in the text frame.
    //Parameters for TextFrame.place():
    //File as File object,
    //[ShowingOptions as Boolean = False]
    //You'll have to fill in your own file path.
    myTextFrame.place(File("/c/test.txt"));
    function myGetBounds(myDocument, myPage){
    var myPageWidth = myDocument.documentPreferences.pageWidth;
    var myPageHeight = myDocument.documentPreferences.pageHeight
    if(myPage.side == PageSideOptions.leftHand){
    var myX2 = myPage.marginPreferences.left;
    var myX1 = myPage.marginPreferences.right;
    else{
    var myX1 = myPage.marginPreferences.left;
    var myX2 = myPage.marginPreferences.right;
    var myY1 = myPage.marginPreferences.top;
    var myX2 = myPageWidth - myX2;
    var myY2 = myPageHeight - myPage.marginPreferences.bottom;
    return [myY1, myX1, myY2, myX2];

  • InDesign CS2 Setting up a new document

    When opening a new document how do you get three pages to view in the page layout? (For instance when creating a six page folder.)

    In the pages panel, disable allow pages to shuffle. Then just drag the
    pages to the spread you want them to be part of.
    It's a bit tricky but you'll get the hang of it.
    Bob

  • Multi-page InDesign document to single-page InDesign documents script?

    I'm looking for a script that can take a multi-page Mac InDesign CS2/CS3 document and split it into single-page InDesign documents. Any ideas or comments?

    Sorry I'm coming in at the end of a discussion, but there was not enough input from the O.P. Mike. Are we working on a folder of multiple ID files, or just one? Do we need to export all pages of documents or just a range? What platform is needed? Generally how many pp per document, how many documents? Cleanup needed on master pages or swatches etc?
    I'm talking in Applescript here.
    Do master pages really need deleted? If not, then no problem, just leave them in. My guess would be to just have your original ID docs in a folder, and an output folder. Start a script, select your input and output folders. Script grabs first document, counts number of pages. Repeats X number of times. Delete pages except the page of current loop, do a Save-As into output folder with new doc name. Reopen (or undo) and repeat page deletion and Save-As with new name. Go to next loop with next original document.
    I've written a bunch of loops that do some of these basic functions. I can't see that trying to duplicate the page structure on a new document would be very efficient in any language. Seems like too many pitfalls that could snag you, like master page items or locked items or document preferences you have to account for.
    Even with my script there may be text flow issues with linked boxes.
    Mike, any additional input on what you need? Thx

  • I need this indesign cs3 script to run under Indesign cs2

    This is paragraph changes script which is run under indesign cs 3, I need this  script to run under my indesign cs 2, can anyone help me pls?. thank you  in advance
        Fixing paragraph style combinations
        Version: 1.1
        Script by Thomas Silkjær
        http://indesigning.net/
    var the_document = app.documents.item(0);
    // Create a list of paragraph styles
    var list_of_paragraph_styles = the_document.paragraphStyles.everyItem().name;
    // Make the dialog box for selecting the paragraph styles
    var the_dialog = app.dialogs.add({name:"Fix paragraph style pairs"});
    with(the_dialog.dialogColumns.add()){
        with(dialogRows.add()){
            staticTexts.add({staticLabel:"Find:"});
        with(borderPanels.add()){
            var find_first_paragraph = dropdowns.add({stringList:list_of_paragraph_styles, selectedIndex:0});
            staticTexts.add({staticLabel:"followed by"});
            var find_second_paragraph = dropdowns.add({stringList:list_of_paragraph_styles, selectedIndex:0});
        with(dialogRows.add()){
            staticTexts.add({staticLabel:"Change:"});
        with(borderPanels.add()){
            var change_first_paragraph = dropdowns.add({stringList:list_of_paragraph_styles, selectedIndex:0});
            staticTexts.add({staticLabel:"followed by"});
            var change_second_paragraph = dropdowns.add({stringList:list_of_paragraph_styles, selectedIndex:0});
    the_dialog.show();
    // Define paragraph styles
    var find_first_paragraph = the_document.paragraphStyles.item(find_first_paragraph.selectedIndex);
    var find_second_paragraph = the_document.paragraphStyles.item(find_second_paragraph.selectedIndex);
    var change_first_paragraph = the_document.paragraphStyles.item(change_first_paragraph.selectedIndex);
    var change_second_paragraph = the_document.paragraphStyles.item(change_second_paragraph.selectedIndex);
    // Set find grep preferences to find all paragraphs with the first selected paragraph style
    app.findChangeGrepOptions.includeFootnotes = false;
    app.findChangeGrepOptions.includeHiddenLayers = false;
    app.findChangeGrepOptions.includeLockedLayersForFind = false;
    app.findChangeGrepOptions.includeLockedStoriesForFind = false;
    app.findChangeGrepOptions.includeMasterPages = false;
    app.findGrepPreferences = NothingEnum.nothing;
    app.findGrepPreferences.appliedParagraphStyle = find_first_paragraph;
    app.findGrepPreferences.findWhat = "^";
    //Search the current story
    var the_story = app.selection[0].parentStory;
    var found_paragraphs = the_story.findGrep();
    var change_first_list = [];
    var change_second_list = [];
    // Loop through the paragraphs and create a list of words and mark them as index words
    myCounter = 0;
    do {
        try {
            // Create an object reference to the found paragraph and the next
            var first_paragraph = found_paragraphs[myCounter].paragraphs.firstItem();
            var next_paragraph = first_paragraph.paragraphs[-1].insertionPoints[-1].paragraphs[0];
            // Check if the next paragraph is equal to the find_second_paragraph
            if(next_paragraph.appliedParagraphStyle == find_second_paragraph) {
                    change_first_list.push(first_paragraph);
                    change_second_list.push(next_paragraph);
        } catch(err) {}
        myCounter++;
    } while (myCounter < found_paragraphs.length);
    // Apply paragraph styles
    myCounter = 0;
    do {
        change_first_list[myCounter].appliedParagraphStyle = change_first_paragraph;
        change_second_list[myCounter].appliedParagraphStyle = change_second_paragraph;
        myCounter++;
    } while (myCounter < change_first_list.length);
    alert("Done fixing pairs!");

    CS2 didn't support grep searches so you're going to have to do some serious reworking of the script. It's not a flick of the wrists.
    Dave

  • Can't open new document or save a document in CS2

    I can open InDesign CS2. When I try to open a document the entire window grays out. To activite ID again I must hit Esc. If I go to my explorer and click on an ID file it will open, once open I can work in it but after working when I try to "save," "save as," or "save a copy" the entire window grays out and nothing is saved. I can hit Exc and I am able to work in the document again but still can't save it. If I try to exit out of a new doc it will give the message asking if I want to save but when I say yes it grays out.
    I am working on a Windows XP, CS2 4.0.5, 1.5Gb RAM

    This is a common problem discussed here. It's caused by the open or save dialog opening off-screen, and is most often associated with using multiple monitors.
    I suspect doing a search for "multiple monitor" or "freeze" will probably turn up a number of threads that have all of the suggested ways to try to bring the dialog into view.
    Peter

  • InDesign CS5.5 freezing upon opening new document Lion 10.7.3?

    Hi there,
    When launching CS5.5 InDesign, I select 'New document'. After it is setup (1-2 seconds), it freezes and InDesign is non functional and you have to force quit.
    My console log states:
    CFURLCreateWithBytes was passed these invalid URLBytes: ‘/Applications/Adobe InDesign CS5.5/Adobe InDesign CS5.5.app/Contents/Frameworks’ (a file system path instead of an URL string). The URL created will not work with most file URL functions. CFURLCreateFromFileSystemRepresentation should be used instead.
    The freeze occurs in the admin account and logged in domain user.
    I have tried updating InDesign- nothing.
    Uninstalling through Adobe uninstaller and reinstalling- nothing.
    Not using plugins. We are using Extensis Universal Type Client but I wuit it and turned off the Core to see if that helps- nothing.
    Ive repair permissions- nothing
    Rebooted- nothing
    I ended up upgrading to CS6 and had no problems. I would like to resolve this CS5.5 issue though. Any help?

    I copied Mac OS: [Startup Disk]/Library/Applications Support/Adobe/SING/Mark II/Datastore to the desktop and deleted it from that directory. Did the same for the Mark II folder (Solution 2)
    -Failing that the first time, I uninstall/reinstall and didnt bother to update, which is why you see the original InDesign. I'll try and update InDesign and move to 10.7.4 to see if that does anything. My
    Mac OS: [Startup Disk]/Library/Applications Support/Adobe/SING/Mark II/Datastore does not currently have these folders because I took them out. Maybe I'll run the crash report again and post it. I have to wait for the designer to finish for the day. I'll update possibly tomorrow.
    Thank you!

  • InDesign is crashing  while opening a new document

    Hi All,
    I want to open a new document from InDesigm CS2.When I open a new document from File->New->Document from menu ,InDesign is crashing and giving error report.
    It is not happening in the case when I open existing documnet from
    File->Open.
    Existing document is opening without any problem.
    How can I get rid of this surprising problem ?
    Can it be due to some missing PlugIn??

    Check for Third Party plugins. Make sure that you only have plugins that come with InDesign application. Remove custom/sample plugins and try again.
    If the above doesn't work, delete InDesign preferences (at C:\Documents and Settings\...\Application Data\Adobe\InDesign).
    Regards,
    Narayan

Maybe you are looking for