Library to include various public libraries
Add this code to your main program:
checkForNQInclude()
...
PROCEDURE checkForNQInclude
IF NOT FILE("nqinclude.prg")
STRTOFILE(httpGetFile("https://raw.githubusercontent.com/vespina/nqinclude/main/nqinclude.prg"),"nqinclude.prg")
IF NOT FILE("nqinclude.prg")
MESSAGEBOX("This library requires NQINCLUDE.PRG wich could not be downloaded at this time",48)
CANCEL
ENDIF
ENDIF
RETURN
PROCEDURE httpGetFile(pcUrl)
pnTimeout = IIF(VARTYPE(pnTimeOut)<>"N",15,pnTimeout)
LOCAL oHTTP
oHTTP = CREATEOBJECT("MSXML2.XMLHTTP")
oHTTP.open("GET", pcUrl, .F.)
oHTTP.Send()
LOCAL nTimeOut
nTimeout = SECONDS()
DO WHILE oHTTP.readyState<>4 OR (SECONDS() - nTimeout) > 15
DOEVENTS
ENDDO
IF oHTTP.readyState <> 4 OR !BETWEEN(oHTTP.status,200,299)
RETURN ""
ENDIF
RETURN oHTTP.responseText()
IF NOT NQInclude("json")
CANCEL
ENDIF
IF NOT NQInclude("json", .F.)
CANCEL
ENDIF
?NQInclude("@@VERSION")
CLOSE ALL
DELETE FILE nqinclude.prg
checkForNQInclude()
Check the source code of NQInclude for a list of available libraries