pilotmoon / PopClip-Extensions

Source code for extensions in the official PopClip Extensions directory.
https://www.popclip.app/extensions/
MIT License
1.92k stars 440 forks source link

How do you invoke notification center to tweet? #438

Closed ernestyao closed 10 years ago

ernestyao commented 10 years ago

I found two extensions in "source". One uses system service and one uses applescript. I found the applescript not running on my Mac in Chinese environment. "Window" cannot be found blah blah blah... But your extension with system service works perfect.

I want to write some separate workflows invoking NC to tweet and weibo. So would you please tell me what's the system service and how to write it? Do you use Automator?

Thank you in advance.

pilotmoon commented 10 years ago

Do you mean the Tweet extension (https://github.com/pilotmoon/PopClip-Extensions/tree/master/source/Tweet)?

For that, I made a tiny Cocoa executable to invoke NSSharingService for me. It is the file "MessageMaker" inside the Tweet extension directory.

The source code for MessageMaker is here: https://github.com/pilotmoon/PopClip-Extensions/tree/master/extras/MessageMaker

ernestyao commented 10 years ago

Thank you for your code and help. It works. I use an alfred workflow to invoke SinaWeibo and Twitter with same texts. Though I have to click two "confirm", it works!

webxl commented 9 years ago

@invariant I tried duplicating the Tweet extension in order to enable AirDrop, and it's not working. Do I need to sign it in order for it to work?

✔ /tmp/build/Airdrop.popclipext
00:09 $ cat drop.sh
# We direct to null so PopClip does not sit around trying to read from stdout.
# Otherwise PopClip blocks and shows the spinner.
./MessageMaker2.app/Contents/MacOS/MessageMaker2 com.apple.share.AirDrop.send text "$POPCLIP_TEXT" > /dev/null &
00:10 $ sh drop.sh
✔ /tmp/build/Airdrop.popclipext
00:10 $ 2015-09-25 00:10:30.252 MessageMaker2[84109:14208532] error with remoteObjectProxyWithErrorHandler: Error Domain=NSCocoaErrorDomain Code=4097 "connection from pid 84126" UserInfo={NSDebugDescription=connection from pid 84126}
2015-09-25 00:10:30.253 MessageMaker2[84109:14208554] plugin com.apple.share.AirDrop.send interrupted
2015-09-25 00:10:30.275 MessageMaker2[84109:14208554] plugin com.apple.share.AirDrop.send invalidated
pilotmoon commented 9 years ago

The problem is not Signing. It's probbaly something happening inside MessageMaker2. perhaps it can't handle com.apple.share.AirDrop.send (can that handle sending plain text?)

The source of MessageMaker2 is in the extras folder of this repo

On 25 Sep 2015, at 08:15, Matt Motherway notifications@github.com wrote:

@invariant I tried duplicating the Tweet extension in order to enable AirDrop, and it's not working. Do I need to sign it in order for it to work?

✔ /tmp/build/Airdrop.popclipext 00:09 $ cat drop.sh

We direct to null so PopClip does not sit around trying to read from stdout.

Otherwise PopClip blocks and shows the spinner.

./MessageMaker2.app/Contents/MacOS/MessageMaker2 com.apple.share.AirDrop.send text "$POPCLIP_TEXT" > /dev/null & 00:10 $ sh drop.sh ✔ /tmp/build/Airdrop.popclipext 00:10 $ 2015-09-25 00:10:30.252 MessageMaker2[84109:14208532] error with remoteObjectProxyWithErrorHandler: Error Domain=NSCocoaErrorDomain Code=4097 "connection from pid 84126" UserInfo={NSDebugDescription=connection from pid 84126} 2015-09-25 00:10:30.253 MessageMaker2[84109:14208554] plugin com.apple.share.AirDrop.send interrupted 2015-09-25 00:10:30.275 MessageMaker2[84109:14208554] plugin com.apple.share.AirDrop.send invalidated

— Reply to this email directly or view it on GitHub.

webxl commented 9 years ago

Yup, that was it. My bad.

Very nice utility BTW. I'm a little surprised the App Store let you submit something like this with all their sandboxing. But very polished and the # of extensions is very cool.

The point of this was that I was trying to replicate your utility because there's no Safari equivalent of right-click -> Share in Chrome, and automator + https://github.com/mattt/terminal-share is slow as molasses. Definitely worth $7 for the time it saved me.