nlpat016 Posted June 7, 2023 Posted June 7, 2023 Let's say I am working on Ms Word, and I want to email the active file to someone, is there an Alfred Workflow (or any other method) through which this can be done directly?
vitor Posted June 7, 2023 Posted June 7, 2023 Welcome @nlpat016, There is no global generic way to get the “active file”. How it’s done and if it’s even possible depends entirely on the application which has the file open. There’s also no global generic way to email a file, it depends on your email client. So to the question “can I email the currently open file in MS Word with Mail.app”, the answer is “probably” (it depends if Word supports AppleScript to return the open document, which I think it does though I’m not sure). To the question “can I email any document open in any app with any email client” the answer is “no” because even if you added supported for documents in every app and every email client which can do it (each one implements it differently) there are still tons of apps who don’t support it at all (e.g. every Electron app).
nlpat016 Posted June 9, 2023 Author Posted June 9, 2023 Thank you, @vitor for your detailed explanation.
TomBenz Posted June 10, 2023 Posted June 10, 2023 If you want to do this for MS word/excel or Powerpoint file, you can try this AppleScript. For me it gives Sharepoint location and is used to communicate link quickly to a colleague. There is MS word / excel share - send document / link option that can be used via UI. tell application "Microsoft Excel" activate set frontWindow to front window set workbookName to name of active workbook if workbookName is not missing value then set workbookPath to path of active workbook as text tell application "Microsoft Outlook" activate set emailSubject to "Excel Document: " & workbookName set newMessage to make new outgoing message with properties {subject:emailSubject, content:"Please find the attached Excel document at the following location:" & return & "\"" & (workbookPath & "/" & workbookName) & "\""} open newMessage end tell else display dialog "No active workbook found in the frontmost window." end if end tell
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now