Automator/Applescript to Create New Pages Doc in Selected Folder

When working in Finder I'd like to be able to create a folder, and then (still within Finder) create a number of Pages documents inside that folder. This would help in organizing complex projects, and would be preferable to creating the documents (from the bottom up) in Pages and then laboriously assigning each document to a different folder.
I've tried various solutions in Automator and Applescript but nothing has worked.
For example:
try
tell application "finder" to set myFolder to (folder of the front window)
on error -- no open folder windows
set myFolder to path to desktop folder
end try
tell application "Pages"
activate
set myDocument to make new document with properties {path:myFolder}
end tell
But this gets an error "Can't make [the selected folder] of application "Finder" into the expected type. (-1700).
In automator, I've tried to do the following:
1. Get Selected Finder Items (which will be the folder I want)
2. (Create new variable "path" and drag onto 1., which creates "Get Value of variable)
3. (ignoring input) Get Specified Finder Item (specifying a blank Pages document)
4. (accepting input) Copy Finder Item to variable "path"
The problem with this is that step 2 returns both the desired folder AND the desktop. The result of the entire process, moreover, is that the blank Pages file is created (or rather copied to) the desktop ONLY, and not to the desired folder.
Anyway, I hope someone can help me with this. It would really speed up my organizing process.
Wes

Taking care of true window's properties is often useful
on run
try
tell application "Finder" to set myFolder to (target of the front window) as alias
on error -- no open folder windows
set myFolder to path to desktop folder
end try
set myNewDoc to my makeNewIworkDoc("Pages", "myNewDocument" & my dateTimeStamp() & ".pages", myFolder as text)
end run
--=====
Creates a new iWork document from Blank.template,
saves it and returns its pathname.
example:
set myNewDoc to my makeNewIworkDoc(theApp, docName, folderPath)
on makeNewIworkDoc(a, n, d)
local t, c
if a is "Pages" then
set t to ((path to applications folder as text) & "iWork '09:Pages.app:Contents:Resources:Templates:Blank.template:") as alias
else if a is "Numbers" then
set t to ((path to applications folder as text) & "iWork '09:Numbers.app:Contents:Resources:Templates:Blank.nmbtemplate:") as alias
else
if my parleAnglais(theApp) then
error "The application “" & a & "“ is not accepted !"
else
error "l’application « " & a & " » n’est pas gérée !"
end if
end if
set f to d & n
tell application a
set c to count of documents
open t
repeat
if (count of documents) > c then
exit repeat
else
delay 0.1
end if
end repeat
save document 1 in file f
end tell -- theApp
return f as alias
end makeNewIworkDoc
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
on dateTimeStamp()
return (do shell script "date +P%Y%m%d-%H%M%S")
end dateTimeStamp
--=====
Yvan KOENIG (VALLAURIS, France) vendredi 4 septembre 2009 20:51:02

Similar Messages

  • Use Automator to create new subfolders in a selected folder

    This seems like it should be easy to accomplish, but I have had no luck.
    I want to be able to select a folder, and then run an Automator Service to create a specific set of subfolders within the selected folder.
    I am able to set up automator to create the subfolders, but it does so in the folder containing the selected folder.
    Any suggestions on how to accomplish this simple task?

    Which type of variable should I choose? I tried "text" but there's no way to set it to "input"? There are many Variables in the Library.
    Here's how I have things set up now, I thought the "Service receives selected 'folders' in 'Finder'" (at the very top of the workflow area) would pull in the selected folder.
    Thanks!

  • How can I transfer text and format from a Word Doc to a new Pages Doc?

    How can I transfer text and format from a Word Doc to a new Pages Doc?

    Select, and Copy in the Word doc and Paste in the Pages doc. It may not be perfect. Importing (Opening) the Word doc is probably better than using Copy/Paste for large amounts of content.
    Jerry

  • Infinite loop creating new page due to column header overflow.

    i am getting an error and some pages "Infinite loop creating new page due to column header overflow. " --
    using report builder 9, i have a fairly simple report - that contains 4 subreports.
    for some pages i get the error - it seems if there is more data than would fit on 1 page.
    smaller pages work fine.
    the subreports are all simple queries and dumps....
    containing page header, column header, detail sections.
    page header has just a text bar of the name of the section.
    column header has the field names
    detail section has the data - 1 row for each row in the recordset.
    nothing i do seems to change getting "Infinite loop creating new page due to column header overflow. " on a page with more than 15-20 records returned.
    any ideas would be appreciated.

    Try these links if you are still having the issue:
    http://community.jaspersoft.com/questions/543302/receive-infinite-loop-creating-new-page-d ue-column-header-overflow-exception
    http://community.jaspersoft.com/questions/500177/infinite-loop-due-page-header-overflow

  • How do I make it so my client can edit Links in business catalyst when they create new pages?

    Okay so essentially I have built a site in Muse uploaded to business catalyst and I've setup a site template so that the client can create new pages as each new course arrives, but how do I get the link from the homepage to link to the new page? basically I need the link to be editable.
    What would be ideal is a kind of portfolio layout where there is a thumbnail and a new page but for my client to be able to add a new project adn it would create a thumbnail on the homepage and a new page that he can edit. Does anyone know of something like that possible in Business catalyst?

    Hi
    Editing with Business Catalyst only works with image or text editing , we cannot add new page or page items using in browser editing.
    However, you can manage the site from BC end when your client and login to admin and add pages, modify etc, but if you re-publish the site from Muse then then changes will be overwritten.
    Thanks,
    Sanjit

  • Clicking "page from template" does not allow me create new pages

    I stared designing a site with the trial version of CS4. Of course it involved a lot of trial and error, creating a page and canceling it again etc. At last I was able to design the index page and a few other pages, but suddenly just about 7 days into the trial period, the template started looking different; not displaying the images and displaying the home page article in an improper way. I also discovered that I could not create new pages by selecting file\new. When the new document dialogue page opens and I select "page from template" and then select a site I am working on, nothing shows in the items list. I only see the message "no items". Moreover, the "create" (new page) button is no more a click-able area.
    I even tried it by proceeding as if I wanted to design a new site. I click file\new\page from template\the site, but when it comes to the stage where I should select "2 column liquid, left sidebar, header and footer" after clicking “page from template” I don't see anything in the items column. It only tells me "no item."
    I thought this problem was due to the fact that I was using the trial version and that the trial version was limited in the number of new pages I could create. So I bought the full version. Alas! I discovered that changed nothing. Right now am stuck. Do you have any suggestion?

    I think you're are confusing DW Templates with CSS Page Designs and Starter Pages.
    Templates are a DW proprietary device.  They permit you to have sitewide elements such as common menus, headers and footers on all your pages along with Editable Regions for page specific content (i.e. the stuff that changes on every page).
    DW Templates looks like this (notice the Template Editable Comments):
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <!-- TemplateBeginEditable name="doctitle" -->
    <title>Untitled Document</title>
    <!-- TemplateEndEditable -->
    <!-- TemplateBeginEditable name="head" -->
    <!-- TemplateEndEditable -->
    </head>
    <body>
    <!-- TemplateBeginEditable name="Content" -->My Page Specific Content Goes here
    <!-- TemplateEndEditable -->
    </body>
    </html>
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web.blogspot.com

  • How to create new Page Format

    Hello
    i want to create new page format in sap script
    can any body guide to crate this & how to assign this
    thnks in advance

    Hi Nitin,
    You can create a new page format by transaction code SPAD. Here you will have to create a cutomised page format for ex: 'ZPAGE'.
    After this you will have to create a format type 'ZPAGE'. Assign the page format 'ZPAGE' to format type 'ZPAGE'. Pls make sure that both the names are identical.
    Once you do that you will have to assign the format type ZPAGE to the printer which you want to use.
    Now you can use this page format in your script.
    Hope this helps.
    Sushil

  • Creating new pages in iWeb

    Could someone assist please with creating new pages within a page - that is if I need to follow from
    a previous page with in context stuff, but I don't want a NEW page with a NEW page heading at the top.
    I just want to put more stuff up under an existing page heading and using an arrow to go to new page
    all in the same section. Rather than filling the top with new page headings. Sorry if I cant explain it better! Thanks - Gareth

    This works for your site because it is mostly photos and you have used the Photo Page, fine. However, what you need to remember is that many people just have ordinary websites without photos who might still want to use sub pages and this method will not work for them because there are not forward and back links.
    I have sub pages on my own website and basically, I created an About Us page. I have some text there, but then I have something that says find out more about these people. I did not want these other pages displayed in the main nav bar, so I took them all out and what I have done on the About Us page is use a shape with the name of the person in it and created a hyperlink to that page. You click on the relevant shape and this takes you to the page for that person - on this page I have then created a shape with Back and Forward in it - the Back hyperlink if clicked on takes you back to the About Us page and the Forward hyperlink takes you to the page for the next person etc.
    If you want to create sub pages on an ordinary web site, then this is how you need to do it - you need the links on the pages that are not in the main nav bar to be able to get around the site.
    You don't have those links on your site, but as it is mainly photos then this does not matter and works for you, as you go from gallery to gallery. This will not work for everyone though - horses for courses! What works for one might not work for another.

  • Can't get Contribute to Create New Page

    Can't get Contribute to Create New Page
    --Have 'tried' all options for 'new page' - button, File>,
    and Ctl + N
    --Have tried via each of my different websites
    --CAN Edit existing pages!
    --Established myself as Administrator, and Publisher
    --Downloaded "Update" & ran "Repair" option
    STILL Can't open a "New Page"!!!???!!!
    Can anyone help?

    I don't suppose you ever found an answer to this problem?
    I've got exactly the same on a laptop: Desktop is absolutely
    fine.
    As in your case the software works 100%, but you simply can't
    create a new page (across all sites). Crazy - no error message, no
    nothing.
    I did make the fatal error of installing a demo version of
    the software before buying the real software, so I did have to go
    through 6 pages of A4 instructions to try to get the read software
    to install... perhaps this is a vestige of that???

  • I can't delete, move or create new pages.

    Hello,
    I have catalogue (390 pages)
    Today i cant delete, move or create new pages.
    When i delete, move or create new pages - my Indesign CS5.5 program "freezes"
    Only with CTR: + ALT + SHIFT i can stopped my program.
    Аfter reopening everything was as before!
    I try to export like a  *.idml file, but my program crashes! Every time!
    My OS is: Windows 7
    Indesign CS5.5
    Please help me
    Thank you!
    With kind regards,
    Botev Plovdiv

    Is there anything at all related to this freeze in the Windows Event Viewer?
    Are you able to add, remove, or move pages in a new document? Are you able to export a new document to .idml?
    Yes, it is able!
    It sounds like there may be a corrupt bit of text, or an image in the file. It may be possible to isolate a page, and then an object, using "Divide and Conquer."
    Start with a copy of the file, for safety. Try to export the front half and the back half separately. If either half crashes, divide it in half aand try to export those halves. Repeat the process until you have isolated a page that crashes. Now remove half the objects from that page and try to export. If it works, put those back and remove the other half and try again. Repeat as above until you isolate an object.
    Thank you, I will try!
    After that i will back to you with my comments!
    Thank you again, Peter!

  • How to create new page in adobe form.

    how to create new page in adobe form.

    Hi
    First Go To Layout.
    On Hicherchy Platte , rightclick on Subform and select option new body page.
    This way you can create body page for the particular subform.
    if you want to create master page , right click on page 1 and select New master page.
    Hope this will helpful to you.
    Rewards if useful.
    With Regards
    Nikunj Shah

  • Tcode for creating new page size in smart forms

    dear friends ,
    can any one tell me the tcode for creating new page size in smart forms.
    thanks&regards
    veerachamy

    page formats?
    check in SPAD.
    Regards
    Prabh

  • Can not create new page from template

    I have been working on a new site for the last couple of
    weeks and have created several pages using a basic template.
    All of the child pages of this template still update when
    changes are made to it, however I can no long create new children
    from this template.
    Any ideas as to what the problem might be.
    THanks
    Clint

    > It is basically just creating a copy of my template, and
    not linking to it in
    > any way.
    > This allows me to change any section of the html.
    my guess is that you are opening the .dwt template file and
    doing a "Save
    As". That page is not a "child" page of the template.
    >
    > I want to be able to create new pages off this template
    and have it work like
    > all of the first pages I created.
    dw menu-->File-->New
    in the new files dialog box, click the Templates tab
    from list in left, click This Site Name
    from list in right, pick This Template
    make sure x is in box to Update if template changes
    click okay
    save file with filename you want to within this local site
    folder.
    add content to within the editable areas
    Alan
    Adobe Community Expert, dreamweaver
    http://www.adobe.com/communities/experts/

  • Use a Custom Page Layout When Creating [[new pages]] in Enterprise Wiki

    I have followed a few different blogs and I've been able to create a custom wiki content type and create a new page layout based off of that content type. I've also set my site so that my new layout is the default page layout. This works when creating
    new pages on the site but when i try to create a new wiki page --> [[new page]], I'm still getting the typical blank wiki template. How on earth do i get my page layout to sync with creating a new wiki page?

    Hi,
    For your issue, go to Site Actions > Site Settings > Page layouts and site templates (Under Look and Feel).
    Pages in this site can only use the following layouts: add custom wiki template.
    Select default page layout: choose custom wiki template.
    Besides, here is a blog, you can use as a reference:
    http://blog.henryong.com/2010/06/08/how-to-create-custom-sharepoint-2010-page-layouts-using-sharepoint-designer-2010/
    Best Regards,
    Lisa Chen

  • How to create new page from EBS

    Hi
    I want to create new page through EBS
    is that possible
    and
    how?

    HI
    Now page is run successfully
    but when it opens then It gives an error like:
    Exception Details. >oracle.apps.fnd.framework.OAException: Application: ICX, Message Name: Could not find the specified responsibility.
         at oracle.apps.fnd.framework.CreateIcxSession.getEncryptedSessId(Unknown Source)
         at oracle.apps.fnd.framework.CreateIcxSession.createSession(Unknown Source)
         at runregion.jspService(_runregion.java:132)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)     at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
         at java.lang.Thread.run(Thread.java:595)

Maybe you are looking for

  • "charging is not supported" when using the cable that came with ipod

    I get an error message that "charging is not supported" when plugged in using the only cable that came with my ipod touch. My ipod will charge for 5 minutes then when I check on it, I notice this error on screen and the ipod has stopped charging.  I'

  • DV6 3019 TU FAN

    I have a HP Pavillion Dv6-3019TU laptop. OS is Windows 7. There was a problem with heating and fan noise from the purchase dare. I went to the HP Service Centre, but the problem didnt solve. Before a week ago the fan gone crazy, it started making noi

  • I have a sony hdr td 20ve 3d video camera. Is it possible to import into iMovie 11, edit and export in 3D? I have an iMac 2008 model running Lion 10.7.4

    Is it possible to import 3d from the Sony 3D videocamera,model HDR TD 20VE into iMovie 11, edit and export the files to iDVD and produce a disc that plays on a 3d compatible DVD player?

  • Ipod shuffle 1st generation is dead

    I think my shuffle has died. I thought it was the battery because I had no response when I pushed the battery button. But I have had it hooked up to the computer for almost 6 hours trying to get the battery to charge and no luck. I still get no respo

  • Losing songs?

    I recently had to replace my hard drive, so fortunately I backed up all my songs onto DVDs. I haven't yet moved all my music from the DVD onto iTunes, but I did purchase 2 new songs. I believe I was running iTunes 5 when I bought those. I just update