(First time with AppleScript...) I'm trying to bulk upload files from a local folder to a server via a single-upload form (legacy serverside software behind ddos wall, no control over it)
As I understand:
- I can loop through each file in the filesystem.
- With each file: Invoke "tell" Safari"
- Invoke javascript to "click" a button by ID
- file upload dialog, select the file to upload (?)
I'm having some trouble with syntax in implementing that...
(Also, if that's not the right/best approach, please provide a better one below!)
on run tell application "Finder" set mlist to (every file of folder "Macintosh HD:Users:username:filestouploadfolder") as alias list repeat with this_file in mlist tell application "Safari" activate do JavaScript "document.getElementById('selectToOpenFileDialog').click();" in document 1 choose file this_file end tell end repeat end tell return 0 end run