Post not yet marked as solved
I’ve had several issues with the Shortcuts app. Variables not changing properly, dictionary values not changing, and when I have a lot of actions, or even just a large list, the app lags way more than it seems like it should. Is it something with my phone or is the Shortcuts app just bad?
Post not yet marked as solved
Just for practice and for fun, I’m making a little stock market game in Shortcuts. I have three variables, and one of them is Money. You start with ten thousand, but when I try to get that number to decrease when I run the shortcut, it stays at 10K. I try to decrease it again (in the same run), then it sets itself to 0. No matter what values I decrease it by, whether or not they add up to 10K, it always does this. I even checked through my code multiple times to make sure I didn’t mess up somewhere, but it shouldn’t be doing this. Does anyone know why this glitch is happening?
Also I can say things confusingly sometimes, so if you need clarification about something just lemme know :)
Post not yet marked as solved
I am a complete newb to using shortcuts.
I wanted to.create an hourly Chime.
I created 16 separate automations to play a sound every hour from 7am to 10pm.
The automation links to a shortcut I created that plays the sound.
The shortcut is 2 commands:
get File from a local folder on my iPhone 13 Pro (iOS 15.4.1), at a path to the file.
play sound (an mp3)
It executes fine when my phone is unlocked but hits me with an error -54 when the phone is locked.
I'm assuming this is a security issue with running automations when the phone is locked. Is there a way around this?
I'm attempting to send an HTTP request when a motion sensor detects movement. I've setup the trigger in the Home app, and chose "Convert to Shortcut", now I'm trying to get the "Get contents of URL" shortcut action to work.
I'm running the target web server (a little Node.js app) on my local network.
I originally tried to use a simple http server, but was getting the error:
An SSL error has occurred and a secure connection to the server cannot be made. Assuming that HomeKit was converting my http URL to https automatically I moved my service to a domain where I have LetsEncrypt setup, added support for simple token based auth via headers, and tried again. This time I got the error:
A server with the specified hostname could not be found I triple checked my spelling, verified that the request worked from my Mac and iOS Safari, then concluded that the HomePod (my current home hub) doesn't do domain name resolution like I expect and I need to use an IP address instead.
Since I can't get a LetsEncrypt cert for a local IP address I generated a self-signed certificate with the instructions outlined here: https://stackoverflow.com/a/24749608 I additionally installed the root CA on all my HomePods and my phone using a "DER format crt" also described in that post. Now I'm getting another error:
The certificate for this server is invalid. You might be connecting to a server that is pretending to be "192.168.7.77" which could put your confidential information at risk. Installing root certs into my HomePods feels a little reckless, so I'm going to go reset them to factory settings and hope that someone here has some guidance as to what I need to do to make my service eligible for the "Get Contents of URL" shortcut.
Thank you!
A note for anyone trying to reproduce this: the errors I'm quoting are shown when you click the play button at the bottom of the shortcut editing/creation screen ("Home" app > "Automations" tab > "+" button > setup any trigger > "Convert To Shortcut" at the bottom of the action selector > "▶️" button). Clicking "Test automation" after creating the automation, or using the actual Shortcuts app will give misleading results.
Post not yet marked as solved
I recently bought some smart outlets and nfc chips so that when I tap my phone to them my lights turn on. Although when I go to set up the automation on shortcuts it doesn’t work. I’m setting it up as
“When NFC chip is scanned”
”If Outlet is On/Off”
Then there is no option to change it. It just detects if it’s on or not and I can’t seem to find a way to have it detect it then change it.
Post not yet marked as solved
I am adding Siri Shortcuts to my navigation app.
I understood in order to use Siri voice to trigger shortcuts, for custom intents, the users have to add voice phrases or record voice for shorctus by Add to Siri button or built-in Shortcuts app; for system intents, the users don't need to do that because Siri already knows all the trigger voice phrases.
But when I say "Navigate to the station using Google Maps", the whole shortcut works without adding to Siri manullay. And based on https://developer.apple.com/documentation/sirikit, I couldn't find any system intents related to Navigation Domain.
Did I misunderstand anything here?
How could Siri and Google Maps exchange intents here without system navigation intents or adding to Siri manually?
Post not yet marked as solved
I have developed a siri shortcut where user can order coffee using siri voice commands. This shortcut asks users about the payment method to be used while ordering the coffee. Is it possible to integrate support for apple pay while ordering coffee in the siri shortcut. I've been reading documentation but i couldn't find any support in implementing apple pay in siri shortcut. I want to ask if its doable, please provide some help or sample code to achieve it or if its not doable i want to have something to show to my employer.
Post not yet marked as solved
Hello
I am new to this field. Thanks for your understanding.
I have this small automator programme which works fine
on run {input, parameters}
set dateString to do shell script "date +'%Y.%m.%d'"
tell application "System Events"
keystroke dateString
end tell
end run
When I'm trying to run it from system preferences/keybord/services I get this error
The action “Run AppleScript” encountered an error: “The operation couldn’t be completed. (com.apple.Automator error -212.)”
My Mac version is 11.6.3
Where is the bug?
Thanks
Post not yet marked as solved
According to the 2021 WWDC video “Meet Shortcuts for macOS”, all I have to do is add the Intents file to my application, build it, and immediately the actions will be available in Shortcuts/Mac.
This is most definitely not my experience, I've added the Intents file, configured some intents, and build my application, but nothing shows up in Shortcuts. So clearly I am missing something.
My Application is an Objective C++ app, designed to run in the background (Keyboard Maestro Engine), and I'm trying to add some Shortcut actions to it, but I have had no luck getting them to appear at all.
Any suggestions on what to try or what more I need to do to get them to show up?
Post not yet marked as solved
Hello,
My app is facing a crasher with users albeit not a lot just a couple here and there. I've been trying to figure out the root cause but I'm not getting much information. Has anyone experienced this before? This is where the crash happens:
1
IntentsUI
-[INUIEditVoiceShortcutViewController remoteViewControllerDidDeleteVoiceShortcutWithIdentifier:] + 88
2
IntentsUI
-[INUIVoiceShortcutHostViewController remoteViewControllerDidDeleteVoiceShortcutWithIdentifier:] + 100
Not sure if it's related to something on my end as there are no memory leaks and I tested on device. Any input would be appreciated. Thanks.
Post not yet marked as solved
I need to define the folder where the note will be created. I tried creating a path to the folder using string but it didn't work. Does anyone know if it is possible to set the folder using some variable? ScreenShot in Portuguese
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?
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
Going hiking and wanted to see if I or someone me could develop a shortcut that sends me an alert when cell service is available. It would be nice to have it also place a pin on the map after alert. Any thoughts on this?
Bob
Post not yet marked as solved
I've taken the code from the WWDC video and are trying to run a shortcut via ScriptingBridge:
import ScriptingBridge
@objc protocol ShortcutsEvents {
@objc optional var shortcuts: SBElementArray { get }
}
@objc protocol Shortcut {
@objc optional var name: String { get }
@objc optional func run(withInput: Any?) -> Any?
}
extension SBApplication: ShortcutsEvents {}
extension SBObject: Shortcut {}
and
guard
let app: ShortcutsEvents = SBApplication(bundleIdentifier: "com.apple.shortcuts.events"),
let shortcuts = app.shortcuts else { throw "error" }
print("getting short")
guard let shortcut = shortcuts.object(withName: shortcutName) as? Shortcut else { throw "error" }
print("running short", shortcut)
let res = shortcut.run?(withInput: input)
print("shotcut result", res ?? "nil")
While I am getting the shortcut object just fine
running short <SBObject @0x6000035c8e40: <class 'srct'> "append" of application "Shortcuts Events" (16450)>
running it, just does nothing and returns nil
shotcut result nil
Running the shortcut via cli works as expected.
I (hopefully) have set the entitlements correctly
but I am feeling a little stumped not to even get an error at all.
What am I doing wrong there?
Post not yet marked as solved
I would like to allow users to run an Apple Watch App action by using automations on the iPhone.
The action can only be done on the watch and not the companion iPhone app?
I noticed that it's possible to start a workout on the default Apple watch app with automations, and also possible to start a workout on the 3rd party Dawn Patrol app using automations.
Is it possible to do this with custom intents or NSUserActivities or only the system start workout intent?
Post not yet marked as solved
Hello, I've built a shortcut that crops images into a square format of (width x width). The shortcut works well for photographs, but not so for screenshots. While the result is a square image, the size is smaller by a factor of 3.123 on each side. Also the resulting image seems to be squashed vertically
Post not yet marked as solved
Hello.
I've made a shortcut to convert an image from native format to png. The shortcut works as advertised for photos, but not for screenshots. For instance, a screenshot of resolution (1125x2436), when converted to png/jpg becomes 360x780)
Post not yet marked as solved
Hi,
I Created a simple shortcut for renaming the files, it's working fine up to 1500 files but not more than that.
But I have an old WhatsUp image backup folder containing more than 25k files where my shortcut is failing even its not work for 1501 files.
Is there any limitation to handling the number of files in shortcuts? If YES, How I can increase that?
The IntentHandler in my objective-C implementation of a custom intent fails to receive a call from a voice activated shortcut. When using Siri to invoke the donated interaction, I have observed that I receive the following errors in the Console app that claim the intent handler method for intent is unimplemented:
-[INIntentDeliverer _invokeIntentHandlerMethodForIntent:intentHandler:parameterNamed:keyForSelectors:executionHandler:unimplementedHandler:] _invokeIntentHandlerMethodForIntent sirikit.intent.voice_commands.RunVoiceCommandIntent
-[WFRVCIntentHandler stateMachineForIntent:] Created state machine <WFRVCStateMachine: 0x102e23970 state=WaitingForServer phase=Unknown> for intent with identifier 8A87FC68-329D-49FF-B534-B0A5821854CA
-[INIntentDeliverer _invokeIntentHandlerMethodForIntent:intentHandler:parameterNamed:keyForSelectors:executionHandler:unimplementedHandler:] _invokeIntentHandlerMethodForIntent sirikit.intent.voice_commands.RunVoiceCommandIntent
This error is consistent with the fact that an attempt to trigger the custom intent with a voice command results in iOS calling my appDelegate, and in particular the application:continueUserActivity:restorationHandler:. According to the documentation, the restorationHandler should only be called if the intent is not handled and must be handled by the main app.
As there is very little documentation for an objective-C implementation, I cannot figure out what I am missing. I have tried to map the sample SoupChef app implementation of Siri Shortcuts to my implementation. I cannot figure out where I am going wrong. Here is my implementation (sorry for all the details, but I am hoping you can see something wrong):
First, I have implemented two additional targets; a Shared Framework and an Intents Extension. I have also implemented an Intents Definition File.
Here is an image of my targets:
W_P_r is the main app, W_P_rKit is the shared framework, and PartsListManagerIntents is the Intents Extension.
Next, here is my Intents Definition file and the target membership that it belongs to:
I have also added an app group to the capabilities section of the add for both the main target and the PartsListIntentManager target. And I added Siri capability to the main target.
All of this auto-creates some code, including a default IntentHandler.m and an info.plist in the PartsListManagerIntents target. I have updated the info.plist as follows:
And here is the Auto-generated IntentHandler (which I have modified to log activity and to call a specific intent handler that resides in the W_P_rKit shared framework:
#import "IntentHandler.h"
#import <Intents/Intents.h>
#import <W_P_rKit/W_P_rKit.h>
#import "CreatePartsListIntentHandler.h"
#import "P__tHandler.h"
#import <os/log.h>
@interface IntentHandler () /* <CreatePartsListIntentHandling, P__tHandling> */
@end
@implementation IntentHandler
- (id)handlerForIntent:(INIntent *)intent {
os_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_DEBUG, "handlerForIntent: Reached IntentHandler.");
if ([intent.identifier isEqualToString:@"P__rIntent"]) {
NSLog(@"P__rIntent");
return [[P__rIntentHandler alloc] init];
}
else if ([intent.identifier isEqualToString:@"CreatePartsListIntent"]) {
NSLog(@"CreatePartsListIntent");
os_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_DEBUG, "handlerForIntent: IntentHandler Received CreatePartsListIntent.");
return [[CreatePartsListIntentHandler alloc] init];
}
return self;
}
Note that CreatePartsListIntentHandler is a class that implements the CreatePartsListIntentHandling protocol (resolve, confirm, and handle methods of the IntentHandler).
Now here is the relevant implementation that should trigger iOS to call the IntentHandler:
In my app at the point where the user fills in the name of a new project I make a call to donate the interaction as follows:
CreatePartsListIntent *data = [[CreatePartsListIntent alloc] init];
data.projectName = [projectPlistName copy];
data.quantity = [NSNumber numberWithInteger : currentProjectQuantity];
[[W_P_rDonationManager sharedInstance] donateCreatePartsListIntent : data];
The call to donateCreatePartsListIntent does the following:
data.suggestedInvocationPhrase = @"Create Parts List";
INInteraction* interaction = [[INInteraction alloc] initWithIntent:data response:nil];
[interaction donateInteractionWithCompletion:^(NSError * _Nullable error) { ... }
Once the user has created the empty parts list (forcing the above interaction donation to occur), the view controller will present an "Add Siri Shortcut" button. The tapping of the button automatically calls the following method to create a shortcut:
-(void) addCreatePartsListShortcutWasTapped {
NSUserActivity *userActivity = [[W_P_rDonationManager sharedInstance] CreatePartsListShortcut];
INShortcut *shortcut = [[INShortcut alloc] initWithUserActivity:userActivity];
INUIAddVoiceShortcutViewController *addSiri = [[INUIAddVoiceShortcutViewController alloc] initWithShortcut:shortcut];
addSiri.delegate = self;
[self presentViewController:addSiri animated:YES completion: nil];
}
The call to CreatePartsListShortcut does the following:
NSUserActivity *newActivity = [[NSUserActivity alloc] initWithActivityType: kW_P_rCreatePartsListActivityType];
newActivity.persistentIdentifier = kW_P_rCreatePartsListActivityType;
newActivity.eligibleForSearch = TRUE;
newActivity.eligibleForPrediction = TRUE;
CSSearchableItemAttributeSet *attributeSet = [[CSSearchableItemAttributeSet alloc] initWithContentType: UTTypeImage];
newActivity.title = @"Create Parts List";
attributeSet.contentDescription = @"Create a parts list for a new project";
newActivity.suggestedInvocationPhrase = @"Create Parts List";
UIImage *image = [UIImage imageNamed:@"W_P_r_Icon.jpg"];
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(image)];
attributeSet.thumbnailData = imageData;
newActivity.contentAttributeSet = attributeSet;
return newActivity;
This does create a shortcut that is visible in the shortcuts app. Clicking on the shortcut or saying the invocation phrase will take you directly to the the app delegate's application:userActivity:restorationHandler. But it does not call the IntentHandler. I know this because I have implemented logs that would tell me if the execution thread came there.
Why is my IntentHandler not being called? Why is iOS sending the error message _invokeIntentHandlerMethodForIntent:intentHandler:parameterNamed:keyForSelectors:executionHandler:unimplementedHandler:?
I have actually been struggling with this for weeks. Any help or hints would be so helpful.