Estoy intentando trabajar con la secuencia de comandos a continuación y el bucle repeat until exists window "Print"
nunca devuelve verdadero (nunca escucho el pitido 3). ¿Es esta la manera correcta de esperar a que aparezca una ventana?
Estoy usando el inspector de accesibilidad y este es el nombre correcto de la ventana de diálogo de impresión.
# Saves current document open in EverNote as PDF
#
activate application "Evernote"
tell application "System Events"
tell process "EverNote"
# Open the print dialog
beep 1
keystroke "p" using command down
# Wait until the Print dialog opens before proceeding
repeat until exists window "Print"
end repeat
# Expand the "PDF" menu button (must be expanded before the menu is referencable)
beep 3
click menu button "PDF" of window "Print"
# Wait until the Menu button menu is created before proceeding
repeat until exists menu item "Save as PDF…" of menu 1 of menu button "PDF" of window "Print"
end repeat
# Select the "Save as PDF" menu item
click menu item "Save as PDF…" of menu 1 of menu button "PDF" of window "Print"
# Wait until the Save dialog opens before proceeding
repeat until exists window "Save"
end repeat
# Paste the contents of the clipboard in and Save
# This is sorta hack; Probably best to leave the 'Save As" dialog open and let the user finish it off but I have a special purpose
if (get (the clipboard) is not "") then
set value of text field 1 of window "Save" to get (the clipboard) & ".pdf"
end if
click button "Save" of window "Save"
end tell
end tell