click menu item "Show All Bookmarks" of menu 1 of menu bar item "Bookmarks" of menu bar 1
do shell script ("sleep 0.4")
repeat with eachRow from 1 to (count of rows of outline 1 of scroll area 1 of UI element 1 of UI element 1 of UI element 2 of UI element 7 of window "Bookmarks")
do shell script ("sleep 0.4")
select row eachRow of outline 1 of scroll area 1 of UI element 1 of UI element 1 of UI element 2 of UI element 7 of window "Bookmarks"
do shell script ("sleep 0.2")
set windowName to value of static text 1 of group 1 of row eachRow of outline 1 of scroll area 1 of UI element 1 of UI element 1 of UI element 2 of UI element 7 of window "Bookmarks"
keystroke "j" using command down
set x to 0
do shell script ("sleep 0.6")
# set focused of pop up button 1 of UI element 1 of UI element 2 of UI element 1 of scroll area 1 of UI element 2 of UI element 7 of window windowName to true
# This was working, but suddenly stopped.
click pop up button 1 of UI element 1 of UI element 2 of UI element 1 of scroll area 1 of UI element 2 of UI element 7 of window 1 #windowName
set x to 0
repeat until exists menu 1 of pop up button 1 of UI element 1 of UI element 2 of UI element 1 of scroll area 1 of UI element 2 of UI element 7 of window windowName
do shell script ("sleep 0.1")
set x to x + 1
if x > 20 then exit repeat
end repeat
if my saveLocalftpArchiveOnserver then
click menu item "Both Ways" of menu 1 of pop up button 1 of UI element 1 of UI element 2 of UI element 1 of scroll area 1 of UI element 2 of UI element 7 of window windowName
else
click menu item "Download" of menu 1 of pop up button 1 of UI element 1 of UI element 2 of UI element 1 of scroll area 1 of UI element 2 of UI element 7 of window windowName
end if
try
tell window windowName to activate
end try
keystroke return
set x to 0
repeat until exists window "Bookmarks"
do shell script ("sleep 0.1")
set x to x + 1
if x > 600 then exit repeat
end repeat
end repeat
click button 3 of window "Bookmarks"
delay 0.2
try
click button 3 of window 1
end try
end tell
end tell