Hi,
I wonder if any body could help me out of a problem I put me into.
I want to write a script that
- imports Vcards into the Address Book application
- Make selection of imported entries
- start print dialog for printing them out
- The user has to have possibilities to start the print action, change settings or cancel operation.
- The script wait until the print sheet of Address Book is terminated
- Removes the selected entries
7 Closes the Address Book without saving.
Most of it works in my script besides of waiting for leaving the print dialog sheet.
Here is the code:
#open vcf file and start print dialog
tell application "Address Book"
activate
open "Users:ben:Desktop:halo.vcf"
tell application "System Events"
keystroke return
end tell
set selection to every person whose last name contains "To: "
tell application "System Events"
keystroke "p" using command down
end tell
repeat until exists window "Print" -- this part does not work
end repeat -- this part does not work
delete selection
quit saving {no}
end tell
I have tried different combinations of repeat but nothing helps.
I would appreciate some help
b.r.
/petron