Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on run {input, parameters}
- set theFile to POSIX path of (item 2 of input)
- set clipsend to ""
- set theYear to (year of (current date)) as string
- set theMonth to (month of (current date) as integer) as string
- set theColumns to {341, 3365, 6278, 9296}
- set theRows to {295, 2144, 3916, 5799, 7579, 9417, 11305, 13139}
- set theRowCount to 0
- set theColumnCount to 0
- repeat with xValue in theColumns
- set theColumnCount to (theColumnCount + 1)
- repeat with yValue in theRows
- set theRowCount to (theRowCount + 1)
- set theFileName to ("financials-" & theYear & "-" & theMonth & "-" & theColumnCount & "-" & theRowCount & ".png")
- set theScript to "/usr/local/bin/convert '" & theFile & "' -crop 2637x1612+" & (xValue as string) & "+" & (yValue as string) & " -resize 1360x833 '/Users/user/Desktop/" & theFileName & "'"
- do shell script theScript
- set clipsend to (clipsend & "<figure><img src=\"https://sixcolors.com/images/content/" & theYear & "/" & theFileName & "\" alt=\"\" />" & return & "<figcaption></figcaption>" & return & "</figure>" & return & return)
- set theSCPcommand to ("scp '/Users/user/Desktop/" & theFileName & "' user@domain.com:/local/www/images/content/" & theYear & "/")
- do shell script theSCPcommand
- end repeat
- set theRowCount to 0
- end repeat
- set the clipboard to (clipsend)
- display notification ("All chart images were processed and uploaded.")
- return input
- end run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement