Oh... sorry. I was thinking 2004.

In 2003, you'll want to check out AP ShellExecute (better than the
older "AP Sublaunch").

http://www.4d.com/docs/CMU/CMU61957.HTM

Problem with this is, there's no direct way to return stdout and
stderr. I usually have to call a shell script that saves its output in
a file which you I test for back in 4D. Not a great solution.

There are plugins for calling applescripts or shell scripts like...

http://www.pluggers.nl/scripting_tools.html 
or:
http://www.exenevex.com/next/us/prod.php?id=6 (cheaper, but only does
shell cmds.)

You mentioned that you wanted a general do shell script solution
rather than a solution for grabbing http resonses, but if you ever
need to do that, qfree is great, but it's web capture is syncronous,
so your app hangs while it waits for the web server to respond.

Or you could just code it yourself (this is pretty raw, but you'll get
the idea...)

Regards,
Oliver

$vt_URL:="www.4d.com"
If (OK=1) | (Length($vt_URL)>0)
        SET BLOB SIZE($Responce;0)
        SET BLOB SIZE($vBlob;0)
        If (Position("HTTP://";$vt_URL)>0)
                $vt_URL:=Substring($vt_URL;Position("//";$vt_URL)+2)
        End if 
        $start:=Position("/";$vt_URL)
        $Err:=TCP_Open (Substring($vt_URL;1;$start-1);80;$tcp_ID)
        $Request:="GET "+Substring($vt_URL;$start)+" HTTP/1.1"+Char(13)+Char(10)
        $Request:=$Request+"Host: 
"+Substring($vt_URL;1;$start-1)+Char(13)+Char(10)
        $Request:=$Request+"Accept: text/html"+Char(13)+Char(10)
        $Request:=$Request+Char(13)+Char(10)
        $Err:=TCP_State ($tcp_ID;$State)
        $TimeOut:=Current time+$TimeSet
        While ($State#8) & (Current time<$TimeOut)
                DELAY PROCESS(Current process;10)
                $Err:=TCP_State ($tcp_ID;$State)
        End while 
        If ($State=8)
                $Err:=TCP_Send ($tcp_ID;$Request)
                If ($Err=0)
                        $TimeOut:=Current time+$TimeSet
                        Repeat 
                                $Err:=TCP_ReceiveBLOB ($tcp_ID;$Responce)
                                If (BLOB size($Responce)>0)
                                        $TimeOut:=Current time+$TimeSet
                                        COPY BLOB($Responce;$vBlob;0;BLOB 
size($vBlob);BLOB size($Responce))
                                End if 
                                SET BLOB SIZE($Responce;0)
                                $Err:=TCP_State ($tcp_ID;$State)
                                SET WINDOW TITLE("Blob size: "+String(BLOB 
size($vBlob))+" 
"+String($TimeOut-Current time)+" to timeout")
                        Until ($State#8) | ($Err#0) | (Current time>$TimeOut)
                        $Err:=TCP_Close ($tcp_ID)
                        $File:=Request("Enter name of local drive to save 
file.")
                        $File:=$File+":Desktop Folder:URL_Text"
                        If (Test path name($File)<0)
                                $AAA:=Create document($File)
                                CLOSE DOCUMENT($AAA)
                        End if 
                        BLOB TO DOCUMENT($File;$vBlob)
                        SET DOCUMENT TYPE($File;"TEXT")
                        SET DOCUMENT CREATOR($File;"MSWD")
                End if 
        Else 
                ALERT("No connection was made")
        End if 
Else 
        ALERT("No connection was made")
End if
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to