Page 1 of 1

Automatic Screenshot Sharing with Hazel

PostPosted: Fri Jan 10, 2014 5:29 am
by gaoruijie
I usually use Markdown to write. I want to share the image with Dropbox

I have noticed that there is a method to do the actions

Automatically copy the images to public link

![Hazel rule1](https://www.dropbox.com/s/r1ec9e8j86ibk ... .28.00.png)

![apple scripts](https://www.dropbox.com/s/kswjzvbbbfz7z ... .28.41.png)

My apple scripts

set file_path to theFile as text
try
set text item delimiters to ":"
set file name to last text item of file_path
set text item delimiters to ""
on error
set text item delimiters to ""
end try
set the clipboard to "https://dl.getdropbox.com/u/72877318/screenshots/" & file_name

But there is always showed me with "error executing apple scripts"

Re: Automatic Screenshot Sharing with Hazel

PostPosted: Fri Jan 10, 2014 3:31 pm
by Mr_Noodle
Check the logs and post the AppleScript errors here.

Re: Automatic Screenshot Sharing with Hazel

PostPosted: Mon Jan 13, 2014 12:52 am
by gcoghill
I'm trying to do something similar. I did notice you reference "file_name" in the AppleScript at the end, but earlier you named it "file name".

Re: Automatic Screenshot Sharing with Hazel

PostPosted: Mon Jan 13, 2014 12:58 am
by gcoghill
Try this:

Code: Select all
set file_path to theFile as text
try
set text item delimiters to ":"
set file_name to last text item of file_path
set text item delimiters to ""
on error
set text item delimiters to ""
end try
set the clipboard to "https://dl.getdropbox.com/u/72877318/screenshots/" & file_name

Re: Automatic Screenshot Sharing with Hazel

PostPosted: Mon Jan 13, 2014 3:53 am
by gaoruijie
gcoghill wrote:Try this:

Code: Select all
set file_path to theFile as text
try
set text item delimiters to ":"
set file_name to last text item of file_path
set text item delimiters to ""
on error
set text item delimiters to ""
end try
set the clipboard to "https://dl.getdropbox.com/u/72877318/screenshots/" & file_name



Thanks, Gcoghill! The problem is fixed.

Re: Automatic Screenshot Sharing with Hazel

PostPosted: Mon Jan 13, 2014 9:52 am
by gcoghill
gaoruijie wrote:Thanks, Gcoghill! The problem is fixed.


Great! Glad to help.