Subject: FVWM: netscape

From: [email-masked] (Graeme McCaffery)
Date: Mon, 2 Jun 1997 14:01:11 +0100 (BST)

does anyone have a script, like the one for tkgoodstuff
that will send netscape a string that's highlighted.

basically I thought I would use a function to send a message to an 
existing netscape or start up a new one with the hightlight text in question.

does anyone already do this?

Graeme

-- 
email: [email-masked]

--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Kai Grossjohann <[email-masked]>
Date: 02 Jun 1997 15:35:11 +0200

>>>>> Graeme McCaffery writes:

  Graeme> basically I thought I would use a function to send a message
  Graeme> to an existing netscape or start up a new one with the
  Graeme> hightlight text in question.

Well, the tool you need is xcb.  You can use it to print the primary
selection to stdout.  I don't have it now, but the following ought to
be close:

    netscape -remote openURL(`xcb -p 0`)

Something like that.
kai
-- 
Some people say that language is for communication.
I think communcation is in spite of language.
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Richard Lister <[email-masked]>
Date: Mon, 02 Jun 1997 09:51:39 -0400

On Mon, 2 Jun 1997 14:01:11 +0100 (BST)
[email-masked] (Graeme McCaffery) 
> does anyone already do this?

Grab xcb from ftp://www.x.org/contrib/utilities/ and use it in a
script like this:

#!/bin/sh
## Note: not fully tested

url=`xcb -S 0 && xcb -p 0`

if [ "$url" ] ; then
  netscape -remote openURL\("$url"\) >/dev/null 2>&1 \
    || exec netscape "$url" &
else
  exec netscape &
fi

exit 0

Then just call this script from a button.

Ric

Richard J Lister, Georgetown Institute for Cognitive and Computational Sciences
Georgetown University Medical Center, Washington, DC.
Phone: 202-687 2878
Email: [email-masked] 
Web: http://www.giccs.georgetown.edu/
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Larry Gensch <[email-masked]>
Date: Mon, 2 Jun 1997 09:52:58 -0400 (EDT)

> that will send netscape a string that's highlighted.

Yup, I've bound mouse button 3 to a shell script (which uses tcl/tk to
get the selection) that will connect with a netscape session.  Note
that embedded double quotes in the selection will cause some problem.

Here's the ns-sel.sh script:

    #! /bin/sh

    NETSCAPE=netscape301

    sel=`tksel.tk`

    if [ -n "$sel" ]
    then
	ARG="-raise -remote OpenURL($sel,new-window)"
    else
	ARG="$sel"
    fi

    exec $NETSCAPE $ARG

(Replace 'NETSCAPE' assignment with the name of your netscape
executable... we have multiple versions of netscape here, so
'netscape301' runs one of the latest).  The selection is retrieved by a
tcl/tk script called 'tksel.tk' which is reproduced below:

    #! /bin/sh

    # *-tcl-* \
	exec wish4.2 $0 $*

    wm withdraw .
    puts [selection get]
    destroy .

You may want to change the name of your wish interpreter in this
script.  The logic should be pretty easy to figure.

Another application that could be use is 'xcb' (a standard X utility
that manipulates the various cut buffers).  The problem that I've
found is that tcl/tk's selection mechanism seems to be superior to
that used by xcb.

Of course, your milage may vary.  [smile]

-- 
(void) lar3ry();                                      [email-masked]

     "Sometimes it happens.  People just explode.  Natural causes."

---

From: [email-masked] (Stephen Riehm)
Date: Mon, 2 Jun 1997 16:14:24 +0200 (MEZ)

Hi Richard Lister,

> Grab xcb from ftp://www.x.org/contrib/utilities/ and use it in a

A slightly modified version of the script would be as follows, so that
netscape always gets tried with -remote first - otherwise if you tell
fvwm to start a new netscape, but you've got nothing selected, you'll
always get a new netscape, and netscape doesn't like sharing with
itself :-) (In my version of the script, I start netscape on a remote
machine, so I've got to pass the DISPLAY to the script aswell)

#!/bin/sh

DISPLAY=${1:-${DISPLAY}}
export DISPLAY

if [ -n "$url" ] 
then
  netscape -remote openURL\("$url"\) \
    || exec netscape "$url" &
else
  exec netscape -remote \
    || exec netscape &
fi

exit 0

PS: Thanks to Graeme for the idea, I love it!

Steve
_______________________________ ._ o  ________________________________
//   Stephen Riehm             /  //\.        [email-masked]
\\\\ pc-plus                  '  \>> |         Phone: +49 89 45566 148
//// 81539 Munich, Germany        \\ `           Fax: +49 89 45566 113
  \\
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].