How to create, place, format and paste the clipboard contents into a text frame

I am new to scripting and need help. I have an existing Indesign document. I need to be able to create a text frame on my current page, the width of my margins with the top of the text frame at the top margin and 1" in height, then format it to be 1-column, and then paste the clipboard contents into it and tag the text with a particular paragraph style. I am using Indesign CS4 on a mac, if that makes any difference. Thanks for any help.

May this will help you. It will create an anchored object with a text what you desired, with object style. You should create an object style before with the x and y co ordinates. You can choose either para style or character style.
var the_document = app.documents.item(0);
// Create a list of paragraph styles
var list_of_paragraph_styles = the_document.paragraphStyles.everyItem().name;
// Create a list of character styles
var list_of_character_styles = the_document.characterStyles.everyItem().name;
// Create a list of object styles
var list_of_object_styles = the_document.objectStyles.everyItem().name;
// Make dialog box for selecting the styles
var the_dialog = app.dialogs.add({name:"Create anchored text frames"});
with(the_dialog.dialogColumns.add()){
with(dialogRows.add()){
staticTexts.add({staticLabel:"Make the anchored frames from ..."});
with(dialogRows.add()){
staticTexts.add({staticLabel:"This character style:"});
var find_cstyle = dropdowns.add({stringList:list_of_character_styles, selectedIndex:0});
with(dialogRows.add()){
staticTexts.add({staticLabel:"Or this paragraph style:"});
var find_pstyle = dropdowns.add({stringList:list_of_paragraph_styles, selectedIndex:0});
with(dialogRows.add()){
staticTexts.add({staticLabel:"Leave one dropdown unchanged!"});
dialogRows.add();
with(dialogRows.add()){
staticTexts.add({staticLabel:"Delete matches?"});
var delete_refs = dropdowns.add({stringList:["Yes","No"], selectedIndex:0});
dialogRows.add();
with(dialogRows.add()){
staticTexts.add({staticLabel:"Anchored text frame settings:"});
with(dialogRows.add()){
staticTexts.add({staticLabel:"Object style:"});
var anchor_style = dropdowns.add({stringList:list_of_object_styles, selectedIndex:0});
with(dialogRows.add()){
staticTexts.add({staticLabel:"Frame width:"});
var anchor_width = measurementEditboxes.add({editUnits:MeasurementUnits.MILLIMETERS, editValue:72});
with(dialogRows.add()){
staticTexts.add({staticLabel:"Frame height:"});
var anchor_height = measurementEditboxes.add({editUnits:MeasurementUnits.MILLIMETERS, editValue:72});
the_dialog.show();
// Define the selected styles
var real_find_cstyle = the_document.characterStyles.item(find_cstyle.selectedIndex);
var real_find_pstyle = the_document.paragraphStyles.item(find_pstyle.selectedIndex);
var real_anchor_style = the_document.objectStyles.item(anchor_style.selectedIndex);
// Check if a style is selected
if(find_cstyle.selectedIndex != 0 || find_pstyle.selectedIndex != 0) {
// Define whether to search for character styles or paragraph styles
app.findChangeGrepOptions.includeFootnotes = false;
app.findChangeGrepOptions.includeHiddenLayers = false;
app.findChangeGrepOptions.includeLockedLayersForFind = false;
app.findChangeGrepOptions.includeLockedStoriesForFind = false;
app.findChangeGrepOptions.includeMasterPages = false;
if(find_cstyle.selectedIndex != 0) {
app.findGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.appliedCharacterStyle = real_find_cstyle;
} else {
app.findGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.appliedParagraphStyle = real_find_pstyle;
app.findGrepPreferences.findWhat = "^";
// Search the document
var found_items = the_document.findGrep();
myCounter = found_items.length-1;
do {
// Select and copy the found text
var current_item = found_items[myCounter];
if(find_pstyle.selectedIndex != 0) {
var found_text = current_item.paragraphs.firstItem();
var insertion_character = (found_text.characters.lastItem().index) + 1;
var check_insertion_character = insertion_character + 1;
var alt_insertion_character = (found_text.characters.firstItem().index) - 1;
var the_story = found_text.parentStory;
app.selection = found_text;
if(delete_refs.selectedIndex == 0) {
app.cut();
} else {
app.copy();
} else {
var found_text = current_item;
var insertion_character = (found_text.characters.lastItem().index) + 2;
var check_insertion_character = insertion_character;
var alt_insertion_character = (found_text.characters.firstItem().index) - 1;
var the_story = found_text.parentStory;
app.selection = found_text;
if(delete_refs.selectedIndex == 0) {
app.cut();
} else {
app.copy();
// Make text frame from selection
try {
app.selection = the_story.insertionPoints[check_insertion_character];
app.selection = the_story.insertionPoints[insertion_character];
} catch(err) {
app.selection = the_story.insertionPoints[alt_insertion_character];
var the_anchored_frame = app.selection[0].textFrames.add({geometricBounds:["0","0",anchor_height.editContents,anch or_width.editContents],anchoredObjectSettings:{anchoredPosition: AnchorPosition.ANCHORED}});
app.selection = the_anchored_frame.insertionPoints[0];
app.paste();
// Apply the object style now to "force apply" paragraph style set in the object style
if(anchor_style.selectedIndex != 0) {
the_anchored_frame.appliedObjectStyle = real_anchor_style;
myCounter--;
} while (myCounter >= 0);
} else {
alert("No styles selected!");

Similar Messages

  • I am writing an applescript and want to paste the clipboard contents into a new file that opens in TextMate. This is what I have so far. The paste is NOT working...

    This is what I have so far:
    tell application "Google Chrome"
      view source of active tab of window 1 -- Or whichever tab you want
      delay 3
              repeat while loading of active tab of window 1
      delay 3
              end repeat
      select all of active tab of window 1 -- Must *always* be the active tab
      copy selection of active tab of window 1
      delay 3
      --          delete tab (active tab index of window 1) of window 1
    end tell
    delay 1
    tell application "TextMate-1.5.9"
      activate
      open
      paste
    end tell
    Paste is not working.

    This works, I am sure that there is a more elegant way??
    # Applescript to copy html of active tab to clipboard and open TextMate and paste source to new document
    tell application "Google Chrome"
              set theURL to URL of active tab of window 1
    view source of active tab of window 1
    delay 3
              repeat while loading of active tab of window 1
      delay 3
              end repeat
    select all of active tab of window 1 -- Must *always* be the active tab
    copy selection of active tab of window 1
    delay 3
    end tell
    do shell script "open -a TextMate"
    delay 3
    tell application "TextMate"
    open
    activate
              tell application "System Events"
      keystroke "a" using {command down}
      keystroke "v" using {command down}
              end tell
    end tell
    tell application "Google Chrome"
    delete tab (active tab index of window 1) of window 1
    end tell

  • How do I activate mozzilla acct,I am asked to activate account, click the link or copy and paste the whole thing into your browser's location bar

    welcome to support.mozilla.com
    before you can use your new account you must activate it-this ensures the e-mail address you used is valid and belongs to you.To account,click the link below or copy and paste the whole thing into your browser's bar:
    https://support.mozilla.com/en-US/users/actiate/656ec47229 etc.
    tell me how to do this, if possible.

    '''waiting for reply, will there be a reply?'''

  • IDCS6(MAC) 10.9.4 - a script that will make an anchored object and paste in clipboard contents

    I'm trying to create a script that will create an anchored object that will paste in clipboard contents.
    So far I have:
    var frameRef = app.selection[0];
        var parentObj = frameRef.insertionPoints.item(0);
        var anchorFrame = parentObj.rectangles.add();
    And this works fine, creating an inline object, that can further be defined (with anchor point settings etc).
    However, it is when I go to use app.paste() or app.pasteInto() that all hell breaks loose.
    The line of code I added was:
    anchorFrame.content = app.pasteInto();
    and the error I get is:
    What am I doing incorrectly?
    Colin

    @Colin – For the paste command you like to use, you have to:
    1. First select an object, in your case the added rectangle object
    2. Then use the pasteInto() method from the app object
    3. There is no content property for a rectangle object
    Watch out what is selected after you added the rectangle.
    What you have is a selection of the text frame when you start your code in line one.
    Adding a rectangle will not change that selection.
    The following code will do the job.
    However, if you use pasteInto() the pasted objects could be only partly visible inside the frame.
    Depends on the size and position of the added rectangle relative to the original copied page items.
    Make sure that you give the rectangle a proper size after or while you are adding it:
    var frameRef = app.selection[0];
    var parentObj = frameRef.insertionPoints.item(0);
    //Will add a rectangle sized 40 x 40 mm
    var anchorFrame = parentObj.rectangles.add({geometricBounds:[0,0,"40mm","40mm"]});
    app.select(null); //Optional
    app.select(anchorFrame);
    app.pasteInto();
    Uwe

  • How to create invoice, Order and pay the invoice

    Hi,
      I'm new to FI, so can anyone tell me how to create an Order, an invoice for the Order and then pay for the invoice.
    Please provide me the transactions and the steps to do the above three process.
    Thanks in advance.
    Swaroopa

    Create sales order
    http://help.sap.com/saphelp_erp2005/helpdata/en/dd/55fbe0545a11d1a7020000e829fd11/content.htm
    Create production order
    http://help.sap.com/saphelp_470/helpdata/en/b1/c03f5b439a11d189410000e829fbbd/content.htm
    Create Invoice
    http://help.sap.com/saphelp_470/helpdata/en/dd/561009545a11d1a7020000e829fd11/content.htm
    Create delivery
    http://help.sap.com/saphelp_470/helpdata/en/dd/56078c545a11d1a7020000e829fd11/content.htm
    Hope this’ll give you idea!!
    <b>P.S award the points.</b>
    Good luck
    Thanks
    Saquib Khan
    "Some are wise and some are otherwise"

  • Is there any way to just copy and paste the musical contents of my phone to a playlist?

    Since my phone has issues and I often have to reset it and it takes about two hours everytime I have to sort through my library and pick out what I want on my phone? I realize I could just make a master playlist. I'm talking about right now, since I have to once again reset to get rid of several gigs worth of "other" that's clogging up to works.

    I copied text & paisted it and then draged the 3 photos from the file...then clicked on the photo then clicked the inline boxon tool bar nexed to floating one and that is how I did it
    I do not know what you mean "cut & paist"  how do I get the photo in from my picter folder if I do not drag it to the page in Pages? 
    I went to my photo folder and copied a photo and paisted the photo on the top left part of the page and it went there but there was no text to the right of photo...I could crop the photo to what ever size but no text to the right of photo...
    This is just too big of a mess of a program as it should be easier then this,,,I hav e 300 photos in this project and would have to re-paist them all...that is nuts...
    I see the button to the right of inline and floating that has 6 [lace to have the photo but the text does not float around the photo...
    If this is what your talking about this very little freedom in my page layout as I need it to let me place it where I need it to be and the wrap the text...
    There has to be an easier way to get my books ready for other formats other that Apple's iPad...iBooks Author was way eisier to make ready for iTunes...Love that program!!!
    Want my books for sale on all the other formats and was told by Apple Pages whould do it...
    I must be be out to lunch or the designers at Apple are ???

  • How to: Create a folder directly under the KM content 'Root' directory

    I need to create a new folder directly under the 'root' directory of the KM content...
    If I go to the KM root directory and click on any of the folders in it, I can create new folders.
    For example: clicking on the 'documents' folder. Opening it, I can create new folders by clicking on 'Folder' --> 'New' --> 'Folder'.
    However, when I am in the root directory itself, the only option under 'Folder' is 'Clipboard'.
    How can I create a new folder under the Root? Am I missing a role?
    Cheers,
    Edwin.

    You cannot create a folder under root directory
    all the folders that you are seeing under root are  KM Repositories.
    You need to create a repository and then in that you can create a folder structure.
    As an example Documetns is a standard SAP KM repository. You can also create your own repository under
    system admin-> system configuraiton->KM->CM-> Repository Managers
    There you can get options of creating the repositories
    Hope it is clear
    also check the below thread that will help you
    http://help.sap.com/saphelp_nw70/helpdata/en/e3/923224b24e11d5993800508b6b8b11/frameset.htm
    Raghu
    Edited by: Raghavendranath Garlapati on Jul 16, 2009 9:39 AM

  • How to Create a Page and provide the Page link in personalisation.

    Hi Techies,
    I have unique requirements as follow ...
    On a Page , We need to create a Link. After clicking this link , the control should open a new page and the new page details need to shown.
    I did the following ,
    1. Personalized the page. Added a new Item of the Type "Link". In URI filed I gave an existing page ( for testing ). It was working fine. But When I gave my actual page which I created in HTML(*.html extension ) , which did not worked.
    Can not we provide *html page in the URI filed of the Item type Link.
    Please help me in resolving this.
    Thanks in Advance
    Regards
    Raghu

    Guys one update if you want to create a link for a PDF file to show on to your browser use the below method.
    I used this below method for bringing the PDF file ( the file which business want to show on browser ) using the below steps.
    1. Created a Link using personalization.
    2. Provided target frame as "New Window".
    3. Provided URI : FileName.pdf.
    Note that the FileName.pdf should be kept in the $OA_HTML Path on the Unix box. The Personalization would look for the file in the path of $OA_HTML and display in the other browser which is a full file. I did not get Home and Logout buttons over there. So I suggest you to use if you in need of Loading an informative page on the Browser.
    Raghu

  • Help: How to create a query that transpose the column content?

    Here, suppose that I have two tables
    TAB_A:
    ID     TYPE
    1     AA
    1     AB
    1     AC
    2     BA
    2     BB
    2     BC
    2     BD
    I'd like to create a query that gives result as:
    ID     TYPE
    1     AA AB AC
    2     BA BB BC BD Any suggestions?
    Thank you in advance.
    Jimmy

    Hi
    Try this:
    SELECT id,
    replace(LTRIM(MAX(SYS_CONNECT_BY_PATH(type,'*'))
    KEEP (DENSE_RANK LAST ORDER BY curr),'*'),'*', ', ') AS type
    FROM (SELECT id, type,
    ROW_NUMBER() OVER (PARTITION BY id ORDER BY type) AS curr,
    ROW_NUMBER() OVER (PARTITION BY id ORDER BY type) -1 AS prev
    FROM tab_a)
    GROUP BY id
    CONNECT BY prev = PRIOR curr AND id = PRIOR id
    START WITH curr = 1;
    Ott Karesz
    http://www.trendo-kft.hu

  • TS1292 Click on the link above or copy and paste the following address into your Web browser to view the article:

    I want to retrieve On iTunes consisted 

    I don't know what you are asking, but judging by the page that you posted from then I assume that you are having problems with an iTunes gift card. If you are then was the card issued in the same country as your account is based ? They are only valid in their country of issue. If it was and the page that you posted from doesn't help then you will need to try contacting iTunes support (you will need to give them as much of the serial number and activation code from the card as you can read) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then iTunes Cards And Codes

  • To view the file, click the link or copy and paste the following URL into your web browser.

    The file does not display. When I click on the link, I do see the file anme and a comment box. But not the file, which is a one page InDesign file.
    This is the link...
    http://adobe.ly/1ooe2uw
    I have entered a comment and it does appear.

    Where did you find this link?

  • [b]HOW TO:[/b]  Copy and Paste THE Filename AND its PATH from Finder

    HOW TO DO THIS: Copy and Paste THE selected Filename AND its entire PATH from Finder to another application as in document footer reference, or document database which has a path field to aid in locating the file later.
    Finder, Spotlight and File Info (can be used to display Path) or using Command F, command I, etc. but user is not allowed to copy the path to clipboard.
    This is rudimentary, yet the word Path, is unknown to Mac Help.
    Message was edited by: jbov

    AJ,
    Isn't it amazing....There is no Command Key for this action? Apple Care was confounded too. And thanx, it'll be a help....
    Jim
    its tedious, but this should work:
    open a terminal window.
    Drag and drop the icon for the file in the terminal
    window.
    This will put the full path including the filename on
    the command line.
    Copy the path from the command line, and paste
    (wherever).
    Close the terminal window.

  • How to create portal user and integrate with external appl login

    How to create portal user and integrate the user with external application for single sign-on ?
    I want to access my external application thru portal user ..?
    Shyam

    Hi Jithin,
    The link that you've shared talks about a different scenario.
    In my case, I want to pass the portal user id when the user clicks on the Help Link present in the header area.
    I am trying to pass it along with the Help Link Url property of a masthead iview but it is not getting passed to the target Url.
    I would like to know if it is possible to pass the Portal User Id in this way or not.
    Though if we create a appintegrator iview and pass the user id <User.UserID> along with the target Url, it reaches there.
    Thanks & Regards,
    Anurag

  • When I click on an email link on a website it doesn't open my entourage mail, I have to cut and paste the email address in

    When I am looking at a website and it says contact us with an email address, in the past when I click on this my entourage 'new mail' page would open so I could contact them, but know that doesn't happen and I have to cut and paste the email address into entourage manually, sometime this is not possible becuase the website doesn't actually give the email address just a 'click here' option

    See this:
    [http://support.mozilla.com/en-US/kb/Changing+the+e-mail+program+used+by+Firefox]

  • I bought a gift card, but it hasn't shown up in my e-mail after 1 hour.  How can I find it and get the credit on my account?

    I bought an iTune gift card for myself and sent it to my e-mail address.  I have waited over an hour and the e-mail showing the gift card has not arrived.  How do I find it and get the credit put into my iTunes account so that I can buy some music?

    Oh hold on - sudden development!
    I panicked and force-shut down my computer because it froze after I clicked on the 'Reset Cache' option, then I logged back on and noticed the Cloud symbol next to the missing song. I clicked it, and it's finally downloaded properly! <3
    Mate, thank you so much for helping me out! xxx

Maybe you are looking for

  • Gradient as a Table Background Works, but Color is Wrong

    Hi: I've created gradients in Web pages as well as in tables in Web pages, but I can't seem to get it to work properly in WebHelp. I can get the gradient to display in a table, but the colors are not right--it is dark blue to black (close to my skin

  • Input for Organization Structure finilization.

    Hello Experts I have to implement the organization structure of company for that I need some input from experts. In plant A Example Process 1 in plant A Raw Material = RM1 Raw Material = RM2 From this we produce Semi Finish Good = SFG1 Process 2 in p

  • HT1386 error message 1140 when syncing new iphone 5

    Everytime I sync my iphone to my computer I receive error message 1140  which says my iphone cannot be synced

  • Synergy on Mac OS X Lion

    Yet another question about Lion.  This is about Synergy, a neat little program that lets you use one mouse and keyboard on two computers (mac, linux, pc, etc..) for multiple computers, through the network.  I want to use a mouse and keyboard connecte

  • Album Art does not appear unless I buy from iTunes

    I imported hundreds of cd's into my iTunes library and I noticed that the album art was not appearing. The only album art that appears on my color iPod is from the songs that I purchase from iTunes. Can anyone tell me if I can get the album art from