I want to create an Apple Shortcut that responds to text messages I receive while on vacation with an Out of the Office message.
However, I want to exclude some people from getting this message, namely family and work colleagues. Does anyone know how to do this on iOS 18. I'm stuck on how to exclude contacts I don't want to send the message to.
Does anyone know how to do this?
Automation & Scripting
RSS for tagLearn about scripting languages and automation frameworks available on the platform to automate repetitive tasks.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello,
There is a new shortcut recently in iOS shortcuts called "Open [Pass or Card]". It looks to take in a [Pass or Card] type, however I'd like to program it with a shortcut to dynamically select a card, and I noticed it works with strings, such as "BofA Customized Cash Rewards".
Would there be a list of possible strings for supported cards and/or passes that I could pass in for this shortcut?
I have a VBScript routine to print envelopes by automating Word. This works just fine.
Now I'm trying to do the same thing with AppleScript, also using the Word application. Here is what I have so far:
set recipientAddress to text returned of (display dialog "Enter the recipient's address:" default answer "")
-- Prompt for recipient city, state, and zip
set recipientCityStateZip to text returned of (display dialog "Enter the recipient's city, state, and zip:" default answer "")
-- Combine all address parts into a full address
set fullAddress to recipientName & return & recipientAddress & return & recipientCityStateZip
-- Create a new Word document and print the envelope
set dialogResult to display dialog "To print envelope for:" & return & return & recipientName & return & recipientAddress & return & recipientCityStateZip & return & return & "Center envelope upside-down in printer with flap on left" & return & return & "Continue?" buttons {"Yes", "No"} default button 2 with icon caution
if button returned of dialogResult is "Yes" then
tell application "Microsoft Word"
set wdDoc to make new document
-- Print the envelope with the collected recipient address and hard-coded return address
-- wdDoc's print out envelope(address:fullAddress, returnAddress:returnAddress)
-- Close the document without saving
close wdDoc saving no
end tell
end if
What does NOT work is the commented line near the end of the script which starts with -- wdDoc's print out envelope...
Either I am doing it wrong, or Word for Mac can't be automated that way. Can anyone help with this script, or at least suggest a different method to print an envelope on demand?
Thanks...
Context
I'm working on a Mail.app plugin. I would like to disseminate plugin via AppStore.
I'm interested in exposing a functionality to user enabling user to choose if plugin should apply to all or selected email account.
My intention is to use AppleScript to get a list of available email accounts and expose the list to the end-user via SwiftUI
Sourcing account information
Apple Script
I'm using the following AppleScript
tell application "Mail"
set accountDict to {}
repeat with acc in accounts
set accName to name of acc
set accEmails to email addresses of acc
set accountDict's end to {accName:accEmails}
end repeat
return accountDict
end tell
The above generates expected results when executed using Script Editor.
Swift Implementation
This is still incomplete but shows the overall plan.
//
// EmailAccounts.swift
import Foundation
enum EmailScriptError: Error {
case scriptExecutionError(String)
}
struct EmailAccounts {
func getAccountNames() -> [String]? {
let appleScriptSource = """
tell application "Mail"
set accountDict to {}
repeat with acc in accounts
set accName to name of acc
set accEmails to email addresses of acc
set accountDict's end to {accName:accEmails}
end repeat
return accountDict
end tell
"""
var error: NSDictionary?
var accountNames: [String] = []
// Create script object, exit if fails
guard let scriptObject = NSAppleScript(source: appleScriptSource) else {
return nil
}
// Execute script and store results, nil on error
let scriptResult = scriptObject.executeAndReturnError(&error)
if error != nil { return nil }
// Iterate over results
for index in 0...scriptResult.numberOfItems {
if let resultEntry = scriptResult.atIndex(index) {
if let resultString = resultEntry.stringValue {
// Process result handling
// accountNames.append(resultString)
}
}
}
return accountNames
}
}
Questions
Most important one, can I deploy the App on the App Store and use NSAppleScript as shown above?
If yes can I use the script in the manner shown above or will I need to store the script in User > Library > Application Scripts location and source it from there. This is outlined in the Scripting from a Sandbox article by Craig Hockenberry, which I cannot link due to being hosted within a not-permitted domain.
If yes what entitlements I need to give to the target.
I understand that I wouldn't be able to use ScriptingBridge, which feels more robust but wouldn't permit me to deploy the app on the AppStore.
My key objective is to programatically identify mail accounts available to Mail.app, if there is a wiser / easier way of doing that I would be more than receptive.
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Entitlements
AppleScript
Mail Extensions
App Sandbox
I’ve developed an automation and shortcut using the iPhone Shortcuts app in IOS 18, something that hasn’t been done before. With support from Apple’s customer service, I was encouraged to bring this idea to life.
The automation’s purpose is to open a specified iOS app, move it to the background, and use a txt database in Folders to ensure uninterrupted data flow and continuous connectivity—especially useful for health apps where wearable devices need consistent, uninterrupted operation and monitoring (e.g., doctor tracking or wearable device connectivity). I would like to share the Automation and the Shortcut with the community.
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Health and Fitness
Scripting
Shortcuts
I'm trying to study music theory and I need a simple series of tasks to be automated to avoid wasting time on repetitive actions. That's what the Shortcuts app is for, but the actions it comes with are either severely mislabeled, or just don't work. I tried to ask for this in some regular forums and nobody could give me a simple answer, so I figured this is something that developers probably know.
I just need four PDFs to open in Preview, their windows moved to one of my monitors, and then be tiled in four equal sizes, with the order determined by me. Sounds easy, doesn't it? But I've been trying to accomplish this for over a year in Shortcuts and even Automator, but at best I can get halfway there.
I've also noticed that the Shortcuts I had prepared are running awfully slow. I'm on a Mac Studio M1 Ultra, and these PDFs are less than 10 MB each, three of them are less than 5 MB. These used to open almost instantly, but now the first one opens, then 3-5 seconds later the next one opens and so on.
As for the window tiling, at best it's tiling three of the windows correctly, but the other one that should tile on the top left, doesn't resize to the quarter of the screen. But worst of all, they are supposed to move to one of the monitors and do the tiling there, but they all open and tile on the main monitor.
So this is one I started today from scratch:
Logically speaking, this should work. But either I'm not following the logic with which Shortcuts was designed, or Shortcuts just doesn't work very well. I'm hoping it's just that I don't follow the logic, but the help is not very helpful. It's rather scant, and other than that, I can't find something that will give me more information about how it works. I'm on the current version of Sonoma, but this was the same in the previous macOS. I doubt it changed at all in Sequoia.
Sorry if I'm asking this in a developer forum, but I figured it's the place where I can finally get some answers after over a year of trial and error and online searching and getting nowhere.
Description
The Shortcut Automation Trigger Transaction frequently times out, ultimately causing the shortcut automation to fail. Please see the attached trace for details.
Additionally, the Trigger is activated even when the Transaction is declined.
Details
In the trace I see the error:
[WFWalletTransactionProvider observeForUpdatesWithInitialTransactionIfNeeded:transactionIdentifier:completion:]_block_invoke Hit timeout waiting for transaction with identifier: <private>, finishing.
Open bug report: FB14035016
Suppose I want to create a dummy switch for HomeKit using an app.
I run the app for the first time, the app registers itself as a dummy switch and all accessories see the app as an OFF switch.
The following day, I run the app again and turn the dummy switch ON. All accessories that were monitoring the status of that switch, adjusted themselves accordingly, run their automations and so on.
Can an app do that in iOS, macOS, iPadOS, watchOS, etc.?
If so, can you point me in the right direction?
I have implemented a custom AppIntent in a macOS (14+) application and also added AppShortcuts. However whenever I try to launch it from Siri I get "Sorry something went wrong". In the documentation it states that Siri should automagically index and pick up these shortcuts/ intents. What ma I missing ?
Dear community, 3 Questions
1 On which processor are shortcuts being executed (the script flow) when started from Apple Watch?
2 Same question for the single intents execution.
3 Is there a good documentation and hopefully some architectural block diagram?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
watchOS
Shortcuts
Intents
App Intents
Hello all, I need some guidance please. Since recent security changes at Microsoft. AppleMail and Outlook on my very old MacBook (El Capitan) can no longer send/recieve emails as authorisation cannot bind. Before I could automate email (hotmail account) sending with AppleScript. I now use a web mail page for Outlook via Chrome but having to send manually. Can I get some advice on how to control, with AppleScript, the attached webpage to:
open a new email
add recipient in the To field
add a subject
attach a file
send email.
Or is there another solution (apart from buying a newer Mac!). Thank you
Hello, I don't know much about AppleScript, but I found this script on a Raycast site that dismisses Notification Center notifications. It worked great on Sonoma but has stopped working in Sequoia. Here is the code:
tell application "System Events"
tell process "NotificationCenter"
if not (window "Notification Center" exists) then return
set alertGroups to groups of first UI element of first scroll area of first group of window "Notification Center"
repeat with aGroup in alertGroups
try
perform (first action of aGroup whose name contains "Close" or name contains "Clear")
on error errMsg
log errMsg
end try
end repeat
-- Show no message on success
return ""
end tell
end tell
When using this to attempt to dismiss notifications, it returns the following error:
Can’t get scroll area 1 of group 1 of window "Notification Center" of process "NotificationCenter". Invalid index. (-1719)
Please help me fix it so it will run in Sequoia! This script was super useful.
Hi everyone,
I have a shortcut that works great on iOS and on MacOS but that for some reason, doesn't work on WatchOS.
The shortcut contains only a "Run script over SSH" item, I've tested both with password and public Key, they work well on the other devices but in WatchOS they shortcut returns "Cannot send with an inactive account".
Any idea of what the issue is?
Regards,
Ade
I have an app intent that returns a file from inside the Sandbox.
With iOS 18 RC, the call to INFile results in the file being deleted, instead of the file being returned.
intentResponse.file = INFile(fileURL: fileURL, filename: fileName, typeIdentifier: nil)
This seems to happen if the file was created by an earlier Shortcut action that calls FileManager().copyItem(), but not for files created by other means.
I haven't found a reference in the developer documentation about INFile resulting in the file being deleted.
I can block FileManager() from deleting the file by setting its immutable attributes to true, but that prevents me from removing it later.
To support AppIntent in our app, we plan to follow the same approach as the “Get Details of Reminders” Shortcut Action in the Reminders app, as recommended in this WWDC session (https://developer.apple.com/wwdc24/10176?time=166). The goal is to allow querying all properties of an entity—referred to as “Node” in our app—using a single, configurable intent. For instance, we want one intent that can query properties like “Title,” “Background Color,” and “Font Name” for a specific node.
However, since the returned properties have varying data types, this setup requires flexible return types in the perform implementation of our “Get Details” intent. The challenge is that the AppIntent protocol mandates the use ReturnsValue one associated type as the result of perform. For example, we can use ReturnsValue<String> to retrieve the “Title” property, but this would restrict us from using ReturnsValue<Color> for the “Background Color” property.
What’s the best approach for implementing an Intent where the return types vary based on the input parameters provided?
how to register more than 10 shortcuts
I made an application in Script Editor and it works as expected. But the app seems to be getting automatically deleted at random times. For example, I made it a few days ago, tested it successfully, then went back today to look for it and it was gone. Tested this multiple times.
I bit more detail about my process:
I wrote the app in Script editor, exported it as an Application with run-only checked and no code signing
after manipulating a few things (.plist file, .icns file), I then remove extended attributes and code-sign using terminal. I have an Apple developer account that I use to code-sign:
xattr -cr <path_to_app>
codesign -s <my_developer_account> <path_to_app_bundle>
then I copy the app into my Applications folder and test it successfully
a day or more later, the app is gone (and I haven't even opened it again)
Ventura 13.1, Mac Book Pro 2021
When you correctly implement EntityPropertyQuery on an AppEntity, Shortcuts will expose a "Find Entity" action that calls into entities(matching:mode:sortedBy:limit:). This is demoed in the "Dive into App Intents" session and works as expected.
However, with this action, you can change the "All Entity" input to a list variable which changes the action text from "Find All Entity" to "Filter Entity where" still giving you the same filter, sort and limit options. This appears to work as expected too. But, what's unexpected is that this filter action does not appear to call any method on my AppEntity code. It doesn't call entities(matching:mode:sortedBy:limit:). One would think there would need to be a filter(entities:matching:mode:sortedBy:limit:) to implement this functionality. But Shortcut just seems to do it all on it's own. I'm mostly wondering, how is this even working?
Here's some example code:
import AppIntents
let books = [
BookEntity(id: 0, title: "A Family Affair"),
BookEntity(id: 1, title: "Atlas of the Heart"),
BookEntity(id: 2, title: "Atomic Habits"),
BookEntity(id: 3, title: "Memphis"),
BookEntity(id: 4, title: "Run Rose Run"),
BookEntity(id: 5, title: "The Maid"),
BookEntity(id: 6, title: "The Match"),
BookEntity(id: 7, title: "Where the Crawdads Sing"),
]
struct BookEntity: AppEntity, Identifiable {
static var typeDisplayRepresentation: TypeDisplayRepresentation = "Book"
var displayRepresentation: DisplayRepresentation { DisplayRepresentation(title: "\(title)") }
static var defaultQuery = BookQuery()
var id: Int
@Property(title: "Title")
var title: String
init(id: Int, title: String) {
self.id = id
self.title = title
}
}
struct BookQuery: EntityQuery {
func entities(for identifiers: [Int]) async throws -> [BookEntity] {
return identifiers.map { id in books[id] }
}
}
extension BookQuery: EntityPropertyQuery {
static var properties = QueryProperties {
Property(\BookEntity.$title) {
EqualToComparator { str in { book in book.title == str } }
ContainsComparator { str in { book in book.title.contains(str) } }
}
}
static var sortingOptions = SortingOptions {
SortableBy(\BookEntity.$title)
}
func entities(
matching comparators: [(BookEntity) -> Bool],
mode: ComparatorMode,
sortedBy: [Sort<BookEntity>],
limit: Int?
) async throws -> [BookEntity] {
books.filter { book in comparators.allSatisfy { comparator in comparator(book) } }
}
}
The example Shortcut first invokes entities(matching:mode:sortedBy:limit:) with comparators=[], sortedBy=[], limit=nil to fetch all Book entities. Next the filter step correctly applies the title contains filter but never calls entities(matching:mode:sortedBy:limit:) or even the body of the ContainsComparator. But the output is correctly filtered.
I have an existing iOS app with shortcuts support, and I am trying to bring the same shortcuts to my Mac app in macOS Monterey. In my case, I have added the same intents definition file to my Mac target app, added "Intents eligible for in-app handling" to my Info.plust file and added the intent names, and made sure all the intent handling code is part of both iOS and Mac targets. Still, when I build and run the app on macOS Monterey, the new shortcuts don't show in the shortcut editor at all. I've tried closing and restarting the Shortcuts app, but no luck. The build logs do show the intents being built, but they're just not showing up in the Shortcuts app.
I tried 'donating' one of the intents in my Mac app code, but got an error:
Cannot donate interaction with intent that has no valid shortcut types
Not sure what to try to make it work.
Thanks.
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
wwdc21-10232
App Intents
Shortcuts