SyntaxFix
Write A Post
Hire A Developer
Questions
Your question is specifically about how to get Applescript to do what you want. But, for the particular example described, you might want to look into 'expect' as a solution.