[Cyberduck-trac] [Cyberduck] #666: better sample applescript for screenshots

Cyberduck trac at trac.cyberduck.ch
Mon Aug 14 05:01:19 CEST 2006


#666: better sample applescript for screenshots
---------------------------+------------------------------------------------
 Reporter:  court3nay      |       Owner:  dkocher
     Type:  enhancement    |      Status:  new    
 Priority:  normal         |   Milestone:         
Component:  documentation  |     Version:  2.6    
 Severity:  normal         |    Keywords:         
---------------------------+------------------------------------------------
 modifications:
 1. saves the snapshot as png initially so you don't have to convert from
 pdf
 2. tells cyberduck to close the window, NOT quit the whole app (duh!)

 Here's the relevant section
 {{{
 -- take the screenshot
 delay 1.5
 do shell script "/usr/sbin/screencapture -tpng " & image_location & ".png"

 -- do the image stuffs
 try
         tell application "Image Events"
                 launch
                 -- get the image from the clipboard
                 set the_image to open image_location & ".png"
                 -- resize image for thumb
                 scale the_image to size 133
                 -- save the thumb as png
                 save the_image as PNG in thumb_location & ".thumb.png"
                 close the_image
         end tell
 on error error_message
         display dialog error_message
 end try
 -- upload the image and thumbs with Cyberduck
 try
         tell application "Cyberduck"
                 activate
                 set theBrowser to (make new browser)
                 try
                         tell (theBrowser)
                                 set encoding to "UTF-8"
                                 connect to theServer with protocol
 theProtocol as user theUser with initial folder theRemoteFolder
                                 upload file image_location & ".png"
                                 upload file thumb_location & ".thumb.png"
                                 disconnect
                                 close
                         end tell
                 on error error_message
                         display dialog error_message
                 end try
                 -- quit
         end tell
 on error error_message
         display dialog error_message
 end try
 }}}

-- 
Ticket URL: <http://trac.cyberduck.ch/ticket/666>
Cyberduck <http://cyberduck.ch>
FTP and SFTP Browser for Mac OS X.


More information about the Cyberduck-trac mailing list