[futurebasic] URL the one for me

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2003 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Wed, 17 Dec 2003 19:21:49 -0500
  Greetings.

Time for a "Check for new version item" in my menu I think.

Using Open "Unix" and one of several Ken demos, how can  I know if 
there has been a error (So I can say "No connection present") or 
otherwise know if there is an available internet connection so I can 
dim/undim  the menu choice? Anybody handled that yet?

Thanks.

Below is my personal version checker widget until MacPAD and FB are 
integrated.
(thanks for the demos Ken)

rc

// Requires OS X 10.1 and higher, Open Internet Connection

Local FN CheckVers$(cur as long, urlStr as str255 )
dim as str255 tempStr,out$,main$ , sub1$,sub2$
DIM fnd,start
open "UNIX", 32, "curl -LsS " + urlStr
do
line input #32, tempStr
fnd = INSTR(0,tempStr,"<TITLE>")
long if fnd
start = fnd+7
fnd = INSTR(fnd+7,tempStr,"</TITLE>")
long if fnd
out$ = Mid$(tempstr,start,fnd-start)
end if
fnd = val(out$)
long if fnd > cur
// Cheap way to avoid parsing for an existing constituted version 
string.
main$ = left$(out$,1)
sub1$ = Mid$(out$,2,1)
sub2$ = Mid$(out$,3,1)
out$ = "Newer Version Found : " + main$+"."+sub1$+"."+sub2$
Xelse
long if fnd = cur
out$ = "No newer version has been posted at this time."
Xelse
out$ = "Contact Artly There Software, this version may have been 
withdrawn due to a bug."
end if
end if
end if
HandleEvents
until eof(32) // or FN CommandPeriodCheck // Seems wise...connection 
may hang.
close 32
end FN = out$

DIM test$
// 2.5.1 for instance... At the time of this post the current version 
is 2.5.3, tomorrow will be 2.6 though.
test$ = FN CheckVers$(251, 
"http://www.artlythere.com/compositorversion.shtml")   // Newer version 
found
//test$ = FN CheckVers$(260, 
"http://www.artlythere.com/compositorversion.shtml") // Recalled 
version, contact Author
//test$ = FN CheckVers$(253, 
"http://www.artlythere.com/compositorversion.shtml") // No newer 
version.
stop test$