Applescript command that navigates to a specific folder when the attachments popup appears in safari?

StackOverflow https://stackoverflow.com/questions/23413969

  •  13-07-2023
  •  | 
  •  

문제

I'm building an Applescript that will attach specific files when the attachment prompt appears in Safari.

I initially tried do shell script "open /Users/ea/Desktop/Guru/Deliverables/" but that just opens a new finder window. I need to know how to navigate to the correct folder once the prompt appears (see image below).

I'm sure it's simple, but I'm brand new to Applescript.

enter image description here

도움이 되었습니까?

해결책

The GUI script solution would be:

tell application "System Events" to tell process "Safari"
    tell window 1 to tell sheet 1
        key code 5 using {shift down, command down} --shortcut for go to folder
        tell sheet 1
            set value of text field 1 to <POSIX path to targetfolder as text>
            click button 1
        end tell
    end tell
end tell
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top