AppleScript - Delete specific words in a Pages document?

Hi All,
What would be an AppleScript to find and delete words in the whole document...
I want to delete all words such as " red " and " orange ".
Thanks in advanced

See this post.

Similar Messages

  • Import warning when sending Word version of Pages document as attachment in Mail

    when sending Word version of Pages document in email, says character borders not supported so were removed, so email didn't have all of the text of the Pages document

    Not that I know of. Would be less practical than the option coming from Pages -- everyone using Pages probably has some default email client, but far from everyone using Mail would have iWorks and Pages. So building in the feature to Mail not so practical.
    Ernie

  • AppleScript to run on ALL opened Pages document instead of Active one.

    Hello,
    I have many AppleScript i'm running on the active Pages document... but If I would like to run the Script on ALL opened Pages document?
    What would be the line to add/modified at the top?
    Thanks in advance...
    Example of a script running on the active Pages document.
    set theTargetWords to {"www.network"}
    tell application "Pages" to activate
    tell application "System Events" to tell process "Pages"
      -- Open the "Find & Replace" window:
      keystroke "f" using command down
         repeat until exists window "Find & Replace"
         end repeat
         tell tab group 1 of window "Find & Replace"
      -- Adjust the settings:
      click radio button 2 -- Advanced
              if value of checkbox 2 is 1 then click checkbox 2 -- Don't match case
              if value of checkbox 3 is 1 then click checkbox 3 -- Whole words
              if value of checkbox 1 is 0 then click checkbox 1 -- Search previous text (loop)
      click pop up button 1 -- find in
      click menu item 1 of menu 1 of pop up button 1 -- Entire document
      click pop up button 2 -- replace style
      click menu item 1 of menu 1 of pop up button 2 -- Any
      -- Delete every target word:
              set value of text area 1 of scroll area 2 to ""
              repeat with thisWord in theTargetWords
                   set value of text area 1 of scroll area 1 to thisWord -- the target word
                   click button "Replace All"
              end repeat
         end tell
    end tell

    I have many AppleScript i'm running on the active Pages document... but If I would like to run the Script on ALL opened Pages document?
    What would be the line to add/modified at the top?
    Try this:
    tell application "Pages"
        activate
        tell application "System Events" to set theOpenWindows to windows of process "Pages" whose subrole is "AXStandardWindow"
        repeat with thisWindow in theOpenWindows
            tell application "System Events" to tell thisWindow to perform action "AXRaise"
            tell front document
                -- ENTER YOUR CODE HERE
            end tell
        end repeat
    end tell

  • Putting Word Count in Pages Document

    Is there a way to insert a document's current word count directly into the body of the document? In other words, is there a way to do the equivalent of "Insert Page Number" or "Insert Page Count" for word count?

    PeterBreis0807 wrote:
    See *How to Insert Current Weather and Word Count into Your Document* p307 in the Pages09_UserGuide.pdf downloadable from under the Help menu.
    Peter
    It's dificult to read page 307 in a guide containing 266 pages.
    On page 37 I may read how to view word count and other document statistics but,
    - I saw nothing about current weather
    - I saw nothing about a way to insert the word count in the document as it was asked by the OP
    As far as I know,
    we may insert page num, page count, date time, file name
    but we only
    may display word count.
    Yvan KOENIG (from FRANCE mercredi 27 mai 2009 18:21:12)

  • I want to highlight various words in a pages document with a yellow or black box behind the text

    I want to use a highlighter in Pages. I know how to do it in steps.. but would like a shortcut to highlight various words throughout the document with a yellow or black box behind the text.. help

    I got another idea. Create a style with the text and background colour you want. You can apply a short cut for that style. Beware that the styles is only for that particular document but you can import styles or you can use Save as Template and keep it as a template.

  • Delete specific attachment from DMS document

    Hi Experts
    I have a requirement to delete specific attachments from a DMS document. I am using the FM 'CVAPI_DOC_CHECKIN' to create the attachments to the document. Im unable to figure out a way to delete a specific attachment from the document. Appreciate any help.
    Neo

    Have you tried with FM CV140_LINKS_DELETE ? and also check the Program MCDOKDEL you will get some FMs to delete documents
    Kanagaraja L
    Edited by: Kanagaraja  Lokanathan on Dec 7, 2010 10:37 PM

  • Convert Microsoft Word docs to Pages?

    I love Pages and want to convert a bunch of Microsoft Word docs into Pages documents. The action would open the .doc file in Pages, then save it as a Pages document with the same title.
    Is there anything that would let me do this? Thanks.

    I've tried that myself, to no avail.
    Here's what I've tried - if anyone can twiddle with this to make it actually work, I too would be grateful!
    1 find finder items
    2 get specified finder items
    3 copy finder items (to save originals)
    4 launch app (pages)
    but then there's no action for creating a new file or saving-as or anything...
    thanks and peace-
    DW

  • Opening a Pages document on a PC???

    Hi...can Microsoft Word open a Pages document??
    Wondering?
    R

    mac,
    Yes, Word can open a Pages document. But first you have to use Pages to Export it to Word format. Not a big deal. Just know that the more complicated the Pages doc is (i.e. text boxes, graphics, weird stuff), the less faithfully it's likely to be rendered in Word. But simpler docs do well.
    -Dennis

  • Opening a Pages document in Pages format results in a zip file

    Trying to print a Pages document from my iPad to a non-Airprint printer.  Want use HP's ePrint app.   Bring up "open in another app" -- and then I am asked to chose a format.  Chose Pages.  Then asked for an app.  Chose ePrint.  ePrint locates my non-Airprint printer, but cannot print.  Reason: the Pages document has tuned into a zip file (xxxxxx.pages.zip).   Why??   If I chose Word format, the Pages document becomes a docx file, and it CAN be printed by ePrint.  I do not understand what is happening here.  I also get a zip file if I try to use Dropbox.

    Well, to your curiosity once more, read that link I sent you again - this part in particular:
    While the Finder did not treat this file as a package (that is, no Show Package Contents command showed up in the document’s contextual menu), it was indeed a package. To pry it open, you could use a utility such as Pacifist. Inside, you’d find several items, most notably an index.xml file which contained the primary content you created.

  • Opening Word Files in pages

    Hi,
    Sorry if this has been asked before......
    I recently converted from PC to iMac and bought myself a copy of Pages as part of iWork which (for me) is much nicer than MS word. One question though, is there any rules about what you can and can't open in terms of PC created word .doc files? I did a bit of experimenting and found that files on a USB memory stick open fine but when I look at my old PC's files across the network I get a message saying unable to open. Do files need to be local i.e I need to transfer to my HD? Is there a setting I need to change etc.?
    Kind regards,
    Phil.

    i've had no problems opening word docs from any version including .docx in pages. however you can't save them in .docx format.
    i have also no experienced the problem you have with network files. i can open files on a network share in pages (be they word docs or pages documents) without issue.
    could it be someone was editing the word doc you tried to open or you opened the temp file created by doc for autosaving? i've noticed the new version of word on the pc does not do a good job of cleaning those temp files up and have tried opening a few of them myself.

  • Highlight words in html page set on editorpane

    hi everyone
    please help me quickely
    I have java application
    I could display html with hyperlinks on Jeditorpane
    but my problem is that
    i want to get specific word in this page
    to highlight it and display this html page with highlighted word
    can anyone solve my problem?
    thanks

    Thank you for the reply. I can understand if it was changed intentionally for some reason, though I can't think what that reason might be.
    I know that it definitely works fine in Firefox 21, and changed in Firefox22 and 23 (I tested the beta, aurora and nightly versions and the behavior is the same as 22 & 23 there too)
    I have attached two screen shots of what it looks like when I open a new tab on firefox 21 vs firefox 23. When I use a completely new profile (or even on a different operating system), the behavior is consistent as well, so I think this is definitely something that changed from 22 onwards. (link titles changed)
    I should add, this quite drastically changes the way I use firefox, because I am no longer able to use middle click to paste URLs or search terms into the URL bar. I might select the out put of an error message in a terminal and then just middle click to paste in the bar and hit enter to go from there.

  • In Pages document, how do I search for word and view its frequency and page numbers in a sidebar?

    I have a long document and I want to be able to search for certain key words and phrases, and then see how many times they appear in the document and exactly where.  How do I conduct this sort of search and viewing?  In the past, in Pages and Word, I've been able to view my "finds" in a sidebar but I can't figure out how to activate that service anymore.
    Thanks!

    Here is a word frequency concordance Automator Service that works in both versions of Pages. It does not present a page number reference. It is by descending count, and alphabetically, within the repetitive counts as shown in the image here. In any document, you select the text to process, then Menu > Application Name > Services > Frequency. The Service will open TextEdit with the n-pages of scrollable results. It is 16 pt Helvetica Neue for legibility.
    Here is the code:
    on run {input, parameters}
         try
              set mySelection to input as text
              set formatted_result to concordance(mySelection)
              if formatted_result is not null then
                   set textHeading to "Word Frequency List"
                   tell application "TextEdit"
                   activate
                         set NewDoc to make new document with properties {name:"Concordance"}
                         make new paragraph at beginning of text of NewDoc with data textHeading & return
                         make new paragraph at end of text of NewDoc with data formatted_result
                         tell text of NewDoc
                               set font to "Helvetica Neue"
                               set size to 16
                               set color of paragraph 1 to {0, 0, 65535}
                         end tell
                        end tell
              else
                        display dialog with title ¬
                         "No input selected" with icon stop ¬
                          giving up after 15
              end if
         on error errmsg number errnum
                    display alert ¬
                               "AppleScript Error" message errmsg & "[" & errnum & "]" as critical ¬
                                  giving up after 30
         end try
         return input
    end run
    on concordance(mySelection)
    -- Use Ruby to count word frequency and alphabetically sort words
        set rb to ¬
        "selected = String.new\nfreqs = Hash.new(0)\nselected = ARGV.join('  ').gsub(/[,.]/, \"\")\n
         words = selected.split(/[^\\w-]+/)\nwords.each { |word| freqs[word] += 1 }\n
         freqs_sorted = freqs.sort do |a,b|\n\t
         a.last == b.last ? a.first <=> b.first : b.last <=> a.last\nend\n
         freqs_sorted.each { |k,v| printf \"[ %8s ]          %s\", v, k }"
        do shell script "/usr/bin/ruby -e " & rb's quoted form & space & mySelection's quoted form
    end concordance
    Launch /Applications/Automator and choose New Document, then click the Service icon, and then select the Choose button.
    On the left, you will have a list of Libraries from which to choose workflow items. Find Library > Utilities. In the adjacent column, locate the Run Applescript workflow. Click on it, then drag and drop it in the large workflow window to your right.
    At the top, you can select Service receives text in any application. Leave Output replaces selected text unchecked.
    In your Run AppleScript workflow window, you will see AppleScript boilerplate. Click on it and press command+A, then backspace to delete this content. Copy and paste the above code into this Run AppleScript workflow window. Press the Run button in Automator's upper right corner. If (and it should) a TextEdit window pops up, you are good, and you want to press File > Save. A dialog box will pop-up where you can name your Service. I called my Frequency, you may wish to call it something else. Once you have save it, you can exit Automator. Services are deposited in yourlogin directory/Library/Services.
    If you have a Pages document open with text, either select it, or command+a to select the entire document. Now, you select your Service via Pages > Services > Frequency. This will now pop-up a new TextEdit document with the results. If you want to save this new document, you must use option+File to Save as...

  • Pages document saved as doc not readable by word

    Hi all,
    Lately I'm having trouble exporting my Pages documents to Microsoft Word format. I've tried the "Export" option directly available in the File menu, as well as the "Save as a copy" option in the Save dialog box. De document is correctly saved as .doc file and Pages can open, read and modify it, but I'm unable to open the exported document in Microsoft Word on my Windows PC. LibreOffice on my Linux PC does open the file, but doesn't show any of the content. Only some strange symbols are shown.
    I'm running Mac OSX Mountain Lion with Pages downloaded from the App Store, so everything is up to date.
    Does anyone have the same problem or know how to solve it?
    Thanks in advance!

    Since it's obviously not a Pages plist issue, I think more drastic measures are called for.
    The simplest would be to run the Mountain Lion 10.8.3 combo updater. In systems past, running the combo updater, even if it had been used before, can clear up some system odditites. It may work, but I think the problem is with Pages. Again, the simplest approach would be to delete Pages & reinstall it and run Software Update. I know you should get the most recent version from the Mac App Store, but this has helped others in the past.  The files to delete are the iWork ’09 folder from the main HD > Applications; the iWork ’09 folder in HD > Library > Application Support & the individual iWork application plist files found in HD > Users > (your account) > Library > Preferences for each user. The easist way to delete iWork '09 is to use Yvan Koenig's AppleScript that removes the files. You can find it on his box.com account in for_iWork'09 > other_iWork'09 items > uninstall iWork '09.zip.

  • How can I view and delete specific documents in iCloud?

    When I save a Pages document on my new iMac (Mountain Lion 10.8.2), the default location is iCloud. I have four related questions...
    1. How do I change the "Save" default location from iCloud to my iMac?
    2. How can I see what documents are stored in my iCloud account?
    3. How do I delete a specific document from iCloud once I have accidentally saved it there?
    4. How secure are the documents saved to iCloud?
    Thanks in advance for your help.

    Welcome to the Apple Community.
    Unfortunately, you can't if you are using iCloud.
    File > Open, from the appropriate application.
    File > Open. Select and delete.
    They are encrypted on the servers, if that's what you are asking. Your account is also password protected.

  • I was able finally to delete unwanted text boxes in my document; however, now my second page is missing and there are several following pages in a language that appears to be Latin.  What sin have I committed and how do I atone to get my second page back?

    I was able finally to delete unwanted text boxes in my Pages document; howver, the result is that the 2nd page of my document is missing and there are now several following pages in a language that appears to be latin.  What sin have I committed and how do I atone?

    10 marks for recognising the Latin (sort of) that is the placeholder text in your template.
    You are using a Word Processing template. WP templates have content flowing from page to page. As one page fills up, a new one is created. If some of that text is deleted or displaced the pages retract.
    When you combine text, invisibles like word spaces, returns, tabs, page breaks etc with objects that have text wrap set, the mix can behave in an apparent odd fashion.
    Start with showing where everything is:
    Menu > View > Show Layout/Invisibles
    Start with getting rid of any excess returns you may have used to "position" things. Next cut and paste objects like textboxes, shapes, charts and tables "Inline" ie in as part of the text. If necessary also turn off text wrap on objects or minimise it so that doesn't push text completely out of the way.
    Insert Section breaks in the Text where you want fixed breaks in the layout these will provide separation between layout on different pages.
    Basically you need to clean up your layout or think about doing it another way.
    If there is a lot of layout, you will need to learn Pages methods for doing this in a WP template or do it in a Layout template where each page is individual and all objects are floating with no default text area.
    Peter

Maybe you are looking for

  • Calendar - possible to disable "smart" event details in titles?

    I'm extremely frustrated by Mavericks Calendar and Reminders apps... I came from 10.6.x and things worked flawlessly. now, I cannot name an event with any sort of details in the title without it taking those details and applying them to the event its

  • Problems getting laptop started after ipod load

    I downloaded iTunes from the Apple website and my machine would barely restart. I restarted my computer in Safe Mode and was able to delete the iTunes directory. Problem resolved. I then made a horrible mistake of starting my laptop with the iPod cd

  • Check to disallow user to create PO by PM order if PM order is not released

    Hi SAP Gurus , Can we put such check/validation that user should not allowed to create Purchase order based on PM order , if PM order is not Released . We received such CR from business ( Client ) Waiting for reply . Chandan Prayag

  • How to get Transaction code for SAP standard report painter in FI

    Hi All -    Please let me know, How to get the transaction code for Standard SAP report painter / report writer in FI module. These report painters are created thru GR51... Thanks, Kannan

  • Purchasing Macbook Pro abroad

    Hi, I am currently living in South Korea and am looking to purchase a Macbook Pro 13" this month but am having a few troubles finding information that I need beacause of the language barrier. Anyone able to help please? 1) Will the 'Apple Cover' cove