Thursday, August 11, 2022

#1 2022-08-06 03:55:04 am

From:: Greece
Registered: 2019-03-03
Posts: 2443 Send Interactive Screenshot to To Recipient


set toRecipientAddress to ""
my sendScreenShot(toRecipientAddress)

on sendScreenShot(toRecipientAddress)
   set buttonReturned to button returned of (display dialog "Capture selection to Mail or to the Desktop." buttons {"To Mail", "To Desktop", "Cancel"} default button "Cancel" cancel button "Cancel" with title "Welcome to Take Screenshot")
   if buttonReturned is "To Desktop" then
       my createScreenchotInteractivelly(path to desktop folder)
   else if buttonReturned is "Cancel" then
       display notification "User cancelled"
       set tempFolder to path to temporary items from user domain
       set theDate to my createScreenchotInteractivelly(tempFolder)
       tell application "Finder"
           sort files of tempFolder by modification date
           set recentScreenshot to (last item of result) as alias
       end tell
       tell application "Mail"
           tell (make new outgoing message with properties {subject:"Data you requested", content:(theDate & return & return), visible:true})
               make new to recipient at end of to recipients with properties {address:toRecipientAddress}
               tell content to make new attachment with properties {file name:recentScreenshot} at after the last paragraph
               delay 1
           end tell
       end tell
   end if
end sendScreenShot

on createScreenchotInteractivelly(theFolder as alias)
   do shell script "DATE=`date '+%Y-%h-%d-%H-%M-%S'`;
& POSIX path of theFolder & "screenshot-${DATE}.png;
           screencapture -i $FILE;echo ${DATE}"

end createScreenchotInteractivelly

Model: MacBook Pro
OS X: Catalina 10.15.7
Web Browser: Safari 14.1
Ram: 4 GB



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)