Esperando hasta que exista una window en Applescript?

Estoy tratando de trabajar con la secuencia de commands a continuación y la repeat until exists window "Print" ciclo repeat until exists window "Print" nunca vuelve verdadero (nunca escucho el pitido 3). ¿Es esta la forma correcta de esperar a que aparezca una window?

Estoy usando el Inspector de accesibilidad y este es el nombre correcto de la window de dialog de printing.

  • ¿Por qué los files .scpt de Script Editor no se guardan como files de text sin formatting?
  • Applescript falla aunque las variables son iguales
  • AppleScript elimina el file si no se usa / abre los últimos 365 días
  • Cómo ejecutar un Applescript descargado solo de ejecución
  • Haga clic en un button en la window flotante usando AppleScript
  • Buscar logging con la list por key en AppleScript
  •  # 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 

  • Búsqueda de artículos en la list
  • Ejecute applescript después del lanzamiento de la aplicación específica
  • ¿Puede Python / Ruby / Perl / etc (o incluso bash) replace AppleScript?
  • Autómata automático simple con AppleScript
  • ¿Cómo evito que AppleScript agregue .0 al final de un número?
  • Applescript dando el error 1728 al verificar si el file existe
  • One Solution collect form web for “Esperando hasta que exista una window en Applescript?”

    Parece que he solucionado el problema principal del problema de la "espera de la window". Aparentemente, los "avisos" nesteds no son tan buenos, así que resolví esto especificando el process que posee un elemento de IU particular:

     repeat until window "Print" of process "Evernote" exists 

    Aún no resolvió poner la date actual en el campo de nombre de file de la hoja "Guardar" pero mañana será otro día. Aquí está el guión completo:

     activate application "Evernote" tell application "System Events" # Open the print dialog keystroke "p" using command down # Wait until the Print dialog opens before proceeding repeat until window "Print" of process "Evernote" exists end repeat click menu button "PDF" of window "Print" of process "Evernote" # 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" of process "Evernote" 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" of process "Evernote" # Wait until the Save dialog opens before proceeding repeat until exists window "Save" of process "Evernote" end repeat set theDate to current date #tell (current date) to get (it's month as integer) & "-" & day & "-" & (it's year as integer) #set the clipboard to result as text #set myDate to result as text #set the clipboard to "dog" as text #if (get (the clipboard) is not "") then #set value of text field 1 of sheet "Save" of process "Evernote" to get (the clipboard) & ".pdf" #end if set value of text field of sheet "Save" of process "Evernote" to "dog" & ".pdf" # 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 # click button "Save" of window "Save" of process "Evernote" end tell 
    Loving Apple Products like poisoning (iPhone, iPad, iMac, Macbook, iWatch).