1

I have a bunch of files I want to upload to web page. Unfortunately the web form for uploading only allows me to specify one at a time (it spawns and 'open file' dialog). Is there an easy way to do this with some combination of automator/applescirpt?

  • This is very site-specific, can you add some details about the site (address if public, screenshots)? – nohillside Feb 15 '13 at 7:36
  • It's mind42.com. It's html/javascript driven. I was hoping to achieve a series of clicks at specific screen positions (which I could perhaps record with automator?), the last of which would open a 'file upload' dialog. Then navigate to the correct folder and perhaps paste in the name of the next file to upload. This would be repeated for each of the files. – drevicko Feb 16 '13 at 0:26
2

I followed @drevickos very good instructions. Didn't manage it with Safari, but Firefox works perfectly. Below the downloads for the Service file UploadFilesWebForm and the Automator file UploadFirefox3.

With these files, I managed to upload multiple files to SAS on AWS. For any other website, you should adjust:

  • Watch me do procedure to fit your web form in the UploadFirefox3 file
  • The delay needed for upload specified in the UploadFirefox3 file

UploadFilesWebForm.workflow.zip http://www45.zippyshare.com/v/QQm0SKJ5/file.html UploadFirefox3.workflow.zip http://www45.zippyshare.com/v/bHyKGi2g/file.html

  • thx - been meaning to do that for a long time, but life keeps getting in the way! (: – drevicko Feb 15 '16 at 16:15
1

Ok, I managed to get automator to do what I wanted, with a little help from grep ;)

I did it with a 'workflow' and a "files and folders" in "finder" service. The service calls the workflow with each of the selected file names.

Here's what the service does:

  • Run Shell Script with Pass input to stdin and the script grep -o '[^/]*$' -- the service receives the full paths of the files selected in the finder, I only want the file names, so this removes the path bit.
  • Launch Application with firefox -- this seems to be the best way to switch applications (even if they're already open..)
  • Run Workflow - in batches of 1 at a time using 1 workflow, with "wait for workflow to finish" ticked.

The in batches mode appears to process text input line by line. Each line output by grep contains a file name, so the second workflow is called once with each file name. Note that the list of file names is passed through Launch Application.

Here's what the workflow does:

  • Copy to Clipboard
  • a recorded Watch Me Do:
    • a series of clicks to get the 'upload file' dialog up
    • a click to focus it's search box,\
    • paste (the file name)
    • select the top found file
    • click 'open'
    • a series of clicks to upload the file and return the page to the same state in which we started

There were a few hiccups along the way.

  • First I used command-V to paste, but for some reason that was unreliable, so I ended up using paste from the edit menu instead.
  • I had to be careful to leave enough time between clicks for worst-case rendering of html pages and opening dialogs etc..
  • When the flow crashed (usually by getting out of sync with the browser), I often ended up with the browser stuck with the 'upload file' dialog open and unresponsive. To get it responsive again, I found that moving it sufficed (ie: dragging it's title bar a bit).
  • Any chance you can share your Automator file? Thanks! – Matt Sephton Aug 18 '14 at 11:14
  • Happy to share it - do you know a good place to do that? I've asked a question too... – drevicko Aug 22 '14 at 12:20
  • Could you please share it with me as well? This is exactly what I was looking for. Probably a one-click hoster would work best? – BalassaSamuelson Feb 13 '16 at 8:30
  • @BalassaSamuelson Afraid I'm a bit busy at the moment... If you manage to put it together using the instructions above, perhaps you could share it somewhere and provide a link? – drevicko Feb 14 '16 at 13:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .