diff options
author | 2009-05-23 12:02:10 +0200 | |
---|---|---|
committer | 2009-05-23 12:02:10 +0200 | |
commit | b8d033d43a228059c9b59eb62c292d6edfb59e69 (patch) | |
tree | d638a4de314b0a985cfc27289bb51b66836fe587 /examples/scripts/formfiller.sh | |
parent | 6fe3b78090545e0df3ca4fb742f69e8122963a8d (diff) | |
parent | 4e0e5302bb4d0e58b2d56c02c98bfb4c97a24484 (diff) |
Merge branch 'experimental' of git://github.com/Dieterbe/uzbl
Diffstat (limited to 'examples/scripts/formfiller.sh')
-rwxr-xr-x | examples/scripts/formfiller.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/scripts/formfiller.sh b/examples/scripts/formfiller.sh new file mode 100755 index 0000000..e7ef3b5 --- /dev/null +++ b/examples/scripts/formfiller.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# simple login form filler for uzbl. +# put the form entry values you want to add (eg login information) in the file $keydir/<domain> +# in the format <fieldname>: <value> +# (these files can be automatically created for you by setting editor and triggering this script on a site without a config) + +[ -d /usr/share/uzbl/examples/data/forms ] && keydir=/usr/share/uzbl/examples/data/forms # you will probably get permission denied errors here. +[ -d $XDG_DATA_HOME/uzbl/forms ] && keydir=$XDG_DATA_HOME/uzbl/forms +[ -d ./examples/data/forms ] && keydir=./examples/data/forms #useful when developing +[ -z "$keydir" ] && exit 1 + +#editor=gvim +editor='urxvt -e vim' + +config=$1; shift +pid=$1; shift +xid=$1; shift +fifo=$1; shift +socket=$1; shift +url=$1; shift +title=$1; shift + +[ -d $keydir ] || mkdir $keydir || exit 1 + +domain=$(echo $url | sed -re 's|(http\|https)+://([A-Za-z0-9\.]+)/.*|\2|') +if [[ -e $keydir/$domain ]]; then + gawk -F': ' '{ print "act js document.getElementsByName(\"" $1 "\")[0].value = \"" $2 "\";"}' $keydir/$domain >> $fifo +else + curl "$url" | grep '<input' | sed -nre 's|.*<input.*?name="([[:graph:]]+)".*?/>.*|\1: |p' > $keydir/$domain + $editor $keydir/$domain +fi |