I'm trying to incorporate following tasks.
Refresh Safari every minute
After every refresh, press the down and right arrow at specific intervals.
My Attempt
I rattempted the following code but it's not working.
The refreshSafari
gets called once but doesn't get called again.
simulateRightArrowKeyPress
works fine as expected.
-- Function to simulate the right arrow key press
on simulateRightArrowKeyPress()
repeat
tell application "Safari"
activate
end tell
delay 2
tell application "System Events"
key code 125
end tell
delay 3
tell application "System Events"
key code 124
end tell
end repeat
end simulateRightArrowKeyPress
-- Function to refresh Safari
on refreshSafari()
tell application "Safari"
tell front window
do JavaScript "location.reload();" in current tab
end tell
end tell
end refreshSafari
-- Function to run the combined task
on runScheduledTask()
repeat
refreshSafari()
simulateRightArrowKeyPress()
delay (1 * 60) -- x minutes in seconds
end repeat
end runScheduledTask
-- Call the function to run the combined task
runScheduledTask()
tell application "System Events" to keystroke "R" using command down