Hi said,
Thank you for your kind words.
--------------------------------------------------------
Moved the VideoPlayer.pb example and associated binaries to:
Embed JS Framework into PureBasic.
--------------------------------------------------------
Updated:
- added 2 examples
-- Stuff\MoreStuff\CPU\
GetUsage.pb, GetUsage.ico-- Stuff\MoreStuff\Download\
Download.pb, Download.ico, Download.vbsGetUsage.pb- measure CPU usage
-
http://www.vbforfree.com/calculate-and-get-the-computers-cpusprocessors-system-usage/This example was originally written to feed data to the example
Flot_RealTime.pb in
Embed JS Framework into PureBasic, but the end result didn't work as expected.
Download.pb- auto-login / download 32bit version of PureBasic (requires authentication)
-
http://www.development-lounge.de/viewtopic.php?f=26&t=6686&start=12Writing this example I assumed it would be similar to using
MSXML2.XMLHTTP in VBScript, but my first attempts failed. It wasn't until I found the script by
amiga that I realized
passing the cookie between sessions and
location adjustments were required.
Building URLs is made easier with
Fiddler.
- at each authentication step / data required to proceed, record a session revealing the true URL (see
Inspectors : Raw tab)
I'm sure many of you have written the VBScript method to download files, but PureBasic (without COMatePLUS) is very different.
- download the package to see a PureBasic version
Code:
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
objHTTP.Open "POST", "http://www.purebasic.com/securedownload/DoLogin.php", False
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.setRequestHeader "Connection", "close"
objHTTP.Send "language=&Login=xxxxxxxx&Password=yyyyyyyy"
objHTTP.Open "GET", "http://www.purebasic.com/securedownload/Transfert.php?Filename=Windows_x86&Version=5_40<S=_LTS", False
objHTTP.Send
If objHTTP.Status = 200 Then
Set objADOStream = CreateObject("ADODB.Stream")
objADOStream.Open
objADOStream.Type = adTypeBinary
objADOStream.Write objHTTP.ResponseBody
objADOStream.Position = 0
objADOStream.SaveToFile "Windows_x86_Version_5_40_LTS.exe", adSaveCreateOverWrite
objADOStream.Close
Set objADOStream = Nothing
End If
Set objHTTP = Nothing