Inserting text into a Pages document with Applescript

I want to create a Pages document from a custom template but be able to insert text at various points in the document (inputted data under headings etc). I would like to use Applescript but cannot get insertion points to work, is this possible? As usual, all help gratefully accepted.

I have made a Pages template that contains tables and I want to enter text into sections of these tables
That's a completely different story! But that's still possible using GUI Scripting. Here's an example:
tell application "Pages"
    activate
    select table 1 of body text of front document
    tell application "System Events" to tell process "Pages"
        set theWindow to window 1 whose role description is "standard window"
        click button "Table" of tool bar 1 of theWindow
        keystroke "Cell A1"
        keystroke tab
        keystroke "Cell B1"
        key code 125 -- down arrow
        keystroke "Cell B2"
        -- and so on
    end tell
    select insertion point after table 1 of body text of front document
end tell

Similar Messages

  • How do I insert checkboxes into a Pages document?

    I have been trying to insert checkboxes into a document I created using Pages version 2.4.2 on my iPad Air. I would like an actual checkbox (not just the image of an empty box) so that a checkmark will appear once it has been selected. I am able to do this with the "Numbers" app, but I cannot copy and paste those check boxes to a Pages document.
    I want to use this document as a form I can easily access and print with checkboxes. I have only found a way to insert bullets, but not checkboxes that you can click on with your finger and a check mark appears in the checkbox.
    Thank you!

    I think you are misunderstanding "Insert text at cursor". The ANNOTATIONS are not text editing tools, rather they are tools for people making comments to "mark up" documents. You use "Insert text at cursor" to tell the document author you want HIM OR HER to insert text at that point; the author reviews all the comments and changes the original.
    You need to use one of the OTHER methods mentioned to actually add text. Probably simplest is the typewriter tool, which in Acrobat X is under TOOLS > CONTENT and is called ADD OR EDIT TEXT BOX.

  • Can't insert text into web page plus script error message

    I'm using CS3 and, on a fairly regular basis, when I am either pasting or inserting content (usually a newsletter of 500-1000 words), I get a message saying something like I can't insert text in this area. I definitely can insert text in the area as I have done it tons of times before. I sometimes have to cut and past a doc line by line to get it to insert. Very frustrating!
    Also, just recently, I've been getting a script error message, "An error has occurred in the script of this page" followed by Line: 992, Char: 106, Error: Unterminated String Constant, followed by the question: Do you want to continue running scripts on this page? I click Yes and everything seems to work fine.
    Help on either would be appreciated.
    Thanks in advance.

    You might want to make sure you are trying to copy plain text. It's possible that if you are copying from a Word document or another Web site that you are bringing along extra unseen code it doesn't like.  Try copying into Notepad first and then copying from Notepad into Contribute.  Not sure if that's the problem or not, but that's what came to my head first.
    I used to get an error that sounds similar (however it's not reproducing the error for me right now) to your error.  It was because some of my users had javascript menus on their page that Contribute didn't like.  However, if worked fine when you clicked yes and it was fine once it was published.   So if you are running a script that's probably why and I wouldn't worry too much about it as long as you can continue working and the page displays to your users correctly once published.  It's just annoying.
    Hope that helps.  Good luck.

  • Insert a numbers sheet into a pages document?

    I've got a worksheet in Numbers that I would like to integrate into a Pages document. Later versions of Word allow you to actually insert an Excel "object".
    Is there a similar technique with iWork '08? I tried copying and pasting the cells from the sheet and while it seems to accomplish what I need, the fact that I can't reorient the page to landscape causes the content to be pretty squished. For some reason I can't rotate the pasted content via the Metrics Inspector either.
    Any thoughts on this?
    Thanks,
    Mike

    Thanks, that fixes the orientation problem.
    Once the spreadsheet cells are pasted into the pages document, can you edit them like a spreadsheet? I clicked on it and it rotated it back for me (which is nice) but I don't see how to do something like "insert row" etc.
    What is the best suggested practice with iWork '08 when it comes to managing an uber-document that is really a combination of text and complex spreadsheets. Is it best to create/maintain the Pages and Numbers stuff in separate files until you are ready to publish the document? Can a Pages document "link" to a Numbers table?
    Thanks,
    Mike

  • I have upgraded to Pages 5.0.1 and now I cannot print or pass along "comments" in the text of a document. I previously was able to convert the Pages document, with comments, to a "Word" document so that others could view the edited text. How do I do that?

    I have upgraded to Pages 5.0.1 and now I cannot print or pass along "comments" in the text of a document. I previously was able to convert the Pages document, with comments, to a "Word" document so that others could view the edited text. How do I do that?

    When you installed Pages v5, it automatically moved the older Pages ’09 v4.3 into /Applications/iWork '09 folder. If you want normal comment interoperability, you are advised to resume using the older version of Pages. Newer, is certainly not better with Pages v5.

  • How do I turn selected text in a Pages document into two columns without turning the whole document into two columns?

    How do I turn selected text in a Pages document into two columns without turning the whole document into two columns?

    Menu > Insert > Layout Break (before and after text) > click in text > Inspector > Layout > Layout > columns: 2
    Peter

  • Input time into Pages document with Automator or Grammarian Pro

    Is there a way (VERY NEWBIE) to have Automator input the time into a Pages document when I press a function key or another key combination? Or can Automator do it with Grammarian Pro? I write all day, and inputing time can get tedious. I have tried all the help files on Automator and have even experimented but to no avail.
    Any help would be appreciated.
    Thanks, Paul

    Do you mean other than using Pages to input the time?
    Did you know about the Insert menu in Pages? In the Insert menu there is an option for "Date & Time…" that will allow you to insert it using various formats, and offers to update it every time the document is opened.
    If you want a keyboard shortcut for a menu item, then open System Preferences and go to the Keyboard & Mouse settings. In there, you can define your own keyboard shortcuts for menu items of a specific application or all applications.
    If a menu item has an ellipsis "..." then you'll likely need to type that as one character. You can either use the system wide Character Palette (often found in the Edit menu as "Special Characters…"), or you can simply type Option-; by holding the Option key and pressing the semicolon key.

  • Inserting Text into a web page

    I need to know how to insert text into a webpage, like google, search, and then get the result.
    Using the wonders of the internet I have been able to display a webpage, and see the HTML code that is generated, however, I don't know how to insert text into a web page, or get the result.
    Any help, or pointing into the right direction would be appreciated.

    What do you mean by insert into web page? Like
    prefill data on a form?
    Or like a search on google? What are you using to
    do this?
    I am guessing based on the info you gave in your
    question, that you might want to just look at the url
    of the page. For example search on google and you
    will see the text entered into the search field
    inside the url. Learn from that and develop a url
    that will search for the text you want to insert.
    If I am not understanding you, please clarify.Right now, I'm using the URL to search for me, which will work, but the search can be different from website to website, and I would like something closer to an automated form filler if I need to implement something like this again.
    Of course, something like an automated form filler would probably work better, if I were able to retreve the results

  • Inserting Form Fields in Pages Document

    Does anyone know if it is poossible to insert a form field into a pages document just like what can be done is a Word document?  I would like the ability to develop a template that has some drop-down menus throughout the document (for different variables) so I can reuse the template in various scenarios by simply selecting the appropriate info from each menu. 
    Example:
    "Your time horizon is Menu Choice  (drop-down with: 1 year, 3 years, 5 years, greater than 10 years).
    I'll I've been able to find is the mail merge feature.  But I'm not looking to merge data from my contacts. 

    No you can't lock the document. If you even lock the textboxes you can't type into them.
    I'm a supposed expert (I use countless DTP apps) and I don't find Pages easy at all. In fact for many tasks it is quite a kludge.
    But the templates are nice.
    Peter

  • How do I rotate a PDF that I dropped into a Pages document?

    I got a PDF off the internet that is just what I need. But it is orientated incorrectly. So, how do I rotate it in my Pages document?
    OR, if this is not possible, how can I rotate individual lines of text within my Pages document so that the correspond with the PDF?
    Can I do this simply by using the Pages toolbar? I honestly don't know that I am capable of downloading a program off the internet, as I have tried this before for other things and the process has always gone +very awry+. Any SIMPLE solutions would be appreciated, as I am very challenged when it comes to using computers.
    Thank you

    Hi Tom,
    Some late comments that may help.
    I went to the link in your post and opened the pdf file in Safari. Judging by the icons for the available controls, Safari was using the Adobe Reader plug in, which does will display thumbnails of the original pages, but will not allow you to select or copy a single page.
    I went File > Save as, and saved the pdf file to the desktop, then opened the file using Preview (control click or right click the file icon and choose Open with > Preview.
    Preview displays the page thumbnails by default, allows you to select a single page by clicking its thumbnail, and allows you to Copy that selected page.
    Which is what I then did.
    I scrolled to Page 16, clicked on the thumbnail to select it, pressed command-C to copy.
    I then went to Pages, where I had already created a new document from one of the Blank word processor templates.
    I clicked in the document, then pressed command-V to paste the copied page into the document. It pasted (as expected) as an Inline object, so I went to the Format bar (above the page) and clicked Floating to change the pasted (and still selected) drawing to a Floating object.
    Then I opened the Inspector and chose the Metrics Inspector (ruler icon).
    At the bottom of the Inspector window, I changed the 0 in the Rotate Angle box to -90, then pressed tab to effect the change.
    In the Size section, I checked that the Constrain Proportions box was checked, then used the stepper controls on one of the Size boxes to resize the drawing to fit the width of the page. As the proportions were constrained, this also adjusted the height of the drawing. While adjusting the size, I also used the steppers of the X and Y position boxes to position the drawing where I wanted it.
    Finally, to ensure that text did not slip under (or over the face of) the drawing, I switched to the Wrap inspector and selected one of the Wrap buttons.
    The keys here are to make sure the object remains selected through the whole process (or is re-selected if it becomes unselected), and to make sure you are working with a Floating object (the drawing) rather than an Inline object.
    Regards,
    Barry

  • Getting Page count with AppleScript

    Hi Everyone,
    It been a long time since I visited so I hope everyone is well.
    Does anyone know how to get the page count of a document with Applescript. The best I've done is to divide the total number of words by the average amount of words on a page. This isn't perfect but it give me something close. I'm using the following snippets to get the info, which is being used to popular real time statitics about the progress of book four on my website.
    set WordCount to word count
    set ParagraphCount to paragraph count
    set PageCount to round (WordCount / 184)
    set CharacterCount to character count
    Paragraph count doesn't seem to come too close either. I think it just adds up the number of carridge returns in the document.
    Cheers
    Chris
    http://www.thomasstrange.com

    <pre>tell application "Pages"
    tell document 1
    page count
    end tell
    end tell</pre>
    For me, the result matches the actual number of pages.
    As for paragraph count, I assume you want to skip empty paragraphs.
    The obvious "length of paragraph 1" doesn't seem to work, so here's a less than optimal solution:
    <pre>tell application "Pages"
    tell document 1
    tell body text
    set paragraphCount to 0
    repeat with aParagraph in every paragraph
    if length of (contents of aParagraph as text) > 1 then
    set paragraphCount to paragraphCount + 1
    end if
    end repeat
    end tell
    end tell
    end tell
    paragraphCount</pre>
    Titanium PowerBook   Mac OS X (10.4.10)  

  • Copying a google map into a Pages document

    I was wondering if anyone knows how to copy a google map into a Pages document? I am creating a real estate flyer, and would like to include a map on the back. I know how to insert a Google map using the Widget in iWeb, but not using Pages. Any help is greatly appreciated!

    You can take a screensnap of the map: +cmd shift 4+ and drag over your selection. The snap lands on your desktop named +Picture 1+ etc.
    Make sure you enlarge the map as big as possible on the screen as it is only at screen resolution, 72dpi, and you need about 300dpi for printing.
    Usually it is better to draw a simplified diagramatic map for directions in a vector drawing program like OmniGraffle, VectorDraw, ZeusDraw, EazyDraw, LineForm, Intaglio or Illustrator. Bring these in as .pdf files which are freely scalable.
    Pages also has drawing tools at the bottom of the Shapes pulldown menu on the ToolBar but it is cumbersome compared with the dedicated programs.
    Peter

  • Is there a way to import a .pdf into a pages document and have it wrap to a 2nd page?

    Is there a way to import a .pdf into a pages document and have it wrap to a 2nd page?

    Are we talking about a spread? ie the pdf spans 2 pages side by side? Like in a magazine centrefold.
    That requires you to insert the pdf on both pages, one hanging half over to the right and the other half over to the left.
    Peter

  • I am trying to type a password into a Pages document. The number goes in OK but when I hit return or any other key the numbers get transposed. What happens and how do I corret it?  Thanks

    I am trying to type a password into a Pages document. It types in OK, but when I press return or close the document some of the letters in the password get transposed. What happens and how can I fix this? Thanks.

    Are you just typing ordinary text into a word processing document or are you trying to set a password on the document itself?
    If it is the first perhaps Pages is trying to spell check the password. You can tell it to ignore that "word", or turn spellchecking off.
    Peter

  • Help converting pages document with images over to a 300 dpi jpg file

    Hi
    I'm pretty new to using Pages.  I have created a 4 page Pages document with a lot of iphoto images.  It's for a elementary school yearbook.  The publisher ulitmately needs a 300 dpi jpg file.
    How do I convert the pages document into a 300 dpi jpg?
    I tried to convert it first to a pdf then to a 300 dpi jpg but when I sent that file over, they said that when they zoomed in, the images all looked blurry.
    Any ideas on what to do without having to start all over again?  Worst case, I guess I can print out in best quality, scan and save as jpg but there's got to be an easier way.
    I'm not a graphic designer, just trying to fuddle my way through so you'll have to go easy on me with the techno speak.  Any cliff notes for mac beginners?
    Thanks much in advance for any help!

    The conversion isn't perfect between Pages and Word. The same font is handle differently in the two applications and so are many other things too. If you are concerned about how it looks use Pdf versions instead.

Maybe you are looking for