Shortcuts

RSS for tag

Help users quickly accomplish tasks related to your app with their voice or with a tap with the Shortcuts API.

Shortcuts Documentation

Posts under Shortcuts tag

112 Posts
Sort by:
Post not yet marked as solved
3 Replies
12k Views
I want to use use my iPhone to make a daily call to a web URL; much like a cron job if I had a home server. In theory, this should be so simple: Open iOS Shortcuts app Go to the Automation tab Tap the ➕ icon Choose Create Personal Automation Choose Time of Day Set a time and choose next Use the “Get Contents of URL” action in the “Web Requests” section Disable “Ask Before Running” ✅ The above works great if I set the time of day to something like 9am, when I will likely be using my phone. ❌ It never runs if I set the time of day to 6am when: I am still asleep (so the phone hasn’t been picked up for 6–8 hours) The phone is on charge and connected to WiFi Do not disturb is enabled (note: I have tried disabling “Do not disturb” without success) My theory is perhaps if the phone is inactive for x time then daily automations won’t run but hoping someone has a definitive answer. Thank you!
Posted
by
Post not yet marked as solved
2 Replies
2.0k Views
I would like to know on a mdm managed supervised device, how to force use Safari if a user has non-safari browser set as default. can enforcing safari for a domain or web clip be done? even shortcuts now, when using safari it opens whatever is set as default browser. Ironically if same simple shortcut of open URL with Chrome is created it opens with Chrome, regardless if default browser is set to firefox for example this default browser setting is great for personal use but cause issues now for corporate use for me anybody else figure this out? Also affects certificates for our managed devices
Posted
by
Post not yet marked as solved
1 Replies
911 Views
I was trying out SiriKit Media Intents and found that with iOS 14, Media Intents can be handled in-app instead of using an extension. Given my current project structure, in-app intent handling suits my purpose better than handling it in an extension. But my question is about how this intent will be handled in a watchOS app? Is in-app Intent Handling supported on watchOS as well (if yes, are there any examples that I can refer to)? If not, can I create an extension for Media Intents and trigger it for watchOS while triggering the in-app handling for iOS alone? Please share if I have missed to read through some documentation / reference that solves this problem.
Posted
by
Post not yet marked as solved
2 Replies
3.1k Views
Hi! I'm exploring Shortcuts on macOS, and trying to use 'Run Shell Script' in my shortcut, but it terminates with an error 'This shortcut cannot be run because this action is a scripting action and your Shortcuts security settings don’t allow you to run scripting actions'. 'Allow Running Scripts' is enabled, but the shortcut is still not working. What am I doing wrong?
Posted
by
Post not yet marked as solved
2 Replies
3.3k Views
My son created a shortcut which opens Voice Memo and starts recording. He used a “Wait” step to set the length of the recording in secs. Then, he uses a shortcut to speak that the recording has ended. For short recordings (20s) this seems to work. Voice Memo stops and audio file is saved. For long recordings (10 min) the Voice Memo app doesn’t stop recording (regardless of whether auto-lock happened). Is there a better way that forces Voice Memo to stop recording after 10-15 minutes (as part of the shortcut) and saves the audio file? I want this to happen without manually stopping Voice Memo because it’s for someone with low vision who would have issues stopping Voice Memo manually. iPad Air running IOS 14.6
Posted
by
Post marked as solved
3 Replies
4.7k Views
So I am using shortcuts app on MacOS Monterey. When try to run an AppleScript with Keystroke command in it I get an error message that says "System Events got an error: Shortcuts is not allowed to send keystrokes." Even I gave all the permission to Shortcuts app in privacy settings. Is there any other way to do that in Shortcuts app?
Posted
by
Post not yet marked as solved
2 Replies
2.1k Views
I would like to perform certain actions when I receive messages from the Bank. There is an option in shortcuts to run the automation when receiving messages from certain contacts. The problem is that I can't store the bank in my contacts as they do not have a phone number or something. I want to achieve this goal in any possible way. What I have tried is to store - their contact - in my contacts so that I will be able to set up the automation. When I tried to store iPhone just shows me the prompt to create a contact with NO values whatsoever. SO it will just be an empty contact. Any ideas how on how I can achieve that?
Posted
by
Post not yet marked as solved
5 Replies
2.1k Views
I am trying to create a shortcut following "Implement App Shortcuts With App Intents" talk from WWDC2022. The below is my MWE. In a standalone app, this can be extended and behave like the video. Adding this code to my main app, makes the shortcut show up within the Shortcuts app, but if I click on it, it pops up an alert saying Error Domain=LNActionForAutoShortcutPhraseFetchError Code=1 "Couldn't find AppShortcutsProvider" UserInfo={NSLocalizedDescription=Couldn't find AppShortcutsProvider} My main app has several targets, so I suppose I need to establish which one is the shortcuts provider, but I cannot find any reference to how to do this in the documents. Via Siri, the shortcut command is not recognised at all. import AppIntents import SwiftUI struct DoSomething: AppIntent {  static var title: LocalizedStringResource = "Do something"  func perform() async throws -> some IntentResult {   return .result()  }  static var openAppWhenRun: Bool = false } struct MyShortcuts: AppShortcutsProvider {  @AppShortcutsBuilder  static var appShortcuts: [AppShortcut] {   AppShortcut(    intent: DoSomething(),    phrases: ["Do Something in \(.applicationName)"],    systemImageName: "books.vertical.fill"   )  } }
Posted
by
Post not yet marked as solved
1 Replies
644 Views
Hello I have a shortcut that, among other things, triggers airplane mode on. This however only works on the device i activate the shortcut on. So if i activate it from my watch, my watch goes into airplane mode, but not my phone. Same the other way around. If i turn on airplane mode manually (control center) it does mirror my other devices. I would like the shortcut to work the same way as manual activation. Can anyone help me with that?
Posted
by
Post not yet marked as solved
1 Replies
997 Views
Hi I am trying to create an Apple shortcut in notes where it creates a note with the current date and then appends text to the note below the date. There is already a shortcut on the Gallery “New Note with Date” which is supposed to do this. However, when running the shortcut, it creates the note with date in the background, then asks for what the note needs to say, then a sheet with all recent notes created pops up and you have to select which note the appended text has to be saved to. My question is, is there a way to create the note with the date and append the text to that note automatically? thanks
Posted
by
Post not yet marked as solved
4 Replies
1.5k Views
if #available(iOS 16.0, *) {       print("donated")       let intent = BasicIntent()       IntentDonationManager.shared.donate(intent: intent)    } Trying to test if donations work with the new App Intents framework. Donating the shortcut once a user taps a button. The shortcut is not appearing on the lock screen. Everything else is working as expected. The Shortcut is appearing in the Shortcuts App and is working via Siri. In developer settings I have Display Recent Shortcuts -> On Display Donations on Lock Screen -> On Allow Any domain -> On Allow Unverified sources -> On Running iOS 16.2, iPhone 11.
Posted
by
Post not yet marked as solved
9 Replies
1k Views
Since the iOS 16.4 update on my iPhone 12 Pro I’ve been unable to run shortcuts using the record audio command, if the shortcut was called by Siri. It seems that Siri might be running it twice, as when I set the command to ask for input for its parameters I get the menu twice. When I run it from Siri, the record screen freezes and the seconds don’t count down, but when I run it from Shortcuts it works fine. Has anyone else experienced this, or have any suggestions? Thanks!
Posted
by
Post not yet marked as solved
0 Replies
296 Views
I want to create an automated shortcut that texts me the information of an api every morning. I know how to do just a normal text and I know how to even do a normal api, but what if the api changed daily? What I mean by this is the api is named after the date. So for example, today would be https://example.com/ How do I add a variable within the url in the Get contents of url so that it automatically changed the date every day?
Posted
by
Post marked as solved
1 Replies
648 Views
I am working on a swiftui with sirikit. Intent and IntentUI. Often find that the IntentUI is not working. It shows only the default screen and bring user into the app. But not the customized IntentUI. I find that many developers online those worked on siri also have similar problem. Want to know is there a promising way that it will show the customized UI Everytime with siri input (come from shortcuts). And I often find that it works last time i checked it. And then after I worked on other functionalies (which are inrelevant to siri) and come back, the siri IntentUI doesn't work again. This is frustrating. Any clue? Thanks. Attached image is the default UI shown, which means the IntentUI didn't work.
Posted
by
Post not yet marked as solved
0 Replies
286 Views
The shortcut app seems to have a bug regarding text match grouping when trying to match a lowercase string to a capital case one. The match happens, but the regular expression groups are not properly displayed. To replicate, create a shortcut with the following actions: Match \d-(george) in 2-George check case-insensitive on Show Matches (this will show 2-George) Get Group At Index 1 in Matches Show Text This will not print anything
Posted
by
Post not yet marked as solved
2 Replies
516 Views
The LanguagePro app creates two shortcut commands by default, as shown in the figure below: Then there is an entry integrated into siri on the app settings page, as shown in the figure below: After clicking to integrate into siri, it will jump to the Shortcut app of the system, and a new shortcut command adding interface will pop up: After clicking the Add button at the bottom, you can see the shortcut command you just added in the shortcut command. View the details of this newly created shortcut command as shown in the figure below: It can be seen that the newly created shortcut command is an integration of the two predefined shortcut commands. I am very curious, what is the coding process of one-click adding to siri on the app setting page, and how to do it. I used the AppIntents framework of iOS16 to build two shortcut commands, corresponding to the above-mentioned "start conversation" and "continue conversation", but I couldn't find a way to complete the construction of "call robot" Please feel free to enlighten me, thank you!
Posted
by
Post not yet marked as solved
0 Replies
358 Views
I created a shortcut 'Add New Event' on my iPad. I need to automate the start and end time, so I use the iOS shortcuts URL schemes. I asign date variable to the start time and end time. Here's the URL I wrote for a start time 2024-01-01-06:00:00 and end time 2024-01-01-07:00:00 shortcuts://run-shortcut?name=Addevent&input=2024-01-01T06:00:00 I can't figure out how to properly write the end time so the URL will get me open the iOS calendar to create an event with a specified start and end time. I wanted to attach an image of the shortcut I created on iPad, but it won't allow me. You can view the image here. https://drive.google.com/file/d/1PIVAjg9Cta2SQr7eUMEpBSrZJpORVaMK/view?usp=sharing note: I actually just need the end time an hour later than the start time. so if there's a better solution, please feel free to comment.
Posted
by
Post not yet marked as solved
0 Replies
711 Views
We have an AppIntent that starts streaming data in its perform() function with a URLSession. This may be a quick operation, or it may take some time (more than 30 seconds but less than a minute). Is there any way we can keep that streaming data URLSession active when the AppIntent asks the user to continue with requestConfirmation? What we have seen so far is that any operation the AppIntent takes in its perform() function that interacts with the user causes the URLSession to be abruptly terminated with a NSURLErrorNetworkConnectionLost error when the app is not in the foreground. If the app is currently running in the foreground then the session does remain active and data continues to stream in. Sadly, our primary use case is for the Siri/Shortcuts interaction to happen with openAppWhenRun set to false and not require the user to open the app. In that case (with the AppIntent invoked while the app is in the background) the network connection is dropped. It has been frustrating in initial development because on the simulator the connection is not dropped and data continues to stream in, even while the app is in the background. On a physical device, this is not the case. The only condition we have found to have the network connection maintained is with the app in the foreground when the AppIntent is run. Here is what we have now: struct AskAI: AppIntent { static var title: LocalizedStringResource = "Ask" static var description: IntentDescription = IntentDescription("This will ask the A.I. app") static var openAppWhenRun = false @Parameter(title: "Prompt", description: "The prompt to send", requestValueDialog: IntentDialog("What would you like to ask?")) var prompt: String @MainActor func perform() async throws -> some IntentResult & ProvidesDialog & ShowsSnippetView & ReturnsValue<String> { var continuationCalled = false //Start the streaming data URLSession task Task<String, Never> { await withCheckedContinuation { continuation in Brain.shared.requestIntentStream(prompt: prompt, model: Brain.shared.appSettings.textModel, timeoutInterval: TimeInterval(Brain.shared.appSettings.requestTimeout )) { result in if !continuationCalled { continuationCalled = true continuation.resume(returning: Brain.stripMarkdown(result)) } } } } //Start the intentTimeout timer and early out if continuationCalled changed let startTime = Date() let timeout = Brain.shared.appSettings.intentTimeout while !continuationCalled && Date().timeIntervalSince(startTime) < timeout { try? await Task.sleep(nanoseconds: 1_000_000_000) } //At this point either the intentTimeout was reached (data still streaming) or continuationCalled is true (data stream complete) //best effort for Siri to read the first part and continue as more is received var allReadResponse = "" var partialResponse = "" while !continuationCalled { partialResponse = Brain.shared.responseText.replacingOccurrences(of: allReadResponse, with: "") allReadResponse += partialResponse do { let dialogResponse = partialResponse + " --- There is more, would you like to continue?" //THIS WILL TERMINATE THE URLSession if the app is not in the foreground! try await requestConfirmation(result: .result(dialog: "\(dialogResponse)") { AISnippetView() }) } catch { return .result( value: Brain.shared.responseText, dialog: "", //user cancelled, return what we have so far but we've already spoken the dialog view: AISnippetView() ) } } //Read the last part (or the whole thing it it was retrieved within the intentTimeout) let remainingResponse = Brain.shared.responseText.replacingOccurrences(of: allReadResponse, with: "") return .result( value: Brain.shared.responseText, dialog: "\(remainingResponse)", view: AISnippetView() ) } } With this logic, Siri will read the first part of the response data when the timer expires and continuationCalled is false. The data is still streaming and will continue to come in while she is speaking - ONLY IF THE APP IS IN THE FOREGROUND. Otherwise the call to requestConfirmation will terminate the connection. Is there any way to get the task with the requestIntentStream URLSession to stay active?
Posted
by