AppleScript: PixelPipe Uploader
11/01/2011Mir hat diese Sache aus dem AppleScript-Forum keine Ruhe gelassen auch wenn ein Plug-in für Safari da wohl etwas mehr her gemacht hätte. Zur Zeit ist aber leider nix anderes drin außer AppleScript. Es gibt 2 Versionen von dem Skript, eine als Skript-Datei, die man direkt aus Safari oder einem anderen Browser aus starten kann und eines das via Drag&Drop Dateien zu Pixelpipe hoch lädt. Die Script-Datei holt sich den Link zur einem Bild aus der Zwischenablage, lädt dieses herunter und pumpt es dann hoch auf PixelPipe. Das Programm lädt jede Bild-Datei hoch, die zuvor darauf gezogen wurde... Ich für meinen Teil werde Pixelpipe wohl kaum nutzen, aber in dem Quellcode sind so einige nützliche Sachen drin (URL-Escapeing, Curl-Form-Upload, Keychain-Scripting...)
Skript-Datei und Skript-Programm
DOWNLOADhubionmac's PixelPipe Uploader v.0.1
59.6 kB (102 hits)
AppleScript: Bild-Datein und PDFs weg sortieren…
19/03/2010on open thefolder
if (count of thefolder) = 1 then
tell application "Finder"
set thefolder to (item 1 of thefolder) as alias
set thefolder_posix to POSIX path of (thefolder as alias)
set sort_destis to name of every folder of thefolder
set thepdfs to every file of thefolder
repeat with thepdf in thepdfs
if name of thepdf ends with ".pdf" or name of thepdf ends with ".png" or name of thepdf ends with ".jpg" or name of thepdf ends with ".gif" or name of thepdf ends with ".psd" then
set thepdf_posix to POSIX path of (thepdf as alias)
do shell script "open -a /Applications/Preview.app " & quoted form of thepdf_posix
tell me to activate
tell me to set thedesti to choose from list {"••NEW Folder••"} & sort_destis with prompt "In welchen Ordner verschieben?"
if thedesti as text = "••NEW Folder••" then
set newfoldername to ""
repeat until newfoldername ≠ ""
tell me to set newfoldername to text returned of (display dialog "Name of new Folder" default answer "")
try
do shell script "cd " & quoted form of thefolder_posix & ";mkdir " & quoted form of newfoldername
end try
set thedesti to newfoldername
end repeat
end if
tell application "Preview"
activate
--kleiner Pfusch, weil die Vorschau keine AppleScript-Befehle kennt...
tell application "System Events"
keystroke "w" using command down
end tell
end tell
do shell script "mv " & quoted form of thepdf_posix & " '" & thefolder_posix & thedesti & "/" & my checkname_with_pdf_suffix(name of thepdf, ((thefolder & thedesti) as text) as alias, false) & "'"
end if
end repeat
end tell
tell me to activate
tell me to display dialog "bin am Ende"
end if
end open
on checkname_with_pdf_suffix(n, D, looped)
tell application "Finder"
set thefiles to name of every item of (D as alias)
end tell
if thefiles contains n then
if looped = false then
set n to ((characters 1 through -5 of n) & " 1" & (characters -4 through -1 of n)) as text
my checkname_with_pdf_suffix(n, D, true)
else
set tmp to (last word of ((characters 1 through -5 of n) as text) as integer)
set tmpcount to (count of characters of (tmp as text)) + 5
set tmp to tmp + 1
set n to ((characters 1 through (-1 * tmpcount) of n) & tmp & (characters -4 through -1 of n)) as text
my checkname_with_pdf_suffix(n, D, true)
end if
else
return n
end if
end checkname_with_pdf_suffix