I am trying to download some stock prices from a website. https://www.dukascopy.com/trading-tools/widgets/quotes/historical_data_feed
If you select an instrument, such as “TSLA”, and login. I can successfully tell the Automator to click each button.
However, after opening up the “Date:”, I cannot select a new day (doWithTimeout2). It comes back with Syntax Error
Any ideas how I can get it to select a different day?
on run {input, parameters}
set CURRENTDATE to "2020-03-15"
set ErrorCount to 0
-- Click the "date" button.
delay 0.1
set timeoutSeconds to 2.0
set uiScript to "click UI Element \"" & CURRENTDATE & "\" of group 8 of UI Element 1 of scroll area 1 of group 1 of UI Element 1 of scroll area 1 of group 9 of UI Element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window \"Historical Data Export\" of application process \"Safari\""
my doWithTimeout(uiScript, timeoutSeconds, CURRENTDATE)
-- Click the text “28”
delay 0.1
set uiScript2 to "click static text 1 of UI Element 6 of row 4 of table 1 of table 1 of group 12 of UI Element 1 of scroll area 1 of group 1 of UI Element 1 of scroll area 1 of group 9 of UI Element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window \"Historical Data Export\" of application process \"Safari\""
my doWithTimeout2(uiScript2, timeoutSeconds)
return input
end run
on doWithTimeout(uiScript, timeoutSeconds, CURRENTDATE)
set endDate to (current date) + timeoutSeconds
set endDate2 to (current date) + timeoutSeconds / 2
repeat
try
run script "tell application \"System Events\"
" & uiScript & "
end tell"
exit repeat
on error
if ((current date) > endDate) then
error "Can not " & uiScript
else if ((current date) > endDate2) then
set uiScript to "click UI Element \"" & CURRENTDATE & "\" of group 7 of UI Element 1 of scroll area 1 of group 1 of UI Element 1 of scroll area 1 of group 9 of UI Element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window \"Historical Data Export\" of application process \"Safari\""
end if
end try
end repeat
end doWithTimeout
on doWithTimeout2(uiScript2, timeoutSeconds)
set endDate to (current date) + timeoutSeconds
set endDate2 to (current date) + timeoutSeconds / 2
repeat
try
run script "tell application \"System Events\"
" & uiScript & "
end tell"
exit repeat
on error errorMessage
if ((current date) > endDate) then
error "Can not " & uiScript
else if ((current date) > endDate2) then
set uiScript to "click static text 1 of UI Element 5 of row 6 of table 1 of table 1 of group 12 of UI Element 1 of scroll area 1 of group 1 of UI Element 1 of scroll area 1 of group 9 of UI Element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1 of window \"Historical Data Export\" of application process \"Safari\""
end if
end try
end repeat
end doWithTimeout2
Model: Macbook Pro
Browser: Safari 537.36
Operating System: macOS 10.14