Una de las mejores ideas que pudieron tener en Apple con la inclusión de los servicios en Mac OS X Snow Leopard desde Automator, brindándonos un sencillo acceso al menú contextual de todas las aplicaciones con diversas acciones interesantes.
La de hoy es muy sencilla de hacer y quiere una única cosa: que tengamos cuenta en Bit.ly. Por lo demás todo consiste en estos pasos:
- Abre Automator.
- Elige crear un nuevo servicio.
- Añade la acción “Ejecutar AppleScript”.
- Copia el código que dejo tras el salto modificando tu login y tu API_KEY.
¡Hecho! Ahora podrás acortar enlaces con Bit.ly desde el menú contextual e irán directos a tu portapapeles.
Fuente | Zettt
on run {input, parameters}
set login to "YourLogin"
set apiKey to "YourAPIKey"
-- this one makes it easier to handle the input
-- as it transforms the input into a (fixed) text object
set inputURL to input as string
-- error handling
if inputURL does not start with "http" then
-- we don't have an http in front so let's check if
-- we find anything useful in the inputURL
if inputURL begins with "www" then
set inputURL to "http://" & inputURL
else
set inputURL to check_clipboard(inputURL)
end if
-- there's still nothing useful so let's break
else
display dialog "This action needs a valid http address either to be on the clipboard or selected!"
return
end if
-- shorten the url
set bitlyCommand to "http://api.bit.ly/shorten?version=2.0.1&longUrl=" & inputURL & "&login=" & login & "&apiKey=" & apiKey & ""
set shortURL to do shell script "curl " & quoted form of bitlyCommand & " | grep shortUrl | awk '{print $2}' | sed 's/[",]//g'"
-- set clipboard contents to the new short url
-- and paste it into the textfield
set the clipboard to shortURL as text
tell application "System Events"
keystroke "v" using command down
end tell
return input
end run
-- Check if there is a link on the clipboard already
on check_clipboard(inputURL)
set clipboard_contents to the clipboard as text
if clipboard_contents contains "http"then
set inputURL to clipboard_contents
end if
return inputURL
end check_clipboard




ok lo hice y aparece el nombre que le puse pero no se donde quedan los enlaces ya acortados pueden decirme.?? on en su defecto como lo desinstalo
Tu valoración:
0
0