Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2017
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. -- set theUsername to "my@example.org"
  2. -- set thePassword to "mybirthday"
  3.  
  4. tell application "Safari"
  5. set theWindow to front window
  6. set theTabs to theWindow's tabs --of every window
  7. repeat with eachTab in theTabs
  8. -- send current URL to instapaper
  9. set theInstapaperResult to do shell script "curl "https://www.instapaper.com/api/add?username=" & theUsername & "&password=" & thePassword & "&url=" & URL of eachTab & """
  10. if theInstapaperResult is "403" then
  11. display dialog "Seems like your username / password doesn't match" buttons ("Continue") default button 1 with icon stop
  12. return
  13. else
  14. if theInstapaperResult is not "201" then
  15. display dialog "Something went wrong, I'm not sure what at this moment" buttons ("Continue") default button 1 with icon stop
  16. return
  17. end if
  18. end if
  19. close eachTab
  20. end repeat
  21.  
  22. -- if the window wasn't closed by closing the last tab, close it now :)
  23. if theWindow exists then
  24. close theWindow
  25. end if
  26.  
  27. end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement