MACRO or PLUGIN: Open or Refresh a URL in a Tab (Safari & Chrome)

sub_macro
plugin
safari
jxa
chrome

#41

Hey Kirill,

You can also do something like this.

This script reloads every tab in the front Safari window, but it can easily be adapted to work with a specific tab in a specific window.

-Chris

----------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2011/08/09 20:33
# dMod: 2015/11/14 16:46
# Appl: Safari
# Task: Reload Every Tab in front window.
# Libs: ELb
# Osax: None
# Tags: @Applescript, @Safari, @Reload, @Tabs, @Front, @Window
----------------------------------------------------------------

tell application "Safari"
   
   set tabList to tabs of front window
   
   repeat with theTab in tabList
      tell theTab to do JavaScript "location.reload(true)"
   end repeat
   
end tell

----------------------------------------------------------------

#42

Agreed. Still works for Chrome, but not safari. And I'm on 12.0. A huge bummer, as I loved this macro!


#43

Great plugin/macro! Unfortunately, I'm having the same problem with this, a simpler version I tried to make for myself, as well as @JMichaelTX 's from here.

In all of these, the correct tab is selected but the chrome window is not set to frontmost. In other words, if I have only one chrome window open everything works perfectly but if I have 2 chrome windows open and the opposite window is currently focused, "AXRaise" is not working at all to switch to the window with the desired tab.

Mac version: 10.14
Chrome version: 72.0.3626.121
KM Version: 8.2.4

EDIT: taking a closer look the following Applescript works fine for me with "Safari", but not at all with "Google Chrome"

tell application "System Events"
	tell application process "Google Chrome"
		tell (window 2) to perform action "AXRaise"
	end tell
end tell