Mac Help Forums


Reply
Thread Tools Display Modes

Applescripting Automator

 
Member
Join Date: Sep 2005
Posts: 5
 
      22nd September 2005
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
 
Reply With Quote
 
 
 
 
Member
Join Date: Sep 2005
Posts: 5
 
      23rd September 2005
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
 
Reply With Quote
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      4th October 2005
Sorry for the delay in replying Kevin, have had a few 'work' projects on the go !

do you still need help !

regards

Ric
 
Reply With Quote
 
Member
Join Date: Sep 2005
Posts: 5
 
      4th October 2005
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
 
Reply With Quote
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      4th October 2005
I'll have a look at that later for you...

...here's one for you !

http://www.mac-help.com/count-my-words.htm

regards

Ric
 
Reply With Quote
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      5th October 2005
Tex-Edit Plus and TextWrangler would probably be better suited if you want to use AppleScript...

Tex-Edit Plus can be found here, http://www.tex-edit.com/ .

TextWrangler is a free cut down version of BBedit and can be found here http://www.barebones.com/

regards

Ric
 
Reply With Quote
 
Member
Join Date: Sep 2005
Posts: 5
 
      5th October 2005
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applescripting Automator. aaabha AppleScript 0 19th August 2010 11:31 AM
AppleScripting Numbers '09? Chris Schram AppleScript 22 13th February 2009 08:30 PM
Applescripting VLC Une bévue AppleScript 5 5th July 2006 10:09 AM
Filemaker scripting/Applescripting/Automator zeyhra AppleScript 0 8th June 2006 02:16 AM
Applescripting Applescript Diccon Towns AppleScript 4 4th December 2004 03:52 PM


All times are GMT +1. The time now is 10:25 AM.
Mac-Help.com is an independent website and is not affiliated with Apple Inc.


Welcome!
Welcome to the Mac Help Forums
 


Latest Threads
New book about Steve Jobs << take part in it!
Arjan (47 Minutes Ago, 09:37 AM)

Help! Stupid computer is automatically logging me out
Elizaboo (11 Hours Ago, 10:41 PM)

URGENT Help. Crazy talk Mac!
Joeker (12 Hours Ago, 09:42 PM)

PDF Document
yura (22 Hours Ago, 12:13 PM)

Difficulties with internet speed (nothing to do with connection)
sammethh (1 Day Ago, 06:36 AM)

 


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51