2010-01-19 18 views

Respuesta

9

no creo Firefox o Chrome tienen soporte Applescript especial, pero puede enviar las pulsaciones de teclas (Comando-R) para actualizar la página:

tell application "Firefox" 
    activate 
    tell application "System Events" to keystroke "r" using command down 
end tell 
+0

Se supone que Firefox pero se ha roto con las versiones actuales 3.5.x, al parecer. –

+0

¡Nifty!Esto funciona para los tres navegadores, usando "Firefox", "Google Chrome" y "Safari" como cadenas de aplicaciones. –

5

Ésta es otra manera de hacerlo en Safari sin el uso de JavaScript:

tell application "Safari" 
    tell its first document 
     set its URL to (get its URL) 
    end tell 
end tell 
38

Aquí está el código para Chrome:

tell application "Google Chrome" 
    tell the active tab of its first window 
     reload 
    end tell 
end tell 

O de manera más concisa:

tell application "Google Chrome" to tell the active tab of its first window 
    reload 
end tell 
+4

Esta secuencia de comandos se merece más IMO de votos arriba porque no requiere que encienda el navegador antes de volver a cargar: esta es la clave. – bitwit

+1

También puede usar "primera pestaña" en lugar de "pestaña activa". – blockloop

1

Automator

  • abierto Automator y elegir un nuevo documento
  • Elija Servicio

A screengrab showing the document type dialog in Automator

  • Conjunto Service recibe a sin entrada
  • Elija Ejecutar AppleScript acción de la lista de acciones.
  • Pegue el código siguiente en la secuencia de comandos:

 

tell application "Google Chrome" to tell the active tab of its first window 
reload 
end tell 

A screengrab showing the automator window actions

  • Guardar el servicio, por ejemplo, usando el nombre Chrome Actualizar

Preferencias del Sistema

  • Abra Preferencias del Sistema >teclado
  • En los accesos directos pestaña, elegir Servicios
  • asignar un nuevo acceso directo

A screengrab showing System Preferences keyboard shortcut tab

Cuestiones relacionadas