Post not yet marked as solved
Aloha,
I am trying to have the Shortcut app trigger an automation based on my location automatically without having to manually run the automation - i.e. when I arrive at work I want Siri to speak a set text, and when I leave work I'd like Siri to speak a set text and call my GF automatically. So far I haven't been able to find a way to do this or a workaround.
Any suggestions or resources for a workaround?
I'd really appreciate it!
Orion R
Post not yet marked as solved
I'm trying to run Shortcuts programmatically on Monterey. My understanding is that the official API for this is via AppleScript to the Shortcuts Events process.
I created a Shortcut that does Quicklook on the passed in file parameter. It works as a Finder action but I can't figure out how to get it to work when running it via AppleScript or Scripting Bridge.
If I send a file, alias or POSIX file, I get a generic Shortcuts error 4. If I send a path as a string, it just does a preview of the string passed in, and not the contents of the file the path references.
Anyone have any insight on how to get this working?
Post not yet marked as solved
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?
I’m trying to implement the code like shown in the session but problems start early — there seems to be no such thing like a CreateTaskIntentHandling class even after importing Intents.
Cannot find type 'CreateTaskIntentHandling' in scope
What am I missing here?
masOS Monterey Version 12.0 Beta (21A5506j)
Xcode Version 13.0 RC (13A233)
Post not yet marked as solved
is there any recommend way to install a shortcut link in an app to make it easy for the user to get at it? or is maybe just a regular link that opens in a webview the only/best way?
these type of automation shortcuts::
https://support.apple.com/guide/shortcuts/welcome/ios
Post not yet marked as solved
I was having many issues when IOS 15 RC came out. It almost feels that the beta before was better. Now, shortcuts are the biggest problem that I've encountered. On the home screen, they will sometimes just refuse to work. In the app, the "control home" feature simply won't work. There was talk that IOS 15 was shipping tomorrow. So hopefully, they can fix it by then.
Build Number: 19A344
Post not yet marked as solved
Hi, I have a shortcuts that check the actual position and save the adress inside a dropbox .txt file. It load this adress on the next run to compare to actual position...
It works well, exept that sometimes it gives me an error and its due to the spelling inside the file. The adresse looks like: Montrũal
and it supposed to be Montréal.
Why ? I takes the adresse and turn it into text before to save to prevent that...any idea how to solve that?
Thanks!
I am implementing a couple custom intents in my app. Having completed the implementation of the custom intent definitions and the intent handlers which presumably should be called on voice command based on the suggestedInovocationPhrase, I am getting stumped with just getting IOS to recognize my shortcut donation. While the shortcut donation is executed multiple times from the view that I am trying to create the shortcut for, it is never being displayed in the shortcut app or on my lock screen as having been donated. In my settings App, I have turned on (under Developer) "Display Recent Shortcuts" and "Display Donations on Lock Screen". Here is the code that is executing each time I think I am making a donation:
- (NSUserActivity *) CreateMyShortcut {
NSUserActivity *newActivity = [[NSUserActivity alloc] initWithActivityType: kMyShortCutActivityType];
if (@available(iOS 12.0, *)) {
newActivity.persistentIdentifier = kMyShortCutActivityType;
newActivity.eligibleForSearch = TRUE;
newActivity.eligibleForPrediction = TRUE;
CSSearchableItemAttributeSet *attributeSet = [[CSSearchableItemAttributeSet alloc] initWithContentType: UTTypeImage];
newActivity.title = @"My Shortcut";
attributeSet.contentDescription = @"description";
newActivity.suggestedInvocationPhrase = @"Create Widget";
UIImage *image = [UIImage imageNamed:@"MyApp_Icon.jpg"];
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(image)];
attributeSet.thumbnailData = imageData;
newActivity.contentAttributeSet = attributeSet;
}
return newActivity;
}
This is called from the view that I want to create the shortcut for with the following code:
// Donate a shortcut to allow Siri to assist with creating a parts list
NSUserActivity *activity = [[MyDonationManager sharedInstance] CreateMyShortcut];
NSLog(@"Donating Siri Shortcut");
[activity becomeCurrent];
Is there something else I need to do?
Post not yet marked as solved
I have an app that launches in background every time I reboot the computer, but for some reason the main icon remains on the dock until I click it and close manually the main window (or using the shortcut "command+W"). Then, the app remains in the background and its icon is only visible in the menu bar as I want.
I would like to edit the file in the LaunchAgents folder so that its main window closes as soon as the application starts at system startup.
Is there a way to do this? Is there any code that I can add or edit in the plist file to achieve this? Maybe emulating the keyboard combination to close the window?
This is the current application code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.companyname.appname</string>
<key>LimitLoadToSessionType</key>
<string>Aqua</string>
<key>Program</key>
<string>/Applications/appname.app/Contents/MacOS/appname</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/appname.app/Contents/MacOS/appname</string>
<string>--background</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Thank you very much.
Post not yet marked as solved
We have a button with tabindex=-1 used for announcement once user lands up on the screen.
Currently it is announcing the text within the button in a , but we are unable to suppress the announcement of the button text along with the text, which could be misleading to the end user.
Please assist in providing a solution.
Tried using role="presentation", role="status" attributes but those have not worked.
Post not yet marked as solved
I am attempting to donate an Interaction for a custom intent to create a Siri Shortcut. This is resulting in an execution error as follows:
. . .
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<__NSCFString 0x2837703c0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key pronunciationHint.'
terminating with uncaught exception of type NSException
This error occurs with the invocation of the following code block:
`CreatePartsListIntent* createPartsListIntent = [[CreatePartsListIntent alloc] init];
createPartsListIntent.nameOfProject = intentData.nameOfProject;
createPartsListIntent.quantity = intentData.quantity;
INInteraction* interaction = [[INInteraction alloc] initWithIntent:createPartsListIntent response:nil];
[interaction donateInteractionWithCompletion:^(NSError * _Nullable error) {
if(!error) {
NSLog(@"CreatePartsList donation success");
}else {
NSLog(@"CreatePartsList donation fail %@",error.localizedDescription);
}
}];`
I did a search for pronunciationHint. I found this in my intents.intentsDefinition file. It is a hidden parameter, but can be found when you open the file as propertyList. It is at the end of the file under INTypes. Below is a screenshot of the INTypes content found at the end of the intents.intentsDefinition file.
If I delete Item 2 and Item 3 and delete the DerivedData, I still get the same NSException error, so I don't know where it is finding pronunciationHint and why it even cares that it is there.
I am not even sure why the pronunciationHint parameter is being created. An excerpt of my intentDefinition file is shown below where it is showing the parameter TYPE that I created called Project. The auto creation of pronunciationHint is apparently related to the creation of this Project TYPE:
Any ideas on how I can get by this error?
Post not yet marked as solved
Hello Community,
has anyone seen a full list of all weather descriptions used in official Apple weather app?
I am using the Shortcuts App only to bring the weather on Lockscreen (example can be seen at the end of this request).
Some of those weather descriptions can be found in iOS15 manual. Unfortunately not a full list, e.g.
English https://support.apple.com/en-au/guide/iphone/iph4305794fb/ios
Arabian https://support.apple.com/ar-ae/guide/iphone/iph4305794fb/ios
German https://support.apple.com/de-de/guide/iphone/iph4305794fb/ios
and more can be found changing language codes in urls above, but all those lists are just an extract of the full list.
Thank you.
Eric
Example:
Hi All,
I'm using Core Data to store my data. I've followed the guide in the video but unable to complete the final steps.
/// The core data stack `Data`
var dataProvider: datasProvider = .shared
func handle(intent: CreateNoteIntent, completion: @escaping (CreateNoteIntentResponse) -> Void) {
let title = intent.title!
let isBookmark = intent.isBookmark!
let photo = UIImage()
let newIntent = Task { await self.dataProvider.addData(time: Date(), title: title, isFavorite: isBookmark as! Bool, image: photo) }
let response = CreateNoteIntentResponse(code: .success, userActivity: nil)
response.noteIntent = newIntent //Error: Cannot assign value of type 'Task<(), Never>' to type 'Type'
completion(response)
}
I'm using SwiftUI and it is for iOS app. Does anyone have a solution for this or can explain to me what went wrong please. Spent few hours figuring this out. Any help will be appreciated. Thank you.
Post not yet marked as solved
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
Post not yet marked as solved
I was wondering if anyone has any shortcut that would start playing a specific playlist from youtube music whenever I connect to my car/headphones.
I have a shortcut that I use to track my mileage. When my phone connects to the car’s Bluetooth, it asks me for the current mileage (as input), then appends this to a particular note, along with the current date. It worked fine.
i updated the shortcut so that it also calculates the miles per year I’m doing. But now it won’t append anything to the Note. I’ve checked that this is the problem command by using a Show Note command after I’ve found the correct Note.
any ideas?
Post not yet marked as solved
I want to use Siri to perform a repetitive task in my app that inputs variable parameters, thus accelerating the input of that data.
I have implemented a couple custom intents for background execution with the use of an intentDefinition file and implemented an IntentsExtension and associated plist to enable those custom intents. I can successfully donate an interaction that iOS matches with the supported suggestions in the intentsDefinition file that causes a Siri Suggestion to be displayed in Siri Search (or on the lock screen when enabled):
CreatePartsListIntent* createPartsListIntent = [[CreatePartsListIntent alloc] init];
createPartsListIntent.projectName = intentData.projectName;
createPartsListIntent.quantity = intentData.quantity;
INInteraction* interaction = [[INInteraction alloc] initWithIntent:createPartsListIntent response:nil];
[interaction donateInteractionWithCompletion:^(NSError * _Nullable error) {
if(!error) {
NSLog(@"CreatePartsList donation success");
}else {
NSLog(@"CreatePartsList donation fail %@",error.localizedDescription);
}
}];
I can then tap on this suggestion and it takes me to my appDelegate to process the interaction within the app
- (id)application:(UIApplication *)application handlerForIntent:(INIntent *)intent {
// This method is called when I tap on the Siri suggestion
}
But I want to process the interaction in the background using voice commands. When I speak the the command of the interaction I donated, the IntentHandler is never called. I cannot figure out what I need to do to get the IntentHandler to be called. According to the WWDC18 Intro to Siri Shortcuts, I should be able to invoke a dialog with Siri, which is my goal.
Am I off track. Why isn't the IntentHandler being called? What should trigger it to be called?
Post not yet marked as solved
Hi,
I have an app that provides Shortcut actions. One of these actions can take as input an array of String, so I checked the "Supports multiple values" checkbox in Intents definition.
Since iOS 15, I have this strange behaviour when creating a new Shortcut:
if the action is the first to be added, I can add new strings as I want.
if there is a node present before and the array is empty, then adding a string will crash the Shortcut app.
(if there is a node present and the array is not empty, then I can add new strings, and even remove all the strings I added before and replace them)
Running the Intents through Xcode debugger tells me the crash appens when initializing a multiple value parameter:
2021-10-16 09:26:37.209264+0200 Shortcuts[2431:41261] *** Assertion failure in -[WFMultipleValueParameterState initWithValue:], WFVariableSubstitutableParameterState.m:49
2021-10-16 09:26:37.209968+0200 Shortcuts[2431:41261] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: value'
Am I the only one experiencing this? (a quick search through the forum says yes) How can I fix it?
Post not yet marked as solved
Hi,
I have developed a Shortcuts action for the new Shortcuts of macOS 12. I've created a custom intent and an Intents extension. My action receives one or more files as input. The file type has been set to a custom UTI com.adobe.pdf. However the files cannot be opened. I can see in the Console that Sandbox denies the access.
If I handle the intent directly in my main app with func application(_ application: NSApplication, handlerFor intent: INIntent) -> Any? I can only open files that have been opened by the main app before. If I handle the intent in an app extension I can't open any file at all. Both the main app and the extension are sandboxed with com.apple.security.files.user-selected.read-only set to 1. My app is singed with my valid developer ID.
The example Shortcut workflow I've build simply receives PDFs as an input and is set-up to work as a Quick Action. But no matter which Shortcut configuration I choose, it does not seem to make a difference.
Interestingly everything works as expected if I set com.apple.security.files.downloads.read-write to 1. Of cause that only works with the Downloads folder.
My question: How do I have to configure my app and/or app extension in order to work with files that have been opened in Shortcuts and given to my Shortcut action as an input parameter.
Cheers and thanks for your help
Post not yet marked as solved
I've unsuccessfully attempted to run a simple iOS Shortcut that references an Apple Music action in macOS Monterey Shortcuts on both 12.0 RC and 12.01 releases.
I have also tried recreating a Shortcut from scratch on macOS Monterey that only calls the "Get Current Song" action, but the action hangs in the Shortcut editor.
I get the sense scanning the Console logs that either Shortcuts does not have access to Apple Music (a security/privacy issue) or this function is intermediated somehow by the hosted Apple Music API.
Is there any way to grant my specific Shortcut (or the Shortcuts app itself) explicit access to Apple Music? I tried messing with Settings->Sec&Priv->Privacy->Media & Apple Music - but no luck here.
Can anyone else reproduce this issue or is my configuration hosed?