Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using the Linux command line (Bash shell) I like to load a specific website in my browser (normally Firefox, but other one would be ok as well as long it runs under Linux) and fill a pre-defined form with some data. Actually, this should run from a Makefile. Most of the form data is static and will be stored as variables in the Makefile, just some fields are to be filled manually before manually sending the form.

I know how to load the website in question from the command line using:

firefox <URL>

But there seems no possibility to fill the form automatically with variables given on the command line. Is there a plugin, executable or JavaScript which allows me to do this? Any suggestions and hints are welcome. I don't mind coding some JavaScript.

share|improve this question
up vote 3 down vote accepted

See MozRepl lets you connect via telnet, in combination with netcat this would be exactly what you need.

share|improve this answer
Thanks. Is the browser still opened as normal? Like I said I want to make final edits and submit it manually. – Martin Scharrer Mar 19 '11 at 22:31
Yes, once you've started firefox normally you are able to telnet into it. – artistoex Mar 19 '11 at 22:33
Thanks. This brought me now to the idea that I can solve this also using a user script, which is simpler (see my own answer). I will accept your answer after a short while. – Martin Scharrer Mar 24 '11 at 23:52

I solved this now using a Greasemonkey script which copies the URL parameters to the form. The Makefile calls firefox with the URL including the parameters.

This works for my needs. Some refinements would be needed for more complex input, i.e. some URL encoding.

User Script:

// ==UserScript==
// @name           Fill CTAN upload form
// @namespace
// @description    Fills the CTAN upload form with the data provided as URL variables
// @include        http://**
// @require
// ==/UserScript==

//var $ = unsafeWindow.jQuery;

// From
// Added: decodeURI
function getUrlVars() {
    var vars = {};
    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
        vars[key] = decodeURI(value);
    return vars;

var vars = getUrlVars();

for (name in vars) {
    $("input[name=" + name + "]").val(vars[name]);
    $("select[name=" + name + "]").find("option:selected").removeAttr('selected');
    $("select[name=" + name + "]").find("option[value=" + vars[name] + "]")

if ('DoNotAnnounce' in vars) {
    var val = vars['DoNotAnnounce'].toLowerCase();
    if (val == '1' || val == 'yes' || val == 'true') {


# CTAN Upload
NAME=John Doe
SUMMARY=Updated to ${VERSION}:
#FILE= # can't be set because of security limitations

upload: ctanify
    firefox '${CONTRIBUTION}&version=${VERSION}&name=${NAME}&email=${EMAIL}&summary=${SUMMARY}&directory=${DIRECTORY}&DoNotAnnounce=${DONOTANNOUNCE}&announce=${ANNOUNCEMENT}&notes=${NOTES}&license=${LICENCE}&freeversion=${FREEVERSION}' &
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.