Creating a shortcut to open a blank file in pages

Joined
May 4, 2020
Messages
1
Reaction score
0
Hi,
I'd like to create a shortcut command that can run from the desktop when I need to create a new pages file. I recently discovered Automator but I think this could be solved using the Keyboard shortcut setting in the system preferences.
Yet, I'm not able to create a shortcut that does that
1) Create a blank file from desktop
2) Create a blank file when I'm in a folder. I'd like the file to be stored in that folder.
. Can someone please help?
Thanks
 

Cory Cooper

Moderator
Joined
May 19, 2004
Messages
11,105
Reaction score
496
Hello and welcome.

That is far beyond my experience with Automator.

Maybe the folks over at MacScripter would have some ideas?

C
 
Joined
Jan 25, 2017
Messages
1,266
Reaction score
99
The code below is some applescript code that will open a blank pages file and save it in the Documents folder. I am sure it could be adapted to serve your needs.

Code:
-- Create a new document and save it into the Documents folder 


set the nameToUse to ¬


    ("blank") as string -- change text within the double quote marks for default filename


-- make sure the file name is not in use

set the destinationFolderHFSPath to ¬

    (path to the documents folder) as string -- change documents folder to to your required destination for file

repeat with i from 0 to 100

    if i is 0 then

        set incrementText to ""

    else

        set incrementText to "-" & (i as string)

    end if

    set thisFileName to nameToUse & incrementText & ".pages"

    set thisFilePath to destinationFolderHFSPath & thisFileName

    tell application "Finder"

        if not (exists document file thisFilePath) then exit repeat


    end tell

end repeat



tell application "Pages"


    activate

    -- create a new document and store its reference in a variable


    set thisDocument to make new document with properties ¬


        {document template:template "Blank"}


 
    -- save the document

    save thisDocument in file thisFilePath

end tell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top