Page 1 of 1

Pinboard Save Bookmark Action

Posted: Sun Jan 29, 2012 2:26 pm
by nickomore
I use Pinboard and want to be able to add via LaunchBar instead of cursor to bookmarkbar or bookmark hotkey command+4 - where the javascript bookmarklet is located on my bookmarkbar. Anyone know how to do this?

Re: Pinboard Save Bookmark Action

Posted: Tue Jan 31, 2012 5:43 pm
by manfred
It should work similar to my Instapaper Action:

Code: Select all

on handle_string(_url)
   set _username to "your username"
   set _password to "your password"
   
   set _rtnValue to do shell script "curl -s --user " & _username & ":" & _password & " --data-urlencode url=" & _url & " https://api.pinboard.in/v1/posts/add"
   
   display dialog _rtnValue
end handle_string


Please note: It's not tested because I do not have a pinpoard account!

Re: Pinboard Save Bookmark Action

Posted: Thu Feb 02, 2012 1:33 pm
by nickomore
This doesnt seem to work. I changed the username & password in the script as you said but it just does nothing. Would also be nice to have growl support, but getting it working first would be good. Thanks for you attempt. If you can give it another got that would be good.

Re: Pinboard Save Bookmark Action

Posted: Thu Feb 02, 2012 2:53 pm
by manfred
You need to call this script via LaunchBar, press Space or Return and enter a URL in the textfield. Selecting a URL pressing TAB and selecting the script afterwards works too.

Alternatively if you just want to the test the script in your AppleScript Editor add the following line:

Code: Select all

handle_string("http://www.google.com")

Of course feel free to change the url.

If it's still not working, just let me know what the popups looks like.

Re: Pinboard Save Bookmark Action

Posted: Thu Feb 02, 2012 3:08 pm
by nickomore
Oh. I thought it would grab the url from safari the same way the bookmarklet does. Can this be done?

Is there an action to grab the current url without instand send function. Or do you have to goto safari history etc?

Re: Pinboard Save Bookmark Action

Posted: Thu Feb 02, 2012 3:27 pm
by manfred
You can use this snippet to get the current URL from Safari:

Code: Select all

tell application "LaunchBar" to hide
tell application "Safari" to set _currentURL to URL of current tab of window 1

if _currentURL is not "" then

end if

Re: Pinboard Save Bookmark Action

Posted: Thu Feb 02, 2012 3:48 pm
by nickomore
I get "Expected “else”, etc. but found unknown token." when i run this. How is this script meant to be used?

Sorry, i should point out that im a complete 'noob' with scripts etc. At the moment all I've done is copied other peoples into Applescript Editor and saved them as "run" and put them in the action folder. I do plan to learn more.

Re: Pinboard Save Bookmark Action

Posted: Thu Feb 02, 2012 4:43 pm
by manfred
Attached a combined version. Again change your username and password. Let me know if it works!

Code: Select all

set _username to "username"
set _password to "password"

tell application "LaunchBar" to hide
tell application "Safari" to set _currentURL to URL of current tab of window 1

if _currentURL is not "" then
   set _rtnValue to do shell script "curl -s --user " & _username & ":" & _password & " --data-urlencode url=" & (quoted form of _currentURL) & " https://api.pinboard.in/v1/posts/add"
   
   display dialog _rtnValue
end if

Re: Pinboard Save Bookmark Action

Posted: Thu Feb 02, 2012 8:57 pm
by nickomore
I get an error.

Image

Re: Pinboard Save Bookmark Action

Posted: Sun Feb 05, 2012 4:32 pm
by manfred
Please contact our support via email. Thanks!

Re: Pinboard Save Bookmark Action

Posted: Thu Dec 27, 2012 8:21 am
by kaiijy
I possibly get the same error.

Image

Did anyone found a clear solution to this? I couldn't manage to make that Brett script to work either :(