Technika

Wed, 31 Jan 2007 22:37:26 GMT
by pdp

Technika is a general purpose scripting platform for Firefox. It acts like a standard OS shell scripting environment. You can script everything from the currently viewed page, just like Greasemonkey, and everything in the chrome, just like any browser extensions but without need to restart the browser every time you make a change. The platform will be used as a base component to other projects, such as TSF (Technika Security Framework) and AttackAPI browser extension.

Technika scripts are very simple and have great code reuse characteristics. Command line option parsing is handled automatically. These options are in the format of URL queries (i.e print text=Text). This mechanism allows you to perform some interesting shell tricks and it also significantly minimizes the size of your scripts' sources, since you don't have to do any parsing whatsoever.

Technika supports some useful shell primitives. For example, text enclosed in backticks (`) will be evaluated as JavaScript inside the requested script sandbox. Text that starts with @ (single at sign) is substituted with local scope variable, while @@ (double at sign) is substituted with global chrome variables. You can also use the standard bash << EOF primitive to pass long blocks of text.

You can extend the shell with your own scripts by adding additional paths into Technika's PATH global preference. Your paths can be even located on remote machines as well. Technika will dynamically download your scripts and execute them for you. In order to extend the path, simply do the following from the shell: path add=url

For more information check the path script help.

Scripts

The following scripts come by default with the Technika install: chars, clear, get, getpref, geturl, gnucitizen, help, hist, js, launch, note, path, posturl, print, prompt, reset, session, set, setpref, source, write.

Examples

print text=`new Date().getTime()`

executes script 'print' and supplies option 'text' with the current timestamp.

print text=@location

prints the current location of the selected browser tab.

print text=@@location

prints the location of the browser chrome.

geturl url=@location&@location=http://www.gnucitizen.org

overwrites the selected browser tab location with the value of 'http://www.gnucitizen.org' and retrieves the url content

js date=`new Date().getTime()` << EOF
    for (var i = 0; i < 10; i++) {
        print(i + ': ' + date);
    }
EOF

executes the js script with one parameter 'date' which contains the current timestamp. The script input is located between << EOF and EOF delimiters.

Bookmarklets

Technika is very suitable for writing bookmarklets and automating common web tasks. Once you install/write your bookmarklet you can tag is as an autorun script, which will instruct Technika to execute it every time you visit a page or predefined set of pages. The following list summarizes all Technika tags/keywords. You have to supply these in your bookmarklet's keywords under the properties dialog. Tags are separated by commas:

autorun - run the script on page load
level0, level1... level9 - set the execution order of autorun scripts

Technika's bookmarklet features integrate well with Firebug. You can use Firebug's console to write, test and export bookmarklets. You can also run the bookmarklets from the Firebug's shell by prefixing your command line with the hash (#) sign (i.e. #myBookmarklet). If you want to persist some of the data, use Firefox, IE or Opera persistent objects. Your bookmarklets portability depend entirely on your design.

UPDATE 2011/04/20: this project has been unsupported/unmaintained for quite some time. You might want to check Weaponry or Websecurify for better solutions. Alternatively, if you feel like supporting the project, please do let us know.

Archived Comments

Adrian PastorAdrian Pastor
I think the latest version still needs to be added to: https://addons.mozilla.org/en-US/firefox/addon/4665 btw, you should consider making a video showing some tricks with Technika.
pdppdp
definitely, I need to put some docs together. btw, only technika 1.3.1 will be available for the Mozilla addons. first of all, I need to do some improvements on various places in order to make the extension even more useful.
steevsteev
When attempting to work with Technika, I can't seem to get it - perhaps it is due to the way that I have Firefox compiled, the extension installs fine, but I don't seem to have any interface for it - FireBug works fine, and I have tried uninstalling FireBug, and adding 1.3 from here (as opposed to 1.2 from addons.mozilla.org) with the same result, no apparent way of using Technika - what am I missing?
pdppdp
steev, yes we are lacking any sort of documentation but usually you should be able to build bookmarklets and you can also use the console by pressing F1 or by following View -> Technika F1. I hope that this helps. Let me know if you need further assistance. Or feel free to put some documentation if you feel like it. It is an open source project at the end of the day.
DavidDavid
Guys! You're smart coders. Respect! Thank's a lot for this .xpi. I'll immediately share with another web-developmenters!
nickbotulismnickbotulism
Technika has been very useful. However, now it seems to disable the CTRL+A keyboard shortcut when the focus is the Firefox page (i.e. not in a text-editing field). I'm not sure when (what version) this started happening; all I know is that when I disable Technika, the normal operation of CTRL+A returns. This is on Windows, Firefox 2.0.0.11. (My apologies if this is not the right place to report this. Thanks!).
pdppdp
nickbotulism, it is probably more appropriate to post these stuff in the project issue page which is part of google code (thanks google). 10x, btw. I think that we might bind to CTRL+A but I am not sure. The current version is not very well organized GUI wise and I welcome you to suggest the changes you would like to see in the next version. Also, if you would like to help and you are familiar with XPCOM or you know someone that is familiar with XPCOM, please let us know, since there is one minor issue that prevents us from taking Technika to the next level.
mr.r.birtlesmr.r.birtles
Hey when will a ff3 compatible version be out?
pdppdp
I soon as I find time which wont be very soon :) sorry.
mr.r.birtlesmr.r.birtles
Bla I didn't want to wait that long so here is a temp fix for the people using FF3 (I hope thats all of you) download Technika.xpi and rename the file Technika.zip, pull out the install.rdf file and change the line that reads em:maxVersion2.0.0.*em:maxVersion to em:maxVersion3.0.0.*em:maxVersion There ya sorted for now until pdp gets some more time back.
AlogragAlograg
i'm newbie, how autorun works, where i can get examples?
pdppdp
just specify keyword autorun for your bookmark.
ZsoltZsolt
This isn't compatible with Firefox ver. 3.0.6. Please upload a newer version soon. Thanx...
pdppdp
I need to rewrite the whole thing from scratch. There are a quite a few things that I would like to change.