Automation & Scripting

RSS for tag

Learn about scripting languages and automation frameworks available on the platform to automate repetitive tasks.

Automation & Scripting Documentation

Posts under Automation & Scripting subtopic

Post

Replies

Boosts

Views

Created

Customizing section titles in the Shortcuts app (Favorites / Recents style)
Hi everyone, I’m currently experimenting with App Intents and I’m trying to customize the section titles that appear at the top of groups of intents inside the Shortcuts app UI. For example, in the Phone shortcut, there are built-in sections such as “Call Favorite Contacts” and “Call Recent Contacts” (see screenshot attached). Apple’s own system apps such as Phone, Notes, and FaceTime seem to have fully custom section headers inside Shortcuts with icon. My question is: 👉 Is there an API available that allows third-party apps to define these titles (or sections) programmatically? I went through the AppIntents and Shortcuts documentation but couldn’t find anything. From what I can tell, this might be private / Apple-only behavior, but I’d be happy to know if anybody has found a supported solution or a recommended alternative. Has anyone dealt with this before? Thanks! Mickaël 🇫🇷
3
0
198
Dec ’25
AppIntent ignores registered dependencies when awaited
App intent has a perform method that is async and can throw an error, but I can't find a way to actually await the result and catch the error if needed. If I convert this working but non-waiting, non-catching code: Button("Go", intent: MyIntent()) to this (so I can control awaiting and error handling): Button("Go") { Task { do { try await MyIntent().perform() // 👈 } catch { print(error) } } } It crashes: AppDependency with key "foo" of type Bar.Type was not initialized prior to access. Dependency values can only be accessed inside of the intent perform flow and within types conforming to _SupportsAppDependencies unless the value of the dependency is manually set prior to access. Although it is invalid since the first version is working like a charm and dependencies are registered in the @main App init method and it is in the perform flow. So how can we await the result of the AppIntent and handle the errors if needed in the app? Should I re-invent the Dependency mechanism?
1
0
118
Dec ’25
Cannot make my app appear in “Share with App” action in Shortcuts – How to allow receiving images from Shortcuts?
Hi, I’m trying to integrate my iOS app with Shortcuts. My goal is: In the Shortcuts app → Create a shortcut → Select an image → Share the image directly to my app for analysis. However, when I try to add the “Share with App” / “Open in App” / “Send to App” action in Shortcuts: My app does NOT appear in the list of available apps. I want my app to be selectable so that Shortcuts can send an image (UIImage / file) to my app. What I have tried My app supports receiving images using UIActivityViewController and Share Extension. I created an App Intents extension (AppIntent + @Parameter(file)...) but the app still does not appear in Shortcuts “Share with App”. I also checked the Info.plist but didn’t find any permission related to Shortcuts. The app is installed on the device and works normally. My question What permission, Info.plist entry, or capability is required so that my app becomes visible in the Shortcuts app as a target for image sharing? More specifically: Which extension type should be used for receiving images from Shortcuts? App Intents Extension? Share Extension? Intent Extension? Do I need a specific NSExtensionPointIdentifier for Shortcuts integration? Do I need to declare a custom Uniform Type Identifier (UTI) or add supported content types so Shortcuts knows my app can handle images? Are there any required entitlements / capabilities to make the app appear inside the “Share with App” action? Goal Summary I simply want: Shortcuts → Pick Image → Send to My App → App receives the image and processes it. But currently my app cannot be selected in Shortcuts. Thanks in advance for any guidance!
3
0
205
Dec ’25
SetFocusFilterIntent app cannot be copied to another Mac
I have recently added a SetFocusFilterIntent target extension to my app which is a system utility which goes into the menu bar(Application is agent = YES). I have followed the approach in the WWDC22 video introducing Focus Intent and I have created an App Groups to being able to make the Extension to communicate with my main app, however from when I did this sometimes when I run the app I do get this log line: Couldn't read values in CFPrefsPlistSource<0x97cd34700> (Domain: group.xxx.xxx.MyApp, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd Despite this the Focus mode integration is working correctly on my development Mac. However I used to Archive the app and then Copy the app to my MacBook but when I do that now my other Mac cannot open the app and it is giving me an error. If I revert this change then I can bring the app back to my other Mac as usual following the procedure: Product -> Archive. Then from the archiver: Distribute App -> Copy App. After that I copy the app generated to the App folder of my other MacBook but it doesn't open anymore. During the archival phase now I am even getting this warning: MyAppFocus.appex is an ExtensionKit extension and must be embedded in the parent app bundle's Extensions directory, but is embedded in the parent app bundle's ../../../BuildProductsPath/Release/MyApp.app/Contents/Extensions directory. How can I solve this issue? If I rollback the commit related to this SetFocusFilterIntent new feature the app can be Copied and moved to the other Mac as before. Is this related to the extension or to the fact that I had to use this new entitlement: com.apple.security.application-groups ?
0
1
86
Dec ’25
Custom AppEntity nested dictionary
I am creating an AppIntent to be used with Shortcuts and I would like to return a flexible dictionary of values with nested structures. As far as I understand the custom AppEntity only uses the displayRepresentation to store a title and subtitle which are LocalizedStringResource. types. Although I can convert my dictionary into a string I found no way in shortcuts to be able to retrieve the original structure of it and inspect individual elements like in subsequent actions. Is there a way to do this? Thank you in advance Nick Karanatsios
0
0
129
Dec ’25
App 自动更新,导致App功能错乱。
当用户开启App自动更新后,自动更新App后,App有些功能会错乱。 1.有的会触发旧App代码功能,如旧版本有个选择框,在新版本选择框从界面移除了,但自动更新看,有的用户会还会触旧版本选择框的功能 2.数据错乱,如App录入数字6,发送到服务端变成5.4 现在发现这些问题。都是要把App删除,重新下载就可以。 请问要如何避免这样的问题。 App是有Objective-C,会不会与开启 BITCODE有关?
0
0
106
4w
Trimming down Standard SDEF
I've heard that when a Mac app implements their version of the Standard AppleEvent suite, the developer can copy "CocoaStandard.sdef" and trim out whatever they don't need. What are the constraints on this trimming? I guess that we could remove commands wholesale, but can we remove sub-parts of a command? Can we change an enumeration? A record type?
1
0
94
3w
Deliver/bundle entire Shortcut automations with an app
Is there any way of creating complete Shortcuts automations and bundling them with my app? Specifically, I would like the user to be able to Take a photo and open it with my app Or take a screenshot and open it with my app Of course I could offer a Share extension, but going through the Share menu and selecting my app there is time consuming for the user. I would like the user to be able to configure his or her action button such that it takes a new picture and opens it with my app right away. I can, of course, offer the respective App Shortcuts and let the user combine them into a pipeline with the Take Screenshot or Take Photo system actions. However, only power users would do this. Hence, I would like to bundle this complete pipeline with my app, such that the user just has to assign his/her Action Button to this pipeline if he/she wants to use this feature. How to go about this? I was thinking of exporting the shortcut into a file, bundling it with the app as a resource, and offering it via a Share action for the user to install it, or by sharing it on iCloud and adding the iCloud link to the UI of my app. What is the recommended approach?
0
0
73
2w
How to properly localize AppIntent dialogs for Siri?
Hi! I have defined the following app intent. It returns a result with a dialog to confirm that the intent has been executed. Naturally, that dialog needs to be localized properly. But the String interpolation with the provided format doesn't do that. I specified wide for the width parameter and expect spelled-out unit names. However, in the textual output, Siri always uses the abbreviated unit (e.g. "min" or "s"), in all languages I tested. In the audio output, Siri says "minutes" in English where the textual representation is "min". In German, Siri says "min", so it basically reads the textual representation aloud and that's not quite understandable to the user. struct StartTimerIntent: AppIntent { static let title: LocalizedStringResource = "Start New Timer" static var description = IntentDescription("Starts a timer with a custom duration.") @Parameter(title: "Duration", description: "The duration of the timer.") var duration: Measurement<UnitDuration> func perform() async throws -> some IntentResult & ProvidesDialog { // [code to execute intent goes here] return .result( dialog: .init( full: "\(duration, format: .measurement(width: .wide, usage: .asProvided)) timer started.", systemImageName: "timer" ) ) } } As this SwiftUI-style formatter doesn't seem to work with localization, I tried a different approach with a MeasurementFormatter: extension Measurement where UnitType == UnitDuration { func localized() -> String { let formatter = MeasurementFormatter() formatter.locale = .autoupdatingCurrent formatter.unitOptions = .providedUnit formatter.unitStyle = .long return formatter.string(from: self) } } Usage with String interpolation: "\(duration.localized()) timer started." This works great as long as these two languages are set to the same language on the user's device: [UI language] Settings → General → Language & Region → Preferred Language [Siri langauge] Settings → Apple Intelligence & Siri → Language However, when they differ, even this method doesn't yield correct results. For example, I have my general (UI) language set to English, but my Siri language set to German. Then Siri replies in German, but the unit is formatted in English and Siri speaks it in English, so the result is a messed up sentence that's half German, half English. What is the proper way to localize parameters in dialogs for Siri? How can I make sure that parameters are localized to match Siri's language?
0
0
76
1w
Shortcuts: How to add “-pressed” to a file name in a shortcut
Hi there, Does anyone know how to modify this Image compressor Shortcut https://www.icloud.com/shortcuts/e13d8013598f4f33830386a956a163dd so that the image it creates has the original file name + “-pressed”? Eg “Image_123” becomes “Image_123-pressed” I know of the action ‘Rename file’ but can’t make it work. Any help much appreciated:)
0
0
42
6d
Shortcuts: How to add text to a file name
Hi there, Does anyone know how to modify this Image compressor Shortcut https://www.icloud.com/shortcuts/e13d8013598f4f33830386a956a163dd so that the image it creates has the original file name + “-pressed”? Eg “Image_123” becomes “Image_123-pressed” I know of the action ‘Rename file’ but can’t make it work. The shortcut does batch processing of images if that makes any difference. Any help much appreciated:)
0
0
53
6d