
I am utilizing macOS 14.6.1 and Outlook 16.89.3. I am unable to fairly discover a solution to this query on the discussion board.
I am making an attempt to create a folder actions service/script to watch a specific folder for any new excel information (solely excel information can be added to this folder anyway) and, when a file is added, ship that file, by way of Outlook, to the consumer whose e-mail handle is present in cell B2 of the spreadsheet.
I’ve tried utilizing chatgpt for this. It offers me a script that works when utilizing Apple Mail, however not Outlook.
Right here is one instance of what chatgpt says I ought to use…which retains failing. After I drop a file within the folder, I see the little gear icon turning within the menu bar, however there are not any dialog packing containers that seem, no error messages, and no created/despatched emails in Outlook.
on including folder objects to this_folder after receiving added_items
repeat with added_item in added_items
set filePath to POSIX path of added_item
-- Verify if the file is an Excel file
if filePath ends with ".xlsx" then
show dialog "File added: " & (identify of added_item) -- Debugging message
attempt
-- Open the Excel file to learn the e-mail handle
inform software "Microsoft Excel"
open filePath
delay 1 -- Look ahead to Excel to open
set recipientEmail to worth of cell "B2" of energetic sheet
shut energetic workbook saving no -- Shut the workbook with out saving
finish inform
-- Guarantee recipientEmail is legitimate
if recipientEmail is just not lacking worth then
-- Put together the e-mail
inform software "Microsoft Outlook"
set newMessage to make new outgoing message with properties {topic:"Your Requested Excel File", content material:"Whats up,nnPlease discover the requested Excel file hooked up.nnBest regards,nYour Title"}
make new recipient at newMessage with properties {e-mail handle:{handle:recipientEmail}}
make new attachment at newMessage with properties {file:added_item}
ship newMessage
finish inform
else
show dialog "No e-mail handle present in cell B2 of " & (identify of added_item)
finish if
on error errMsg
show dialog "Error processing file: " & errMsg
finish attempt
finish if
finish repeat
finish including folder objects to
Thanks to your time.