Tap Forms – Organizer Database App for Mac, iPhone, and iPad › Forums › Script Talk › Adding a Script to Siri
- This topic has 21 replies, 6 voices, and was last updated 3 years, 10 months ago by Sam Moffatt.
-
AuthorPosts
-
October 24, 2019 at 10:57 PM #37345
David GoldParticipantOn iOS if I add a Siri to a script and then create a Shortcut which runs that script as an action step is there any way to pass data either into the script or retrieve from the script? I can’t see anything on this in the API unless I’m missing it. If you can’t do this directly is there a workaround via the clipboard (ie can a script get information from the clipboard or can it at completion do that or display a result without having to launch Tap Forms)?
October 25, 2019 at 12:21 AM #37348
Sam MoffattParticipantThe way I do this is by syncing to CouchDB and then using Siri Shortcuts to POST a document to it. It took a lot to get up and running but it seems to work properly.
October 25, 2019 at 12:31 AM #37351
David GoldParticipantLooks a bit too complex for me!
October 25, 2019 at 1:21 AM #37354
BrendanKeymasterThe latest Tap Forms 5.3.7 version has a function to store and retrieve text from the clipboard.
var text = Utils.copyTextFromClipboard();
andUtils.copyTextToClipboard('some text');
I’m actually just looking into trying to figure out how to integrate with the Shortcuts app now. Still a work in progress and I’ve made no headway just yet in getting Tap Forms to even show up as an app in the Shortcuts app. But I’m sure I’ll figure it out as I did with the Siri Shortcuts stuff.
October 25, 2019 at 1:37 AM #37355
David GoldParticipantThat’s strange. It started coming up for me as an app once I added my first Siri Shortcut. I see it in Shortcuts in the app list and when I click on it I see the scripts I have set up via Siri.
November 3, 2019 at 1:03 AM #37706
MarcusParticipantNeither
var text = Utils.copyTextFromClipboard();
nor
Utils.copyTextToClipboard('some text');
is working on iOS.
Is that programmatically possible at all ?November 3, 2019 at 2:08 AM #37709
BrendanKeymasterHi Marcus,
I just tested both these and they worked fine on iOS.
Are you using the latest 5.3.7 update?
November 3, 2019 at 5:40 AM #37714
MarcusParticipantHi Brendan,
yes, 5.3.7 (953) on an iPhone 8 Plus (iOS 13.1.3)Attachments:
You must be logged in to view attached files.November 3, 2019 at 12:47 PM #37724
David GoldParticipantThis is working fine for me.
November 3, 2019 at 12:56 PM #37725
MarcusParticipantOn an iPhone ?
I wish I could say the same.
There‘s not a lot what I could do wrong.November 3, 2019 at 1:07 PM #37726
David GoldParticipantYes on an iPhone but an 11 Pro Max running 13.2.
November 6, 2019 at 2:40 AM #37848
BrendanKeymasterHmm… I wonder if it’s a 13.2 issue? I’m also using an iPhone 11 Pro with iOS 13.2
December 7, 2020 at 5:41 PM #42810
SebastianParticipantHi. Same problem here: copying from clipboard not working when calling from Shortcuts. iPhone 12, iOS 14.2, latest version of TapForms.
December 8, 2020 at 12:30 AM #42812
Sam MoffattParticipantI just tested by deliver shipment shortcut and it worked fine with Siri and Tap Forms popped up a little note saying it was accessing the clipboard. Can you double check the settings app to make sure you’re permitting Tap Forms to get to the clipboard? Similarly, check to see if Shortcuts and your shortcut can also put items onto the clipboard as well.
December 8, 2020 at 2:28 AM #42813
SebastianParticipantHi again. I have attached a couple of videos where you will see that, in my case, Tap Forms is accessing the clipboard, but not when called from Shortcuts.
Attachments:
You must be logged in to view attached files.December 8, 2020 at 2:31 AM #42815
SebastianParticipantSorry, here goes the second video where you’ll see the problem.
Attachments:
You must be logged in to view attached files.December 8, 2020 at 10:33 PM #42821
Sam MoffattParticipantI recreated what I think you had. I created a form script that looks like this:
function Copy_Pasta() { Utils.copyTextToClipboard("My data - " + new Date()); return hello_world; } Copy_Pasta();
Saved it, added it to Siri, enabled Siri, validated that it worked. I then went into Shortcuts, updated the “Run” script that Tap Forms created to disable the “show when run” option, created a new shortcut to run the Shortcut that Tap Forms created and then retrieved the clipboard. Since it copies the date, I can see if it is executing each time. I did also note that the input for my call to the “Run” shortcut listed the clipboard as the input under the “more” option but I’m not sure that matters.
Do you mind using something simple like the above to validate that it’s working and changing over time?
December 9, 2020 at 1:18 AM #42822
SebastianParticipantHi,
The problem is with copyTextFromClipbard, not with the “To” version.
Please, try calling this script from Shortcuts:
function Copy_Pasta() { // Retrieve the content of the clipboard sent by Shortcuts var info = Utils.copyTextFromClipboard(); // Send back the content of the clipboard to see if it has been correctly retrieved: Utils.copyTextToClipboard(info); return info; }
Your testing shortcut may be something like this:
1. Copy something to the clipboard.
2. Call the Tap Forms script “Copy_Pasta”.
3. Retrieve the content of the clipboard (here is where I get ‘undefined’).Thanks for your interest in this matter.
December 9, 2020 at 12:46 PM #42824
Sam MoffattParticipantOk, so a much simpler test case, just executing this script added via “Add to Siri” in Shortcuts app on its own is enough to reproduce the problem:
function Copy_Pasta() { return "Clipboard contents: " + Utils.copyTextFromClipboard(); } Copy_Pasta();
I checked what I was doing and I’m using Shortcuts x-callback-url to trigger the script which explains why it works for me when I do it and not when executed directly through the Shortcuts UI.
I did a quick search and someone mentioned it as a bug for one of the iOS 13 betas but haven’t seen anything else. It could be that Apple is emptying the pasteboard within Shortcuts or at least the context that it hands to Tap Forms as a privacy measure. There might also be a privilege that the intent needs to flag to get the clipboard contents as well but I don’t recall seeing that last I looked.
December 9, 2020 at 8:25 PM #42825
BrendanKeymasterHmm… I’m no really sure about all this. I’ll have to do some debugging with it to see what’s causing it. Siri Intents do run in a different process than the Tap Forms application. So it would seem like a privacy issue.
February 6, 2021 at 4:23 PM #43384
ArsAstronauticaParticipantThis seems the right place to ask. What I’d like to do is to have Siri search for a trimming that is in a particular field database file or field. I have a data base of things and if I’d like to be able to look something up and have Siri read back the item.
By way of simple example, say I have a database of widgets. “Hey Siri what is the size of widget # 37”. The shortcut would tell Siri to look in file xyz.db in the # field and return the size field.
That seems to be doable in AppleScript (I think), but I’de like this as a iPhone/iPad shortcut of course.
February 7, 2021 at 9:54 AM #43385
Sam MoffattParticipantThere are two problems with making this happen now: the first is that as far as I know the Tap Forms’ Siri integration doesn’t have a way of passing data into it to make that happen and the second is that the Siri Intent API is rather prescriptive on how phrases are defined by the application ahead of time without a run time ability to handle it dynamically.
What I’ve done before is using Siri Shortcuts and setup prompts within it and used the CouchDB integration to do Siri Shortcut based creation with prompts. It’s not the easier thing to build in the Siri Shortcuts interface, particularly on a phone, but it is a pathway that does work. It requires you to have access to that web infrastructure to answer the question though.
-
AuthorPosts
You must be logged in to reply to this topic.