the dialog below check to see if a buddy exists, and then if they are offline. the script would crash is the buddy name was spelled wrong. So, I made a loop that repeats the dialog until that buddy exists. Well, I cannot continue on with the rest of my script unless the buddy is online. So, I made another loop to repeat until you type in a name of an online buddy. That is where the problem is. If i spell a name incorrectly here, it will error, becuase it is trying to get the status of a non-existant buddy. So, here is my question… is there a way to check for the budd and status at the same time? OR…is there a way to make sure the script does not crash when the wrong name is typed into the get status dialog?
tell application "iChat" set firstBuddy to name of first account set myAnswer to the text returned of (display dialog "Who do you want to chat with?" default answer firstBuddy) repeat until account myAnswer exists set myAnswer to the text returned of (display dialog "That is not a buddy name" default answer firstBuddy) end repeat repeat until status of account myAnswer is not offline set myAnswer to the text returned of (display dialog "They are offline at this time" default answer firstBuddy) end repeat end tell