Very interesting if highly troublesome... 
I can get this to work:
Firefox ⇢ Extract URL from Location Field with UI-Scripting v1.00.kmmacros (7.1 KB)

But it's slow, ugly, and noisy...
The shell script stuff looks really troublesome and perhaps not too secure...
-Chris