Wednesday, November 20, 2019

#1 2019-07-25 04:25:37 pm

steveray100
Member
Registered: 2018-10-05
Posts: 1

Why is pbpaste not working

i have a shell script in Automator run as a Service/quick Action
workflow receives current text in any application
Run Shell Script:
pbcopy
python -m webbrowser https://translate.google.com/?hl=en&tab=wT
sleep 3s
pbpaste

I highlight the text, run the service, pbcopy copies it to the clipboard, the python command opens Google Translate, the sleep command lets the web site fully load so I have a nice blinking cursor in the text box But it won't paste automatically. I have to manually do it through the Paste menu item.or command-v. Any ideas?
I used a little piece of applescript to replace the pbpaste part but I'm still can't figure out why pbpaste doesn't paste anything

Model: macbook pro 23" mid 2012
AppleScript: current
Browser: Firefox 68.0
Operating System: macOS 10.14


Filed under: shell script

Offline

 

#2 2019-07-26 06:06:47 am

Nigel Garvey
Moderator
From:: Warwickshire, England
Registered: 2002-11-20
Posts: 5105

Re: Why is pbpaste not working

Hi. Welcome to MacScripter.

As far as I can tell from pbpaste's 'man' page and from testing in Script Editor, pbpaste only feeds the pasteboard contents to the standard output — and only if they're ASCII, RTF, or PS data. Pasting the contents into an application is usually the responsibility of the application itself.

Apart from that, I can't help. But I see that Automator Quick Actions have a check box for a setting called "Output replaces selected text". Have you tried that?


NG

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)