on run {input, parameters}
repeat with fileAlias in input
set filePath to (POSIX path of fileAlias)
set fileWithPath to (characters 1 thru ((offset of "." in filePath) - 1) of filePath) as string
set the1xFile to (fileWithPath & "-6c.jpg")
set the2xFile to (fileWithPath & "-6c@2x.jpg")
tell application "Acorn"
set doc to open (POSIX path of fileAlias)
tell doc
set w to width
set h to height
if (w - 20) > h then
web export in the1xFile as JPEG quality 60 width 680
web export in the2xFile as JPEG quality 50 width 1360
else
web export in the1xFile as JPEG quality 60 width 340
web export in the2xFile as JPEG quality 50 width 680
end if
close
end tell
end tell
tell application "Transmit"
-- Prevent interactive alerts from popping up during script execution
set SuppressAppleScriptAlerts to true
set myFave to item 1 of (favorites whose name is "sixcolors")
-- Create a new window (and thus a single tab) for the script
tell current tab of (make new document at end)
connect to myFave
change location of remote browser to path "doc/images/content/"
tell remote browser
upload item at path the1xFile
upload item at path the2xFile
end tell
end tell
end tell
end repeat
return input
end run