Prevent Applescript Application from showing Error Messages?

Hi Folks,

in my application I am working with AT Commands and a Scripting Addition! When the application is starting,
some AT Commands are entered - f.ex: the command “at+cops” is showing the Provider (the application
is a GPRS/UMTS/HSDPA Dialer) - the next step is to manipulate the string so the correct part will be displayed (f.ex: T-Mobile Austria) - sometimes - only sometimes the Provider will not be shown correct! Using the delimiter will not work then, because the 2nd Part can not be evaluated… In this case I don´t want to show a error message, but nothing! Nothing should popup if an error occurs…

If there is something wrong with the SimCard (f.ex. the SimCard is not ready), then I can live with not showing the Provider, but I am not able to live with an error message, because this application will be given to customers…

Is this possible with xcode? Can I prevent any error messages from popping up?

Thanks for any feedback!


Model: iBook G4 with 1.2GHZ
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

In AppleScript (general) you can avoid any error message using a try block

Without seeing any actual code, I can only suggest trying something like this:

set ASTID to AppleScript's text item delimiters
	set AppleScript's text item delimiters to {""}
	set someVariable to text item 2 of someVariable -- whatever manipulation you're trying to do
end try
set AppleScript's text item delimiters to ASTID

Hi Stefan, Hi Bruce!

Thanks a lot! This was exactly what I expected!

to Bruce:

what means: set ASTID to AppleScript’s text item delimiters and why do I have to set AppleScript’s text item delimiters to ASTID in the end?

Thanks for your feedback!



Am just trying to help Bruce who’s got his hands full in this forum. Anyway, the questions are simple enough to handle. :smiley:

ASTID = AppleScript’s Text Item Delimiters. Why do you have to set to ASTID again at the end? AppleScript uses a default TID (I believe it’s a simple space) that can be used in parsing text items, so to speak. If the user changes this tid to something else. for instance a “/” for parsing text items, it needs to be restored to the default else the user’s tid will always be in effect (until recompile or restart) which may not be ideal.

Note that in Bruce’s code, ASTID is actually a user-created variable that stored the AppleScript’s default tid. In the end, you call this variable back to restore the default tid.

Hope your questions were cleared.

Good luck!

archseed :slight_smile:

Hi Archseed,

thanks - that cleared everything…

Best Regards,