Advertisement
Guest User

Six Colors script v5

a guest
Oct 30th, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. on run {input, parameters}
  2.     repeat with fileAlias in input
  3.        
  4.        
  5.         set filePath to (POSIX path of fileAlias)
  6.        
  7.         set fileWithPath to (characters 1 thru ((offset of "." in filePath) - 1) of filePath) as string
  8.        
  9.         set the1xFile to (fileWithPath & "-6c.jpg")
  10.         set the2xFile to (fileWithPath & "-6c@2x.jpg")
  11.        
  12.         tell application "Acorn"
  13.             set doc to open (POSIX path of fileAlias)
  14.             tell doc
  15.                 set w to width
  16.                 set h to height
  17.                 if (w - 20) > h then
  18.                     web export in the1xFile as JPEG quality 60 width 680
  19.                     web export in the2xFile as JPEG quality 50 width 1360
  20.                 else
  21.                     web export in the1xFile as JPEG quality 60 width 340
  22.                     web export in the2xFile as JPEG quality 50 width 680
  23.                 end if
  24.                 close
  25.             end tell
  26.         end tell
  27.        
  28.        
  29.         tell application "Transmit"
  30.             -- Prevent interactive alerts from popping up during script execution
  31.             set SuppressAppleScriptAlerts to true
  32.            
  33.             set myFave to item 1 of (favorites whose name is "sixcolors")
  34.            
  35.             -- Create a new window (and thus a single tab) for the script
  36.             tell current tab of (make new document at end)
  37.                 connect to myFave
  38.                 change location of remote browser to path "/local/www/sixcolors.com/www/doc/images/content/"
  39.                
  40.                 tell remote browser
  41.                     upload item at path (fileWithPath & "-6c.jpg")
  42.                     upload item at path (fileWithPath & "-6c@2x.jpg")
  43.                 end tell
  44.                
  45.                 -- disconnect
  46.                 close remote browser
  47.             end tell
  48.         end tell
  49.        
  50.     end repeat
  51.     return input
  52. end run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement