Pinboard Save Bookmark Action

Sharing and discussing custom actions for LaunchBar

Pinboard Save Bookmark Action

Postby nickomore » Sun Jan 29, 2012 2:26 pm

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?
nickomore
 
Posts: 16
Joined: Thu Apr 01, 2010 9:21 am

Re: Pinboard Save Bookmark Action

Postby manfred » Tue Jan 31, 2012 5:43 pm

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!
manfred
Objective Development
Objective Development
 
Posts: 555
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna

Re: Pinboard Save Bookmark Action

Postby nickomore » Thu Feb 02, 2012 1:33 pm

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.
nickomore
 
Posts: 16
Joined: Thu Apr 01, 2010 9:21 am

Re: Pinboard Save Bookmark Action

Postby manfred » Thu Feb 02, 2012 2:53 pm

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.
manfred
Objective Development
Objective Development
 
Posts: 555
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna

Re: Pinboard Save Bookmark Action

Postby nickomore » Thu Feb 02, 2012 3:08 pm

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?
nickomore
 
Posts: 16
Joined: Thu Apr 01, 2010 9:21 am

Re: Pinboard Save Bookmark Action

Postby manfred » Thu Feb 02, 2012 3:27 pm

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
manfred
Objective Development
Objective Development
 
Posts: 555
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna

Re: Pinboard Save Bookmark Action

Postby nickomore » Thu Feb 02, 2012 3:48 pm

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.
nickomore
 
Posts: 16
Joined: Thu Apr 01, 2010 9:21 am

Re: Pinboard Save Bookmark Action

Postby manfred » Thu Feb 02, 2012 4:43 pm

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
manfred
Objective Development
Objective Development
 
Posts: 555
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna

Re: Pinboard Save Bookmark Action

Postby nickomore » Thu Feb 02, 2012 8:57 pm

I get an error.

Image
nickomore
 
Posts: 16
Joined: Thu Apr 01, 2010 9:21 am

Re: Pinboard Save Bookmark Action

Postby manfred » Sun Feb 05, 2012 4:32 pm

Please contact our support via email. Thanks!
manfred
Objective Development
Objective Development
 
Posts: 555
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna

Re: Pinboard Save Bookmark Action

Postby kaiijy » Thu Dec 27, 2012 8:21 am

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 :(
kaiijy
 
Posts: 4
Joined: Thu Dec 27, 2012 8:19 am


Return to LaunchBar Actions

Who is online

Users browsing this forum: No registered users and 1 guest