Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Applescript > Suppressing err...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 28 Topic 1610 of 1611
Post > Topic >>

Suppressing error messages

by isw <isw@[EMAIL PROTECTED] > May 5, 2008 at 09:24 AM

I collect recipes. One aspect of that is formatting them to a common 
standard -- always using "Tbsp." instead of "T", "T.", "tblspn", and so 
on. Since lots of different folks write recipes, there are a *lot* of 
different combinations to be searched for and changed -- teaspoons, 
tablespoons, quarts, pounds, etc. etc.

I've put together an AppleScript that works fine *except* that it throws 
two different kinds of errors, and that makes it very annoying to use.

Here's a snippet of the script:

tell application "TextWrangler"
   activate
   try
      replace " t " using " tsp. " searching in document of text window 1
   end try
   try
      replace " ts " using " tsp. " searching in document of text window 
1
   end try
   try
      replace " tsp " using " tsp. " searching in document of text 
window 1
   end try

....

and so on through about thirty different items.

Naturally, no single recipe, or group of recipes, will contain every one 
of those strings, and whenever a string is not found, TextWrangler puts 
up an error dialog informing me of that, which I have to clear manually. 
I thought that putting each "replace" inside a "try" would solve the 
problem, but clearly it did not.

And every time it *does* find a string to replace, it asks me if I want 
to save the file -- which of course I do not want to do until all the 
replacements have been made.

So, what do I add to the AppleScript to tell it:

1) that I do not care if it can't find some particular string, and

2) That I do not want the file saved every time it makes a change.

thanks

Isaac




 28 Posts in Topic:
Suppressing error messages
isw <isw@[EMAIL PROTEC  2008-05-05 09:24:20 
Private Message
   2008-05-05 10:00:07 
Private Message
   2008-05-05 10:57:45 
Private Message
   2008-05-05 12:04:32 
Private Message
   2008-05-05 19:04:17 
Private Message
   2008-05-05 21:01:24 
Private Message
   2008-05-05 19:32:40 
Private Message
   2008-05-05 21:05:18 
Private Message
   2008-05-05 22:08:02 
Private Message
   2008-05-05 23:34:41 
Private Message
   2008-05-06 00:38:26 
Private Message
   2008-05-06 07:12:47 
Private Message
   2008-05-06 10:45:53 
Private Message
   2008-05-06 11:14:52 
Private Message
   2008-05-06 16:05:41 
Private Message
   2008-05-06 14:37:25 
Private Message
   2008-05-06 15:00:06 
Private Message
   2008-05-06 21:11:10 
Private Message
   2008-05-05 22:12:26 
Private Message
   2008-05-06 10:21:27 
Private Message
   2008-05-05 21:10:29 
Private Message
   2008-05-05 19:28:55 
Private Message
   2008-05-05 22:44:52 
Private Message
   2008-05-05 19:44:25 
Private Message
   2008-05-05 22:44:05 
Private Message
   2008-05-05 21:02:49 
Private Message
   2008-05-05 23:45:14 
Re: Suppressing error messages -- Running!
isw <isw@[EMAIL PROTEC  2008-05-07 13:46:30 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue May 13 0:02:29 CDT 2008.