Watch screenshot folder

Is it possible to use hazel to watch a folder (Screenshots) and when there’s a new screenshot added to the folder hazel will run a script to upload the image to google drive (or dropbox) and make it publicly available and copy the url to the clipboard.

I’m guessing this requires a lot of code to create this script. I hope someone can help me. thanks

hi ikai

if you have a little experience with applescript and interface scripting you can adjust this script. what this script does it copies the file you select to /Dropbox/Public , creates the link to it and puts the link into an email. unfortunately i don’t have the time to adjust it to your needs but it should be feasible:

#set home folder path to myPath variable

set myPath to path to home folder as string

#add specific location to myPath variable

set myPath to myPath & “Dropbox:Public”

tell application “Finder”

#add selected file path to theFile variable

set theFile to the selection as alias

#copy the selected file to myPath destination

copy file theFile to folder myPath

#create the path to pasted file

set fileName to name of theFile

set newPath to myPath & “:” & fileName

#bring the finder as front app and highlight the copied file

set frontmost to true

reveal newPath

end tell

tell application “System Events” to tell application process “Finder”

#add the highlighted file to selectedFile variable in order to use the UIElements attributes

set selectedFile to value of attribute “AXFocusedUIElement”

#show the contectual menu

tell selectedFile to perform action “AXShowMenu”

delay 2

#copy a specific item from menu to the clipboard

keystroke “Copy Dropbox Link”

key code 36

delay 2

#paste the clipboard to dropboxLink variable

set dropboxLink to the clipboard

end tell

#set sender

set senderEmail toperson@company.com

tell application “Mail”

activate

#Create new email message

set MyMessage to make new outgoing message

#Set the attributes of the email

set subject of MyMessage to “Dropbox Link”

#set the content of the message

set content of MyMessage to dropboxLink

#set the sender

set sender of MyMessage to senderEmail

end tell