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.
There were only a couple tweaks to the bookmarklet. Try this:
javascript:document.location.href='pukka:url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)+'&extended="'+encodeURIComponent(window.getSelection()+'"');
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 tellHmm, 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?
Give this a try: http://codesorcery.net/sites/default/files/Send%20to%20Pukka.zip
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 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.
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>';
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.



Thanks, Justin. That worked perfectly.
How do I replicate this in the code within NetNewsWire?