Because I am using Outlook as my default email, the functionality to export as a word document to email is eliminated. Might anyone have an idea of how to accomplish this? Relatedly, when a panel pops up in Mac (like a print dialog) how do you tell Maestro to select from that dialogue? Thanks!!
Not sure I follow, do you want to import an Apple Pages text into Outlook?
When in the Pages application, trying to email that document as a word file through outlook. When Apple Mail is the default email client this functionality is available through the "share" menu. But when Outlook is the default client that share is unavailable. I can get KM to select that "Export To > Word" but then there is only an option to save the file. Can't figure out how to get that file (even if I save to Desktop) to automatically attach to Outlook message. Thanks.
Hey Bill,
This is a basic proof-of-concept.
It works on macOS 10.12.6 with Pages 7.1 and Outlook 16.16.10.
I have it set up to so the macro inputs Name, Email Address, Subject, and Content.
You can leave the Subject, Content, and Email Name variables blank, but you MUST have an email address in the local_EmailAddress variable – otherwise the AppleScript will fail.
So. This task is very doable on Sierra with old software.
I know Apple gutted Pages AppleScript dictionary a while back, but I don't know the state of it now. Hopefully they've got export working again.
Nor do I know how AppleScript fares in the most recent version of Outlook.
-Chris
Export Pages to Word and Email with Outlook v1.00.kmmacros (8.4 KB)
Thank you Chris. Just seeing this now. On first attempt (I'm in Catalina) don't think it's happening but I will try to play around with it. Very much appreciate your efforts.
Hey Bill,
Drop the Pages app onto the Script Editor.app.
You should see its AppleScript dictionary.
Copy my script from the macro and paste it into the Script Editor and see if it will compile.
It won't run from the Script Editor, because it has elements that are dependent upon the macro – but it it compiles that's a good sign. If it doesn't compile then the AppleScript nomenclature for Pages or Outlooks has changed.
-Chris
Thanks Chris. If I click on "Try" in the KM window with your macro up, then it runs, grabs and open pages file, exports to word and attaches it to Outlook. So, that's real progress! However, if i'm working inside a pages document and hit F1 (the hot key) nothing happens. What I'm trying to accomplish is that I'm working in Pages, and when I hit a hot key it exports to word, and attaches to outlook email - with no email address or message (as I'm sending to different people all the time for different reasons). I apologize as I have a VERY low level understanding of this stuff (and have only used KM for low level multi step click stuff). If unreasonable for me to make this additional request, please ignore. Thanks again.
tried changing the F1 hotkey to something like Option-F1 or Cmd-F1?
Have tried to change hot key - no dice. Nothing happens.
This suggests that you have a macro setup problem.
If any of the following are true, then the Macro won't execute from pages:
- Macro is disabled
- Macro Group is disabled
- Macro does NOT have the hot key you used from Pages
- The Macro Group that contains the Macro does is not set to be activated for BOTH Pages and Outlook.
I ran Chris @ccstone's macro and it works fine for me.
Running Keyboard Maestro 9.1 and Pages 10.1 (6913) on macOS 10.14.6 (Mojave).
After you have tried to run the macro from Pages, and it fails, then open the KM Interactive Assistant:
It works! The Macro group was disabled. Some notes/questions:
-
When I activate it, I get the following window that pops up - If I click on the "Export Pages..." it runs fine. Just wondering if this popup is intentional or some way to eliminate need to have this extra click?
-
Possible to modify so the file name of the exported file is the same as original (or with WTDRev added) rather than "PagesExport"?
-
Lastly - Can you tell me how to modify so instead of exporting Word file it will export Pages file?
Thank you!!
PS - In a world class feat of coding I just added a delete keystroke after the macro which removes the email address at the end - saves me one click!.
That's the "conflict" palette. It means you have the same shortcut assigned to more than one KM macro
Got it - thanks. Easy fix.
Any suggestion for how to modify macro to do same thing but for Pages export (instead of word)?
Yep. Follow the Macro and Script and where the Pages doc is exported to Word doc, change it do just a save.
When I change “export front document to file theFile as Microsoft Word” to “save front document to file theFile” I get an error. I am just duplicating the original KM file, and typing right there in the window to change it. Any suggestion?
Hey Bill,
That's because AppleScript is picky, and Apple doesn't “waste time” on making things consistent...
Save Front Pages Document to a File and Email with Outlook v1.00.kmmacros (8.3 KB)
The export
command likes this just fine:
set theFile to (filePath as «class furl» as text)
tell application "Pages"
export front document to file theFile as Microsoft Word
end tell
The save
command doesn't like it at all but responds to a slight change of syntax:
set theFile to (filePath as «class furl»)
tell application "Pages"
save front window in theFile
end tell
-Chris
Thank you Chris. That script opens up Outlook but there is no attachment. Not sure why.