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

Activity

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
163
Dec ’25
如何在安装APP后,可以在系统的快捷指令APP中直接看到并使用超过10个以上的自定义快捷指令
使用APPIntent 的AppShortcutsProvider方式,最多只能添加10个AppShortcut,超过10个,代码编译就会报错 struct MeditationShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: StartMeditationIntent(), phrases: [ "Start a (.applicationName)", "Begin (.applicationName)", "Meditate with (.applicationName)", "Start a (.$session) session with (.applicationName)", "Begin a (.$session) session with (.applicationName)", "Meditate on (.$session) with (.applicationName)" ] ) } } 如何能做到像特斯拉APP一样
3
1
880
Dec ’25
Shortcuts Automation Trigger Transaction Timeouts
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
14
23
2.7k
Dec ’25
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
106
4w
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
82
4w
@IntentParameterDependency Always Returns nil in iOS 18
The following code works perfectly fine in iOS 17, where I can retrieve the desired dependency value through @IntentParameterDependency as expected. However, in iOS 18, addTransaction always returns nil. struct CategoryEntityQuery: EntityStringQuery { @Dependency private var persistentController: PersistentController @IntentParameterDependency<AddTransactionIntent>( \.$categoryType ) var addTransaction func entities(matching string: String) async throws -> [CategoryEnitity] { guard let addTransaction else { return [] } // ... } func entities(for identifiers: [CategoryEnitity.ID]) async throws -> [CategoryEnitity] { guard let addTransaction else { return [] } // ... } func suggestedEntities() async throws -> [CategoryEnitity] { guard let addTransaction else { return [] } // ... } } Has anyone else encountered the same issue? Any insights or potential workarounds would be greatly appreciated. iOS: 18.0 (22A3354) Xcode 16.0 (16A242d)
4
3
826
3w
App Intents with Custom Automation/Triggers
Currently, we are developing an all-in-one DualSense utility for macOS. We are exploring how to integrate shortcuts into our app. Our vision is to have the user use the native Shortcuts app to choose the controller buttons that should trigger the shortcut action, such as opening Steam, turning on audio haptics, and more. As we explore this approach, we want to see whether we need to build the UI in our app to set the triggers or can we do this inside of Shortcuts? Can button presses recorded by our app trigger shortcuts? Can those button inputs be customized inside of Shortcuts or should we develop it into our app? And if we have it in our app, can our app see, select, and trigger shortcuts?
0
0
128
2w
macOS Shortcuts App Needs an Export to PDF Feature
I am very new to the macOS Shortcuts application. In my opinion, the documentation is sparse and totally inadequate. The internet seems to be the only method of figuring out how to use this application. I have recently created a shortcut that is working well for me. It has several steps and is too large to fit in the Shortcuts editor window, so I cannot grab a screenshot of it for documenation purposes. I also cannot copy the contents of the editor window and paste them anywhere, such as in a new Note or TextEdit document. I do think Apple should add a means to create a PDF document of the Shortcuts editor window's contents. I went to the official Apple feedback page to leave comments but, irony of ironies, the Shortcuts app is not listed there! I have no idea what I am doing at this point but am excited to learn how to use Shortcuts to automate and simplify tasks that I have to perform frequently. Here's hoping the documentation and features for this application will one day be comprehensive, comprehensible, and complete.
2
0
59
2w
Applescript run as a Quick Action errors out when run inside a Shortcut.
I have a Quick Action which flattens a PDF via Applescript. The code works extremely well--I right click in finder and the PDF is flattened, annotations are burned in, no other applications are opened, and the action completes in less than 2 seconds. Here is the Applescript code: I have a Shortcut which completes several operations on already-flattened PDFs. Presently 1) I run my Quick Action by right-clicking a PDF in Finder in order to flatten it, and 2) then right-click that save PDF in Finder to run my Shortcut on that now-flattened PDF. Ideally I'd like to add the Applescript code which flattens the PDF to the beginning of my Shortcut for the sake of convenience, and because sometimes I run my Shortcut having forgotten to flatten the PDF first. However I'm finding that the Applescript code, when placed into a Run Applescript action in Shortcuts, gives this error message: The exact same code when placed into a Run Applescript action in Automator and then run as a Quick Action by right-clicking the PDF in Finder, does not give an error and works perfectly. Does anybody have an explanation (and possible solution) for why this is the case?
2
0
186
2w
App Intents: String array parameter value clears immediately in Shortcuts editor
Hello, I am experiencing an issue with the App Intents framework where a parameter of type [String] (String Array) fails to persist user input in the Shortcuts app action editor. Issue Description: When adding an item to the String Array parameter in the Shortcuts app action editor, the input text automatically clears/resets to empty within less than 1 second. This happens spontaneously while the keyboard is still active, or immediately after typing, making it impossible to input any values. Environment: Xcode Version: 26.2 (17C52) iOS Version: 26.2.1 Device: iPhone 17 Code Snippet: import AppIntents import SwiftUI struct TestStringArrayIntent: AppIntent { static var title: LocalizedStringResource = "Test Array Input Bug" static var description: IntentDescription = "Reproduces the issue where String Array input clears automatically." // PROBLEM: // Input for this parameter vanishes automatically < 1s after typing. @Parameter(title: "Test Strings", default: []) var strings: [String] func perform() async throws -> some IntentResult & ReturnsValue<String> { return .result(value: "Count: \(strings.count)") } } Steps to Reproduce: Build and install the app containing the code above. Open the Shortcuts app and create a new shortcut. Add the "Test Array Input Bug" action. Tap the "Test Strings" parameter to add a new item. Type any text (e.g., "Hi"). Observe: Wait for about 1 second Observed Behavior: The text field clears itself automatically. The array remains empty ([]). Expected Behavior: The text should remain in the field and be successfully added to the array. **Filed as Feedback:**FB21808619 Thank you.
0
0
23
3d
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?
3
0
235
21h