Hello Matt

On 18-Jun-02, you wrote:

> 
> /*
> * Command:
> *  - CopyToClip
> * Synopsis:
> *  - Copies the current URL to the clipboard (unit 0)
> * Parameters:
> *  - URL/K: complete URL. Without this argument, the source
> *  is taken from the current frame, image or link.
> * Result:
> * RC:
> *  - 0: Ok
> *  - 5: Error
> */
> 
> Just say "CopyToClip" and it'll grab the URL in the location
> bar for the current window. You can then do with the URL what
> you wish..

For example this ;) (Excuse the hack, I'm tired)

/* 'Stolen' from various scripts */

l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
if AddLibrary("rexxsupport.library","rxmui.library", "rxsocket.library")~=0 then exit

address VOYAGER CopyToClip

call RMH_ReadTextClip(url,0)

if index(url,'{') > 0 then do
 cl = substr(url,1,index(url,'{')-1)
 if right(url,1) = '?' then cl = substr(url,1,length(url)-1)
end

if upper(left(url,7))="HTTP://"; then parse var url +7 url
p=pos("/",url)
if p=0 then do
    host=url
    file="/"
end
else do
    p=p-1
    parse var url host +p file
end

p=pos(":",url)
if p=0 then port=80
else do
    p=p-1
    parse var host host +p dummy +1 port
end

if ~Open("STDERR","CONSOLE:","W") then SDTERR="STDOUT"

call info prg"/1.0 � alfie"
call info "Host:" host
call info "Port:" port
call info "File:" file

call info "resolving host addr..."
sin.addraddr=resolve(host)
if sin.addraddr=-1 then call err "host <"host"> not found",1
sin.addrport=port

sock=socket("INET","STREAM")
if sock=-1 then call err "can't create socket"

call info "connecting..."
if connect(sock,"SIN")<0 then call err "can't connect"

fin="D0A"x
request="GET" space(file) "HTTP/1.0"fin
/*if parm.1.flag then request=request"Range: bytes" parm1.value||fin*/
request=request||fin

call info "sending request..."
if send(sock,request)<0 then call err "error sending"

call info "receiving results..."
if recvline(sock,"BUF",256)<0 then call err "error receiving"
if buf="" then call err "empty answer",1
parse var buf http code
if word(code,1)~=200 then call err "error from server" code,1

call info "receiving head..."
do while buf~="D0A"x
    if recvline(sock,"BUF",256)<0 then call err "error receiving"
end

call info "receiving file..."
cnt = 1
res=recv(sock,"BUF",256)
do while res>0
/*    call writech("STDOUT",buf) */
    text.cnt = buf
    cnt = cnt + 1
    res=recv(sock,"BUF",256)
end
text.0 = cnt
if res<0 then call err "error receiving"
call info "done."

call createApp
call handleApp


exit

err:
parse arg msg,ntdoerr
    if ntdoerr~=1 then msg=msg "("errorstring(errno())")"
    call info(msg)
    exit

info: procedure expose text.
parse arg msg
/*    call writeln(STDERR,msg) */
    return

break_c:
    call info "user break."
    exit

createApp: procedure expose text.
    app.Title="Miao"
    app.Version="$VER: Miao .5 (21.5.2002)"
    app.Copyright="No Copyright by Robin"
    app.Author="Robin Hueskes [EMAIL PROTECTED]"
    app.Description="Miao - Toolbar and more"
    app.Base="MIAO"
    app.SubWindow="win"
      win.Class="Window"
      win.AppWindow=1
      win.ID="MAIN"
      win.Title="MiamiOnline"
      win.Contents="mgroup"
      mgroup.class="group"
      mgroup.horiz=1
      mgroup.0="htedit"
       htedit.class="TextEditor"
       htedit.slider="htsl"
        htsl.class="Scrollbar"
      mgroup.1="htsl"
htedit.contents=''
do a = 1 to text.0 -1
       htedit.contents=htedit.contents||text.a
end


    call NewObj("APPLICATION","APP")
    call Notify("win","CloseRequest",1,"app","ReturnID","quit")
    call set("win","open",1)
return

HandleApp: procedure expose text.
    ctrl_c=2**12
    sig=ctrl_c
    do forever
        call NewHandle("app","h",sig)
        if and(h.signals,ctrl_c)>0 then exit
        if h.EventFlag then
            select
                when h.event="QUIT" then exit
                otherwise interpret h.event
            end
        end
    end


Regards
-- 
Robin  \W/  http://www.amiganiac.de/ *PA-Stats & PA-Jokes*
H      � �   
   -ooO-U-Ooo-  mailto:[EMAIL PROTECTED]

_____________________________________________________________________
Voyager Mailing List - http://v3.vapor.com/
Voyager FAQ....: http://faq.vapor.com/voyager/
Listserver Help: mailto:[EMAIL PROTECTED]?Subject=HELP
Unsubscribe....: mailto:[EMAIL PROTECTED]?Subject=UNSUBSCRIBE

Reply via email to