2

I must be missing something with Apple Shortcuts.

Once you have a result, how can you get it written in the application you're using if it's not an application in Shortcuts catalogue ?

Let's say for the sake of simplicity I want to use a shortcut that writes my name at the cursor location in my application

At some point I can finish the shortcuts "program" with
copy text to clipboard

At that point I only need to press cmd-V to get it done

But what if I want Shortcut to do it ?

I can't figure it out

I could maybe get an AppleScript to use system events to do it but this seems overkill.

Any idea ?

10
  • To control the keyboard, you are looking at running a script.
    – red_menace
    Commented Sep 27, 2022 at 22:06
  • Not really, I am hoping that I could get a script to achieve its results, without the need to complete it by an additional keyboard stroke.
    – Hugues
    Commented Sep 27, 2022 at 22:11
  • Yes, you would need to use something like Run AppleScript to control the keyboard (perform the keystroke).
    – red_menace
    Commented Sep 27, 2022 at 22:15
  • Actually, all I want is getting the output of the shortcut inside my app. I suggested using the clipboard then the keyboard, or alternatively running an AppleScript to send system events (which I understand is similar to your comment about controlling the keyboard). So your point is that it is the only way ?
    – Hugues
    Commented Sep 27, 2022 at 22:23
  • Well, to use System Events you would need to use an AppleScript, but couldn’t you also use a Run AppleScript to launch the app with the appropriate arguments, or have the app just get the clipboard itself?
    – red_menace
    Commented Sep 27, 2022 at 22:39

2 Answers 2

1

There is a built-in option to do what you want In the shortcut options menu (🛈 in the right top side) mark "Use as Quick Action" and in the sub-menu of that mark "Provide Output".

When those are set, running the shortcut when a text field is active will enter the output at the cursor or replace the selected text. shortcuts option menu

You can also mark "Services Menu" if you want to run it from the services option under the app main menu tab and in supporting apps by right-clicking within any text field.

Here you can see how my convert input shortcut appears in a Webex conversation right click services menu in webex conversation and in the app services menu. Webex app services menue

5
  • Thanks for your answer. I'm afraid since I posted the question I forgot the precise use case I was really looking for, and now realise I need most of the time to make the text field active, which is an additional requirement, and depending from the targeted app. Also, it may be impossible on the iPhone without touching the screen, which breaks the flow of the shortcut
    – Hugues
    Commented Jun 29 at 21:40
  • @Hugues from your comments in the original question, it seems that your use case was a Mac not an ios for an ios could be your answer will work I am not sure. About making the text field active that's required in your answer also and there cant be any other way for the shortcuts app to work on any text field in the system
    – yehsuf
    Commented Jun 30 at 5:49
  • On the Mac, for many apps once activated, you often can get to activate the text field input by typing tab, so it is possible to AppleScript the GUI. However not on the iPhone. I made you the former answer because your proposed solution did not work on the only use case I currently have, which is on iPhone. Thanks again for taking the time to write it.
    – Hugues
    Commented Jul 1 at 17:07
  • @Hugues I wrote it for the sake of other people searching like I did maybe it will also be helpful for them if you accept my answer
    – yehsuf
    Commented Jul 1 at 17:35
  • 1
    As per my other comment I thought I had already closed the topic. I just accepted your answer.
    – Hugues
    Commented Jul 3 at 13:14
1

Given the answers received, I consider the topic closed. On top of that, using an apple script is not as difficult as I imagined

You only need to add two shortcuts steps:

Get Clipboard
Execute AppleScript 

with the corresponding script

on run {input, parameters}
    tell application "System Events"
        keystroke "v" using {command down}
        return input
    end tell
end run
1
  • 1
    To use this solution (maybe it will work on iOS can't test it as I don't have one) you can save the get clipboard step the command + v keystroke will get the clipboard natively with no need for the shortcut to do it.
    – yehsuf
    Commented Jun 30 at 5:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .