views:

96

answers:

3

This is a follow up to my previous question about renaming a bunch of files

Once I have my renamed files I need to add them to my project wiki page. This is a fairly repetitive manual task, so I guess I could script it but I don't know where to start.

The process is:

Got to appropriate page on the wiki

for each team member (DeveloperA, DeveloperB, DeveloperC)
{
    for each of two files ('*_current.jpg', '*_lastweek.jpg')
    {
        Select 'Attach' link on page
        Select the 'manage' link next to the file to be updated
        Click 'Browse' button
        Browse to the relevant file (which has the same name as the previous version)
        Click 'Upload file' button
    }
}

Not necessarily looking for the full solution as I'd like to give it a go myself.

Where to begin...? What language could I use to do this and how difficult would it be?

+1  A: 

If you're writing in C#, the WebClient classes might be a good place to start. I bet people could give more specific advice if you mentioned which wiki platform you are using, and whether it requires authentication, though.

I'd probably start by downloading fiddler and watching the http requests from doing it manually. Then you could use some simple scripts and regexes to build your http requests for automating the process.

Of course, if your wildly lucky, your wiki would have a backend simple enough that you could just plug them into its db directly. :)

jsight
+1  A: 

You might find CoScripter useful -- it's a Firefox extension that allows you to automate tasks you perform on websites. I'm not certain how you'd integrate this with the list of files you're changing on your local system, but it can certainly handle the file uploading through a web form.

Better bet is probably using cURL or a similar HTTP library with your programming language of choice. If you're on *nix, you can use the cURL commandline program inside your shell script to get this done fairly easily. (Like @jsight said you will need to analyze the actual forms you're using on the webpage, using Fiddler or just looking at the form elements and re-creating the POST through cURL.)

pix0r
+2  A: 

Check if the wiki you mean to talk to supports XMLRPC, because if it does it should be a snap. I wrote a tool called WikiUp to solve a similar problem (updating a delineated section on a wiki page).

Anders Eurenius