|
|
10.5: Take and upload screenshots via Automator
Here's a little applescript to do the same thing without the automator and shell script effort. It has error checking too. Note: if you don't want to store your password in clear text in the script (not very secure!) you can look at post #5 here for a method of using the keychain to store/restore the password: http://macscripter.net/viewtopic.php?id=25536
-- variables
set ftpHost to "ftp.site.com"
set ftpUserName to "ftp user name"
set ftpPassword to "ftp password"
set ftpRemotePath to "/tmpScreen.png"
set screencapturePath to (path to desktop folder as text) & "tmpScreen.png"
set webImageURL to "http://www.somewhere.com/tmpScreen.png"
-- take the screenshot
do shell script "/usr/sbin/screencapture " & quoted form of POSIX path of screencapturePath
-- ftp upload
set ftpURL to "ftp://" & ftpUserName & ":" & ftpPassword & "@" & ftpHost & ftpRemotePath
set hadSuccess to false
try
tell application "URL Access Scripting" to upload file screencapturePath to ftpURL replacing yes with binhexing
set hadSuccess to true
on error theError number errorNumber
if errorNumber is not -128 then
tell me
activate
display dialog "There was an error:" & return & return & theError & return & "Error Number: " & errorNumber as text buttons {"OK"} default button 1 with icon stop
end tell
end if
end try
-- delete the screenshot
do shell script "rm " & quoted form of POSIX path of screencapturePath
-- open the website file
if hadSuccess then open location webImageURLEdited on Feb 19, '10 10:43:21AM by robg
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.16 seconds |
|