I often select text before hitting the Send to Pukka bookmarklet. In order to make it clear that it is an excerpt and not my comments, I want to wrap the selected text that goes into the Description field in quotation marks.
What changes do I need to do to the javascript in the bookmarklet? Thanks.
Thanks, Justin. That worked perfectly.
How do I replicate this in the code within NetNewsWire?
I'm not sure if that is possible directly. NNW uses a inter-app protocol to send this info, rather than a pukka:// bookmarklet with a format that I designed.
Probably the best alternative would be to write an AppleScript (basically, 1. get current NNW post 2. add quotes 3. send to Pukka) and associate it with a hot key for use in NNW instead of the built-in posting.
Give this AppleScript a try and let me know what you think. I couldn't get it to trim whitespace, so you'll either have to do it manually or be sure not to highlight whitespace, but otherwise, it works pretty well in my testing.
-- get NNW URL & title tell application "NetNewsWire" activate set theURL to the URL of the selectedHeadline set theTitle to the the title of the selectedHeadline end tell -- manually copy selected text tell application "System Events" delay 0.1 keystroke "c" using command down end tell -- reset & send info to Pukka tell application "Pukka" reset set post URL to theURL set post title to theTitle set post description to "\"" & (the clipboard) & "\"" activate end tell -- focus Pukka's tags field tell application "System Events" delay 0.1 keystroke tab keystroke tab end tell
Nope. I cut-pasted the code above in the Apple Script editor and saved as a .scpt file in the Scripts folder for NetNewsWire. But when I click on it, it strangely selects the text in the default browser and not the NetNewsWire browser.
Hmm, it's working for me. I'm not sure how any browser would be involved, as it's not called from the script. Does it make a difference if you are using tabs in NNW vs. just one view in it?
Honestly, I've no clue either. When I click on the Pukka script inside NNW, it just hangs and gives an error ding after a while but opens no dialog box. I think I may be cut-pasting the script wrong. Can you give me a link to a downloadable script file that I can save in the scripts/ folder for NNW?
Give this a try: http://codesorcery.net/sites/default/files/Send%20to%20Pukka.zip
Nope. Same problem.
Strangely all other custom scripts like Share with Tumblr, Bookmark to Pinboard, TwitNews, and even the Readability javascripts work just fine. Anyway, it was a minor quibble. The 'Post to Delicious' works fine. Thanks anyway.
I have NNW 3.2.5; dunno if that makes a difference.
How about this one? This uses the pukka:// protocol instead of AppleScript commands to pass the info to Pukka.
-- get NNW URL & title tell application "NetNewsWire" activate set theURL to the URL of the selectedHeadline set theTitle to the the title of the selectedHeadline end tell -- manually copy selected text tell application "System Events" delay 0.1 keystroke "c" using command down end tell -- send info to Pukka tell application "Finder" open location "pukka:url=" & theURL & "&title=" & theTitle & "&extended=\"" & (the clipboard) & "\"" end tell
I tried that and after showing the busy wheel for a while, it gave me this screen - http://imgur.com/fqwzY (selection is in grey)
I think we're onto something now. Your screenshot shows a tabbed browser window in NNW, not an article body in the summary view. I have been testing in the summary view as I don't use NNW's built-in browser. I will see if I can get things to work with the browser and report back.
Yeah, I think we're at an impasse with this. NNW's concept of "selectedHeadline" in AppleScript only refers to the headline browser, not the web browser tabs. This does not appear to be scriptable, so the built-in NNW command to send info to Pukka will have to be used.
I would recommend you send a feature request to Brent for exposing the browser tabs to scripting. Sorry for the bad news, but I'm glad we at least got to the bottom of the issue.
Ah! thanks. Glad to know I wasn't seeing things. Perhaps I should've shared a screenshot sooner. I'll send this thread to Brent, as you suggested. Hopefully, he will make the necessary changes in his next update.
Justin,
Similar to quotation marks, is it possible to wrap the selected text in the blockquote tags? What changes do I have to make?
Using this as the bookmarklet text seems to do the trick for me:
javascript:document.location.href='pukka:url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&extended=<blockquote>'+encodeURIComponent(window.getSelection())+'</blockquote>';
Well, it does add the tag but the tags don't act as the blockquote tag and instead appear as text in the description. I use my bookmark feed to import links to my blog and this is how it appears now: http://www.ipatrix.com/3570/34-awesome-products-geeks-will-love/
Ah, I see. I was kind of wondering what the use was. I'm not sure how you can get those to come through, as anything which does syndication is probably going to escape content markup to bring it through as literals, as you've seen. I'm not sure there is anything you could put into the actual Delicious item that would let it come through as you intend.
Never mind. I can insert the blockquote tag in the template that I use to make those posts on my blog but then any personal comment I add after the text excerpt also gets blockquoted since it is technically also a part of the Description field. I guess, I'll stick to using quotation marks.



There were only a couple tweaks to the bookmarklet. Try this: