Estoy trabajando en un AppleScript de secuencias de comandos de GUI que, para el documento abierto de FileMaker Pro Advanced, irá al menú Archivo y seleccionará el cuadro de diálogo Opciones de archivo, luego establecerá algunas casillas de verificación/botones de opción y valores de campo.
El cuadro de diálogo se ve así:
Me gustaría que mi script hiciera lo siguiente:
Lo tengo abriendo el cuadro de diálogo, pero no puedo pasar de configurar la casilla de verificación; esta es la primera vez que uso secuencias de comandos GUI. Estoy usando OS X Yosemite 10.10.3.
Aquí está mi guión:
-- check that GUI Scripting is available
GUIScripting_status()
-- bring FileMaker Pro Advanced to the front
tell application "FileMaker Pro Advanced"
activate
end tell
setfmFileOptions()
on click_button(app_name, button_name)
try
tell application app_name
activate
end tell
tell application "System Events"
tell process app_name
click button button_name of front window
end tell
end tell
return true
on error error_message
end try
end click_button
on do_menu(app_name, menu_name, menu_item)
try
-- bring the target application to the front
tell application app_name
activate
end tell
tell application "System Events"
tell process app_name
tell menu bar 1
tell menu bar item menu_name
tell menu menu_name
click menu item menu_item
end tell
end tell
end tell
end tell
end tell
return true
on error error_message
return false
end try
end do_menu
on setfmFileOptions()
-- choose the Developer Utilities menu item from the Tools menu of FileMaker Pro Advanced
do_menu("FileMaker Pro Advanced", "File", "File Options...")
-- click the "Log in using" checkbox:
if (exists checkbox "Log in using:" of window 1) is true then
click checkbox "Log in using:" of window 1
end if
end setfmFileOptions
on GUIScripting_status()
-- check to see if assistive devices is enabled
tell application "System Events"
set UI_enabled to UI elements enabled
end tell
if UI_enabled is false then
tell application "System Preferences"
activate
set current pane to pane id "com.apple.preference.universalaccess"
display dialog "This script utilizes the built-in Graphic User Interface Scripting architecture of Mac OS x which is currently disabled." & return & return & "You can activate GUI Scripting by selecting the checkbox \"Enable access for assistive devices\" in the Universal Access preference pane." with icon 1 buttons {"Cancel"} default button 1
end tell
end if
end GUIScripting_status
No se compilará y devuelve este error en la línea "si (existe la casilla de verificación"Iniciar sesión usando:" de la ventana 1) es verdadero entonces":
prueba este pequeño cambio de sintaxis:
on setfmFileOptions(app_name)
-- choose the Developer Utilities menu item from the Tools menu of FileMaker Pro Advanced
do_menu(app_name, "File", "File Options...")
-- click the "Log in using" checkbox:
tell application "System Events"
tell process app_name
repeat until (exists checkbox "Log in using:" of tab group 1 of window 1)
delay 1
end repeat
click checkbox "Log in using:" of tab group 1 of window 1
end tell
end tell
end setfmFileOptions
No puede usar la ventana 1 sin decir en qué proceso se encuentra la ventana 1. Tendrá que especificar app_name como parámetro ahora.
Entonces, así:
setfmFileOptions("FileMaker Pro Advanced")
usuario982124
William T. Froggard
usuario982124
William T. Froggard
tell application "System Events" to get checkboxes of window 1 of process "FileMaker Pro Advanced"
mire las casillas de verificación que se devuelven, si las hay, si no encuentra lo que está buscando, intente esto: luego sigatell application "System Events" to get checkboxes of UI elements of window 1 of process "FileMaker Pro Advanced"
agregandoof UI elements
despuéscheckboxes
hasta que obtenga la casilla de verificación que estás buscando. Esta es una forma sencilla de rastrear la jerarquía de vistas. Sin embargo, haga esto en un script separado.William T. Froggard
usuario982124
checkbox "Log in using:" of tab group 1 of window 1
: gracias por indicarme la dirección correcta. Aprender más sobre la sintaxis de AppleScript sobre la marcha.usuario982124
checkbox "Log in using:" of tab group 1 of window 1
William T. Froggard