Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Firefox opening links ... 2

Status
Not open for further replies.

dbeez

Technical User
Aug 15, 2005
71
KR
I'm trying to feed a number of links into the firefox browser and have them all open up as different tags, rather than different processes.

Is this possible ??

At the moment I can't seem to open up even one link in firefox
Code:
firefox < [URL unfurl="true"]www.website.com[/URL]

I've had a look at the man page and it doesn't seem to suggest anything about doing this, which seems kinda strange.
 
Hi phv,

no luck I'm afraid.
Even this doesn't work

Code:
firefox -remote "openURL([URL unfurl="true"]http://www.tek-tips.com,new_tab)"[/URL]

... the funny thing is that it worked last night though ???
 
I don't know firefox but perhaps you should have firefox already launched for the code to work ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ya, you do ... put I have it launched already and it still doesn't work ????

Ah well ... it's probably an Xorg bug ...
 
Hi

No is a tiredness bug. Somewhen the dash in [tt]new-tab[/tt] was changed to underscore and we all continued to just copy&paste it like that from previous posts. :)

Feherke.
 
Oops ... I think that was me ... thanks feherke.
Unforutnately though it doesn't work either way and just gives me a
Code:
root@ubuntu:/home/babo/Desktop/spider_proj # mozilla -remote "openURL([URL unfurl="true"]http://www.example.com,new-tab)"[/URL]

(firefox-bin:8303): Gdk-WARNING **: cannot set locale modifiers
Error: No running window found
it's not even parsing the new-tab bit though cause even when I just put in gibberish I still get the same error
Code:
root@ubuntu:/home/babo/Desktop/spider_proj # firefox -remote "dkjf "

(firefox-bin:8378): Gdk-WARNING **: cannot set locale modifiers
Error: No running window found
... and yet it did work ... once ?????

PS: just out of curiosity what timezone are you lot in ???
I'm in Daegu, Korea and the time is 12:50 noontime :)
 
This is kinda strange

I input
Code:
root@ubuntu:/home/babo/Desktop/spider_proj # firefox -remote "openFile(spider)"

(firefox-bin:13053): Gdk-WARNING **: cannot set locale modifiers
Error: No running window found
... and it automatically opens up some kinda spiderman webpage off the web. I then close the window and run the command again and I get the usual Error: No running window found.
 
Ok, I got some help over on the mozilla IRC. I got a moz-remote program that works fine as a substitution.

But I have one remaining problem with the script. It works as is
Code:
#!/bin/sh

if [ $# -eq 0 ]
then
        echo " For the \"$0\" script, you need a search string"
        exit 0
fi

find . -type f | while read f
 do grep -q "$1" "$f" && echo "$f" | sed 's_^./_[URL unfurl="true"]http://_'[/URL]
 done | tee "$1".links |
 while read f
 do ./moz-remote -remote "openURL(\"$f\",new-tab)"
done

... that doesn't work for some reason. It's the $f in the ./moz-remote -remote "openURL(\"$f\",new-tab)" that is the problem.

if I replace the $f with it works fine. But when it feeds in from the "$1".links file it doesn't work. The url's in $1.links are perfectly formed though ... ???
 
Hi

dbeez said:
[red]root[/red]@ubuntu:/home/babo/Desktop/spider_proj # mozilla -remote "openURL([ignore][/ignore],new-tab)"
A program which has to communicate with the X windows system must be runned by a user which has a running X session. Did you started the window manager as root ? ( This is highly unrecommended. ) Can you start any other program which has graphical interface ( [tt]xterm[/tt], [tt]xclock[/tt], [tt]xmms[/tt]... ) ?

Feherke.
 
I'd stick in an echo opening $f before the moz-remote command just to make sure you're getting what you're expecting in that variable?

Annihilannic.
 
Code:
A program which has to communicate with the X windows system must be runned by a user which has a running X session. Did you started the window manager as root ? ( This is highly unrecommended. ) Can you start any other program which has graphical interface ( xterm, xclock, xmms... ) ?
... I can open xmms no problem. Plus the openURL command did work once or twice. But only once or twice and not regularly.
Code:
I'd stick in an echo opening $f before the moz-remote command just to make sure you're getting what you're expecting in that variable?
why is this ??
why can't I find any info on the 'opening' command.

also guys I want to run down through a directory and change any file names that contain unix incompatible characters (namely ;) into their hex equivalent and copy over them so that the file contains just my unix safe file names...
so far I've got
Code:
#!/bin/sh

find . -type f | while [ -f "$f" ]
do
sed -i 's/;/%3B/' "$f"
done
... and various manifestations thereof ...
... guess what ? it doesn't work ... HELP :)
 
There is no "opening" command, it's just text to echo... for example if $f was set to "fred" it would say:

[tt]opening fred[/tt]

on your console. It's just a way of debugging to make sure that $f contains the values that you expect.

In your code to change filenames you never actually set $f to any value. Also there is no need to do a [ -f $f] because find -type f will only give you files anyway.

Your second question was a little confusing, I'm presuming that you only want to change the characters in file names, not the file contents? Here is a solution that will do it for the characters ', & and ;. Take out the echo when you are happy that it will do what you want (otherwise it will do nothing except print the commands).

Code:
#!/bin/sh

find . -type f -name '*[;&'\'']*' | while read f
do
    echo mv $f `echo $f | sed '
        s/&/%26/
        s/'\''/%27/
        s/;/%3B/
    '`
done

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top