Applescript: open Pages doc from Templete, change filename and replace text

Hi!
I just got started with applescript and i want a script that does the following:
1. open "choose from list" dialog to choose the topic of my document
from 4 possibilities (here for example A, B, C, D)
2. open document from TemplateXY
3. set document name with date and topic (dd.mm.yyy) "16.02.2011 - A"
4.inside of document: replace text "date" with the currend date (dd.mm.yyy)
and the text "topic" with the topic chosen in (1.) "A"
this is what i already did:
here as colored screenshot:
http://i55.tinypic.com/2mnhxkm.jpg
set datum to do shell script "date \"+%d.%m.%Y\""
--choose topic:
set chosentopic to choose from list {"A", "B", "C", "D"}
--text "topic" becomes replaced throug variable topic
set searchstringT to "topic"
set replacestringT to chosentopic
--text "date" gets replaced by currend date (variable datum)
set searchstringD to "date"
set replacestringD to datum
--open pages, define filename & do search&replace of the strings defined above
tell application "Pages"
activate
set DocName to datum & " - " & chosentopic
set (every text where it is searchstringT) to replacestringT
set (every text where it is searchstringD) to replacestringD
end tell
the "choose from list" dialog works and the variables like topic, datum and the search&replace strings get defined as well
my problems are:
i only get an error that the text could not be replaced
i dont know how to get a new document from a template and how to get its filename changed
i really just started doin things with applescript for a day so i hope you can help me
regards
DaNylz
Message was edited by: DaNylz

Try something like this:
set myFoundItems to change text text of all page items of pages 3 thru 5 of document 1
Shane Stanley <[email protected]>
AppleScript Pro Sessions <http://scriptingmatters.com/aspro>

Similar Messages

  • Open Pages doc from server by two persons !!!

    Hi,
    We have noticed that you can open a pages doc from a Apple MAcOS X Server from two diffrent persons, what wil result in not saving any data. Normal you CAN'T open a file that s already open ... !! This is a really big risk .. ?
    What to do about this .. ?

    This is a flaw that has existed since version 1 of Pages. My solution is to work locally and save globally (locked). It is a pain, I know, but it keeps multiple people from attempting to work on the same file at one time.

  • Can't open pages doc from iCloud on iMac

    I have been using pages v5.2.2 on my iMac (OS X 10.9.5).  I have saved several files on in the iCloud location, so far no problem.  I opened pages to access a critical file, clicked on the iCloud button, saw my file, clicked it and got the "The file "xxxxxxx.pages couldn't be opened."  Is there anyway to access this file??!!!  Help please!!

    One way to download the file to your Mac is through the iCloud website: https://www.icloud.com and click on Pages and find your file.  Click the file, it will open in a new tab, and click on the spanner icon, choose "Download a copy" (see spanner icon below)

  • How do I Open Pages doc from  iOS 2.5.2 on Pages OSX 5.2?

    I am trying to open a Pages (I miss '09 sooo much) from my iPad (Pages 2.5.2) onto my Mac (10.9.5) with Pages 5.2. I get an error message every time I try to open the page. It says it can not open file.pages.
    Is there anything I can do? I can no longer use the iOS version as I have to do very basic word processing stuff that the stripped down doesn't allow. I know Apple ruined Pages on Mac OSX as well but I am hoping I can use a page break and have it actually insert a page where I want and not at the end of the document (I know asking to rearrange pages is asking too much).

    I was able to save it as a Word Document and then open it in Pages and then save the document as a Pages file.

  • Need to delete the old page number from a combined file and replace it with the new number. is there a way for me to do that using JavaScipt

    is there a way of using JS to delete the old page number (1,3,32,78) on a combined PDF and inset it with a new page numbers (1,2,3,4) Thank you

    Depends. If the page numbers can be located by their location on the page then a script can be written to redact that area, and then add new page numbers in their place (or somewhere else).

  • How do I change the default program to open Pages docs to the old (4.3) version instead of the new one (5.0)?

    How do I change the default program to open Pages docs to the old (4.3) version instead of the new one (5.0)? When I do what Apple said and go to a Pages file in finder and select "get info" then select "Pages 4.3" and "change all" it just defaults to the new one even though I'd selected the old one. Do I need to completely uninstall the new version of Pages or is there another work around because the new version of Pages comes dreadfully short of the features I need that are included in the old one?

    Eric Kraft wrote:
    HOWEVER, if you modified a document in 5.0, 4.3 can't open it. You'll have to use Time Machine to replace the modified version with an earlier version that was last modified in 4.3.
    Actually there is a workaround.
    If you open the file in Pages 5, it can then be exported on Pages 0.9 format to another folder. I had to do this as the document was only in iCloud and couldn't be recoverd by Time Machine.
    Worked for me!

  • Open Pages documents from an older version

    I need to open Pages documents from an older version of Pages that I saved to an external drive from a computer that I no longer have access to.  My current operating system is 10.7.5 and I can't upgrade it right now.  I see that Pages 5.0 requires 10.10 or higher and I can't find older versions to download and from what I've read, it doesn't sound like I'd be able to open the old documents with the new version anyway.  I really need these documents. What can I do?

    I found it helpful to convert all my old Pages '08 files to .doc files.  They can be opened by the new version of Pages.
    Since the new version of Pages is no longer back compatible, and so not good for anything you want to keep for a long time, you might consider using an open source word processing application like Libra Office.  That's what I had to do.  After seven years of being a happy Pages user - archiving thousands of files in Pages -Apple has abandoned us.  I no longer think it is wise to use the new Pages and then five years down the road (or sooner) not to be able to open them in a newer version.
    If you would like a quick way to convert your Pages '08 files to .doc, let me know.

  • I can't open pages files from USB and iCloud due to : "The necessary file index.xml is missing".

    I can't open pages files from USB and iCloud due to : "The necessary file index.xml is missing". Original file is written on iMac (2014) and saved to an USB stick and then transferred till macBook Pro (2009, Yosemite) for editing. Then I shared the files by iCloud but I am not able to open them on iMac again. Niether can I use the USB stick to transfer the edited files back. I'm running Pages '09 4,1 (923) on the macBook and Pges 5.5.2 (2120) on the iMac.
    Håkan

    Pages 5.5.2 is extremely incompatible with even other Macs let alone the vast majority of PC and MsWord users out there, so not a good idea to leap into the fire with both eyes shut.
    After having done that to the first Pages 5 files, Apple has repeatedly done it to even the most minor point updates. Apple can't even anticipate its own erratic changes let alone what everyone else needs doing.
    Peter

  • How can i setup pages to automatically open when double clicked.  Currently when I double click it creates cpgz file and does not open.  The only way to open pages doc is to manually ask to open with pages.

    Currently when I double click it creates cpgz file and does not open.  The only way to open pages doc is to manually ask to open with pages.

    Hi Karen,
    Sounds like OS X has lost the association between Pages and its files.
    Start by quitting Pages, then going to Finder.
    In Finder, locate a .pages file. Click on it (once), then press command-I (eye, not one) to Get Info.
    In the Info window that opens, expand the Open With section.
    In this section, click on the pop-up menu and choose Pages (even if Pages is already shown).
    Click the Change All button to associate all files with the .pages extension with Pages.
    Close the info window.
    Double click any .pages file to check that Pages will now launch and open the file.
    Regards,
    Barry

  • MBP Pro doesn't recognize Pages docs from iPad, vice versa

    Beacuse I'd like to be able to experience the wonderful seamlessness of the new cloud with Mountain Lion, I downloaded Mountain Lion onto my MacBook Pro, as well as the Pages app (I previously had Pages '09), in addition to downloaded the Pages app for iOS (iPad 2 and iPhone 4S).
    I thought that in theory, I could start a document on the iPad/Phone and it woudl appear on the MBP, as well, as vice versa. That has not happened. Specifically, I was taking notes last week on the iPad and when it didn't pop up on my MBP or the Cloud on the MBP, i email the document as Pages document to myslef and thought I could just open it on the MBP then and it'd appear as a new Pages doc there. Well, when i downloaded the Pages doc from the iPad onto the MBP, I got a message saying The open XML file could not be opened because there are problemns with it, and The file is corrupt and cannot be opened. How can it be corrupt? I just created it a few days ago on the iPad? Also, when i follow prompts to open the document, the message box is a Word one? Why is Word then stepping in to try to open it? Shouldn't an Apple app on one machine recognize a document made on an Apple app on another device? I should point out this has happened everytime I've tried to share documents on my mac devices via Pages.
    Also, kind of related, when i go to the options of what to do with the file on the iPad, i get the option to use iwork -- but of course there is no iWork anymore. So why hasn't this option beeen updated? Why not just a 'save to cloud' option? And what's this 'send to itunes' option? I selected that for one document and of course that didn't work, either.
    Thanks so much.

    You do need to turn on iCloud syncing on the iOS devices as it is not on by default. Go to Settings & scroll way down to the apps area & tap on Pages & turn iCloud syncing on. The same applies to your Macs, go to System Preferences > iCloud & check Documents & Data. Of course, you must have a iCloud account.

  • Pages 2.0.2 doesn't open Pages documents from ipad

    Pages 2.0.2 doesn't open Pages documents from ipad 2. Document succesfully transferred as Pages document to computer, but Pages 2.0,2 wouldn;t open it. Version too old?

    Pages 2 is iWork '06, two versions behind what the iOS Pages creates. You need to use Pages '09 which you can purchase from the Mac App Store as a stand-alone application or a retail box of the iWork '09 suite.

  • I can't get pages 5.01 to open pages files from iCloud, although they open in iCloud Pages without difficulty.

    I can't get Pages 5.01 to open Pages files from iCloud, although they open in iCloud Pages without difficulty.
    I am using the most up to date version of Mavericks and Pages and can log into iCloud without any problems.  Is this just a glitch?  The files all behaved properly under previous versions and the initial release of the new version of Pages.

    Pages for iCloud beta is a weird beast and as it says "beta".
    I think it is the least compatible of all the many different .pages files floating around out there.
    Peter

  • Hi, App Store tells me I have installed the latest Pages update, yet it will not open Pages docs created on other machines that DO have the latest version . Any tips?

    Hi, App Store tells me I have installed the latest Pages update, yet it will not open Pages docs created on other machines that DO have the latest version . Any tips?

    Hi
    Pages 5.0 and 10.9.
    While App Store tells me there is no update avalable to Pages, which it says was installed Nov. 4, its the old Avatar/logo thingo and, as I say, it will not open the Pages docs created on my MacBook, which definiitely does have the new Pages running smoothly.
    cheers

  • How can i save a pages doc from my macbook air into include

    how can i save a pages doc from my macbook air into include

    For about the 20th time, iWork for OS X, at this time, isn't iCloud aware.
    Look at :
    http://support.apple.com/kb/HT4942
    Yvan KOENIG (VALLAURIS, France)  mardi 22 janvier 2011 10:52:50
    iMac 21”5, i7, 2.8 GHz, 4 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

  • Opening excel docs from email quickly

    Can Numbers automatically open excel docs from email? I always have to save the file and then open the Numbers program, then open file.

    If Numbers is defined as the app opening XL files, a double click in the xls file in Mail opens it in Numbers.
    You may also try to drag the attachment on the Numbers's icon.
    Yvan KOENIG (VALLAURIS, France)  mercredi 9 janvier 2011 15:29:39
    iMac 21”5, i7, 2.8 GHz, 4 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

Maybe you are looking for

  • MSI 290X Can't use Displayport and HMDI at the same time

    Howdy: I have two monitors running Win 7. 1. ASUS Black 24" 2ms HDMI LED monitor connected to the HDMI of my MSI R9 290X Lightning and a Dell VGA connected via Cable Matters DisplayPort to VGA adapter. Both monitors go black if I try to connect both.

  • How to get outbound ftp adapter file name

    All, I am writing an ftp adapter sending out files. The file name is defined as po_%yyyyMMDD%.xml format. However, I need to save the filename into a database after each file is sent out. How could I get the filename after invoking this service? It i

  • Object Movement with Key Events

    Hi everybody! Im trying to move an object over the screen with keyboard buttons. The problem I have come across with is that I would like to use the right button to move right, up button to move forward, etc. but I cant push, for example, right and u

  • Change Page Title of embedded DS reports in the portal

    Dear all, we have our Design Studio Reports embedded in the Portal. The title of the browser window is the title of the navigation entry you are navigating to. We have a demand where we need to overwrite the title from within the Design Studio Report

  • Connection to HDMI Mini when display is off is slow with ARD 3.x

    Anybody notice, well I don't know how you couldn't, that you connect to an HDMI Mini with the display off that the CPU is at 100% and you can't do anything until you turn on the display?  It is easy to reproduce.  I have my Mini hooked to a Yamaha A2