SHARE
TWEET

Untitled

a guest Jul 18th, 2018 273 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. on run {input, parameters}
  2.    
  3.     set theFile to POSIX path of (item 2 of input)
  4.     set clipsend to ""
  5.     set theYear to (year of (current date)) as string
  6.     set theMonth to (month of (current date) as integer) as string
  7.    
  8.     set theColumns to {341, 3365, 6278, 9296}
  9.     set theRows to {295, 2144, 3916, 5799, 7579, 9417, 11305, 13139}
  10.     set theRowCount to 0
  11.     set theColumnCount to 0
  12.    
  13.     repeat with xValue in theColumns
  14.        
  15.         set theColumnCount to (theColumnCount + 1)
  16.        
  17.         repeat with yValue in theRows
  18.             set theRowCount to (theRowCount + 1)
  19.            
  20.             set theFileName to ("financials-" & theYear & "-" & theMonth & "-" & theColumnCount & "-" & theRowCount & ".png")
  21.            
  22.             set theScript to "/usr/local/bin/convert '" & theFile & "' -crop 2637x1612+" & (xValue as string) & "+" & (yValue as string) & " -resize 1360x833 '/Users/user/Desktop/" & theFileName & "'"
  23.             do shell script theScript
  24.            
  25.            
  26.             set clipsend to (clipsend & "<figure><img src=\"https://sixcolors.com/images/content/" & theYear & "/" & theFileName & "\" alt=\"\" />" & return & "<figcaption></figcaption>" & return & "</figure>" & return & return)
  27.            
  28.            
  29.             set theSCPcommand to ("scp '/Users/user/Desktop/" & theFileName & "' user@domain.com:/local/www/images/content/" & theYear & "/")
  30.            
  31.             do shell script theSCPcommand
  32.            
  33.            
  34.         end repeat
  35.        
  36.         set theRowCount to 0
  37.        
  38.     end repeat
  39.    
  40.     set the clipboard to (clipsend)
  41.    
  42.     display notification ("All chart images were processed and uploaded.") 
  43.    
  44.     return input
  45. end run
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top