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:)
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
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:)
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?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Siri and Voice
Localization
App Intents
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
使用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一样
I was looking through:
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/SAppsHandleAEs.html
And wondered how these are handled for SwiftUI
apps. What would I add or override?
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?
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!
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Image I/O
Extensions
App Intents
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 🇫🇷
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Siri and Voice
Shortcuts
Intents
App Intents
I am implementing AppIntent into my application as follows:
// MARK: - SceneDelegate
var window: UIWindow?
private var observer: NSObjectProtocol?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
// Setup window
window = UIWindow(windowScene: windowScene)
let viewController = ViewController()
window?.rootViewController = viewController
window?.makeKeyAndVisible()
setupUserDefaultsObserver()
checkShortcutLaunch()
}
private func setupUserDefaultsObserver() {
// use NotificationCenter to receive notifications.
NotificationCenter.default.addObserver(
forName: NSNotification.Name("ShortcutTriggered"),
object: nil,
queue: .main
) { notification in
if let userInfo = notification.userInfo,
let appName = userInfo["appName"] as? String {
print("📱 Notification received - app is launched: \(appName)")
}
}
}
private func checkShortcutLaunch() {
if let appName = UserDefaults.standard.string(forKey: "shortcutAppName") {
print("🚀 App is opened from a Shortcut with the app name: \(appName)")
}
}
func sceneDidDisconnect(_ scene: UIScene) {
if let observer = observer {
NotificationCenter.default.removeObserver(observer)
}
}
}
// MARK: - App Intent
struct StartAppIntent: AppIntent {
static var title: LocalizedStringResource = "Start App"
static var description = IntentDescription("Launch the application with the command")
static var openAppWhenRun: Bool = true
@MainActor
func perform() async throws -> some IntentResult {
UserDefaults.standard.set("appName", forKey: "shortcutAppName")
UserDefaults.standard.set(Date(), forKey: "shortcutTimestamp")
return .result()
}
}
// MARK: - App Shortcuts Provider
struct AppShortcutsProvider: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: StartAppIntent(),
phrases: [
"let start \(.applicationName)",
],
shortTitle: "Start App",
systemImageName: "play.circle.fill"
)
}
}
the app works fine when starting with shortcut. but when starting with siri it seems like the log is not printed out, i tried adding a code that shows a dialog when receiving a notification from userdefault but it still shows the dialog, it seems like the problem here is when starting with siri there is a problem with printing the log.
I tried sleep 0.5s in the perform function and the log was printed out normally
try? await Task.sleep(nanoseconds: 500_000_000) // 0.5 seconds
I have consulted some topics and they said that when using Siri, Intent is running completely separately and only returns the result to Siri, never entering the Main App. But when set openAppWhenRun to true, it must enter the main app, right? Is there any way to find the cause and completely fix this problem?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
SiriKit
Intents
App Intents
OSLog
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?
当用户开启App自动更新后,自动更新App后,App有些功能会错乱。
1.有的会触发旧App代码功能,如旧版本有个选择框,在新版本选择框从界面移除了,但自动更新看,有的用户会还会触旧版本选择框的功能
2.数据错乱,如App录入数字6,发送到服务端变成5.4
现在发现这些问题。都是要把App删除,重新下载就可以。
请问要如何避免这样的问题。
App是有Objective-C,会不会与开启 BITCODE有关?
Topic:
App & System Services
SubTopic:
Automation & Scripting
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
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 ?
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?
hello,
i'm having a strange problem with applescript+keynote. when i try to use system events to invoke menu commands via a script like
click menu item "Copy Animation" of menu bar item "Format" of menu bar 1
(inside of enough tell...-brackets).
the problem seems to boil down to the fact that (at least on my computer) the following script returns {}
tell application "System Events"
tell process "Keynote"
return entire contents of menu bar 1
click menu item "Copy Animation" of menu bar item "Format" of menu bar 1
end tell
end tell
this script works for every app i've tried it for, but not keynote, where it always returns {}
i see two possibilities: keynote is fundamentally broken in a way that its menu bar circumvents the canonical process to make a menu bar, or keynote is broken on my machine, in which case (i already reinstalled) i'm wondering what i can do to restore a good version.
thanks for any help in advance
peter purgathofer
Topic:
App & System Services
SubTopic:
Automation & Scripting
Hello?
Does anyone have a program to "Create Shortcuts" in Swift?
With:
Program Name:
Program Path:
Program Image:
Topic:
App & System Services
SubTopic:
Automation & Scripting
I have a script that stop working since Tahoe migration.
The script need to send a notification on the my mac.
The issue is this line:
osascript -e 'display notification "The task has been completed" with title "✅ My script"'
It doesn't fail (return 0), nothing in outputs, but doesn't show anything.
I check all my notification settings, but all seems to be right, I tested the configuration of iterm & script editor.
And the global ettongs of the notifications:
Hi,
I am developing a music app. We are using siri media search functionality for a while. We recently had a case where siri would not provide keyword for a search.
When user speaks "Play Kid songs" (in Turkish, çocuk şarkıları çal), when I debug I see mediaSearch.mediaName is nil.
When user speaks "Play Kids" (in Turkish, çocuklar çal) a keyword is given and we can search and play related song.
Normally I would think that siri is somehow censoring the word "Kid". But when i try the same voice search in Spotify, I get a children song search result.
I've read documentations and searched web but couldnt find any similar experience.
What would be the cause, is there an extra setting for this kind of behaviour. What would be the cause or a different capability that Spotify can get a keyword out of this voice search but not us?
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Siri and Voice
SiriKit
App Intents
The AppleScript script below returns a -600 error (application not running) under STP Tahoe version 231 and macOS 26.1. It functioned flawlessly under previous STP versions under macOS 15.x and 14.x.
tell application "Safari Technology Preview"
tell front window
set _old_tab to current tab
set _new_tab to make new tab at after _old_tab
set current tab to _new_tab
end tell
end tell
The following version returns a syntax error.
Tell application "System Events"
Tell process "Safari Technology Preview"
tell front window
set _old_tab to current tab
set _new_tab to make new tab at after _old_tab
set current tab to _new_tab
end tell
end tell
end tell
How would these scripts need to be fixed for STP 231 for Tahoe?