Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Choose file - Applescript or Automator

Hi


I have an Applescript that fires up a website of mine to which I'd like to upload a csv file. I have got as far as having the "Choose File" dialog window open (from a Javascript handleFileSelect(evt) function within the web page), but I now need to select the file and somehow "click" the choose button, which I am currently having to do manually. Can anyone please offer possible solutions?

Thank you.


Regards

Nick

MacBook Pro, OS X Yosemite (10.10.5)

Posted on Sep 29, 2015 12:55 PM

Reply
Question marked as Best reply

Posted on Oct 1, 2015 1:13 PM

Through trial and error I came up with this, and it does the job:


tell application "Safari"

if not frontmost then activate

end tell


tell application "System Events"


keystroke "G" using {command down, shift down}


delay 1

keystroke "~/Desktop/filename"


delay 1

end tell


keystrokereturn


delay 1


keystrokereturn



delay 1


end tell

1 reply
Question marked as Best reply

Oct 1, 2015 1:13 PM in response to Nicky_P

Through trial and error I came up with this, and it does the job:


tell application "Safari"

if not frontmost then activate

end tell


tell application "System Events"


keystroke "G" using {command down, shift down}


delay 1

keystroke "~/Desktop/filename"


delay 1

end tell


keystrokereturn


delay 1


keystrokereturn



delay 1


end tell

Choose file - Applescript or Automator

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.