Applescripting Automator

Joined
Sep 16, 2005
Messages
5
Reaction score
0
I am starting to work with applescripting Automator apps when I suddenly realized I don't speak applescript. So I beg for help.

I'd like to make a simple automator app that reads the word count from the clipboard.

I know that automator likes

"on run {input, parameters}" to start an applescript and

" return input
end run" to end it. The questions become:

What input and parameters need to be set for the clipbard?
What should the script do to count the words?
Once I have a number, how do I display it?

I found snippet of code that does this in applescript and displays a dialog box:

set myclip to the clipboard as string
set the reportnum to the count of words in myclip
(display dialog) & reportnum & " words"

But how can these functions be used in an Automator applescript?

And is there a way to make an automator dialog pop up and disappear after 5 seconds without clicking on it?

Thank you,

Kevin
 
Joined
Sep 16, 2005
Messages
5
Reaction score
0
on run {input, parameters}
return input
set myclip to the clipboard as string
set the reportnum to the count of words in myclip
end run

If I put this snippet in a Run Applescript action and follow it Vith a View Results action, I get a word count of the clipboard. Great.

But how do I get this to information to show on the screen? Is there a way to use one of the dialogs to do this? Or can another applescript pop up a box with the word count in it? Or in the menu bar where where the automator progress is showing?

So many questions. So little coding accomplished.

Kevin
 

Ric

Joined
May 14, 2004
Messages
4,260
Reaction score
5
Sorry for the delay in replying Kevin, have had a few 'work' projects on the go !

do you still need help !

regards

Ric
 
Joined
Sep 16, 2005
Messages
5
Reaction score
0
Ric,

Thank you. I had some help from Tom X, since I'm applescript illiterate, and have it working great now. I have an app that you double click on and it shows you the clipboard word count for 2 seconds and closes.

Now if I could figure out how to count the words in highlighted text in a TextEdit document... :)

Just amazing what Automator and applescript can do.

Kevin
 
Joined
Sep 16, 2005
Messages
5
Reaction score
0
Very nice counter. I guess I am determined to wait for more advanced TextEdit actions since everyone has TextEdit on their mac. Anybody can use workflows and apps that use TE without installing more software. The problem right now is that apps like JeditX and BBEdit are years beyond TE with Automator actions available.

Thank you for all you help Ric,

Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top