How can I create a touch bar button that when pressed does the following:
- switches to firefox (which is always open)
- creates a new tab
- pastes this text:
- Moves the cursor to between the inverted commas and waits for my input
and that's it!
make a new touchbar button
Open application Firefox
Delay next action by 0.5 (this is to give time for Firefox to load up
Send keyboard shortcut: Cmd + T
Delay next action by 0.25 (to give time for a new tab to open)
Type custom text: site:www.xyz.com "" (Make sure you select 'Insert text by typing'.) Then change Move Text Cursor Left are Pasting from 0 to 1, and it should be between the "".
This should now work. If it doesnt, you might need to increase the delay next actions by a bit.
I don't have Firefox, so I can't test it, but it works when I do it on safari
thanks so much That worked perfectly, but for some reason, at the end of the action, all my open windows move to show the desktop (I think this is called Expose on Mac). Any idea how to stop that from happening?
hmm, that's weird. I have no idea why that could be.
at the end, you can add another delay next action by 0.25, then add a send keyboard shortcut:
command + f3. this should undo the expose thing.
Would work, is super hacky though!
May I ask what you want to achieve? Because I think a little workaround could be a little scripting work, where a search box opens and asks you for you input (your last described step would basically happen first) and then a new tab could be opened with these properties. I tried to make a little test run, had trouble though because of the inverted commas. So if you could tell what you want to achieve I might find a solution for this
Edit: made it way easier. Took @Future_Face's idea and made it fit to what you need (for sure I guess)
Please keep in mind that, depending on the workload of your computer, this might not work and the text might be pasted in the digital nirvana! That's why I though initially about Apple Script
so the delays aren't needed?
With the first setup yes, they are needed.
The second one I gave sends the ⌘T to the specific desired app, not to the frontmost (what happens with the classic keyboard shortcut). And the one before pasting the specific text might be needed. I tried it on my computer, it was not needed so I didn't put it. But generally you are right, the construction of the User Interface (UI) build up takes time especially when a heavy workload is in the processor. That's why I was thinking of Apple Script, because when scripting you can tell the system what to do, not the UI what it has to tell to the system. It short circuits the time delay.