Used to be able to export Web pages to a Folder nominated in the routine but it no longer works, it does not seem to work manually either at least using the command to get to the folder in finder " command shift g".
The following opens sheet from which the name can be set and in theory change the folder destination. The routine does that but then saves the file to the last folder used. The last time I used this was before Catalina so maybe that’s the issue. Appreciate any suggestions.
set FolderName to "Macintosh HD:Users:petermitchell:Dropbox:Quantum:/"
tell application "Safari"
activate
tell application "System Events"
tell process "Safari"
click menu 1 of menu bar item "File" of menu bar 1
delay 2
select menu item "Export as PDF…" of menu 1 of menu bar item "File" of menu bar 1
click menu item "Export as PDF…" of menu 1 of menu bar item "File" of menu bar 1
set y to 1
repeat until exists combo box 1 of sheet 1 of sheet 1 of window 1
try
keystroke "g" using {command down, shift down}
delay 2
exit repeat
end try
set y to y + 1
if y = 20 then exit repeat --Added to make sure not an infinite loop
end repeat
repeat 10 times
try
set value of combo box 1 of sheet 1 of sheet 1 of window 1 to FolderName
click button 1 of sheet 1 of sheet 1 of window 1 --to accept folder
exit repeat
end try
delay 0.5
end repeat
set value of text field 1 of sheet 1 of window 1 to "test.pdf"
end tell
end tell
end tell