Open Forum > What's New
ScriptBasic Windows 32 bit
(1/1)
Support:
I'm putting together another Windows release which I'll post soon.
What's New
[*] Recompile with TDM-GCC-32 10.3.0 release.
[*] Print.c change to use %g for doubles rather than %le.
[*] Updated JSON extension module by AIR.
[*] New webext extension that features a JSON to SB arrays and back again functions..
[*] Updated ODBC extension allowing column length of 4096 bytes and schema extension to generate SQL CREATE statements or return details about a column.
[/list]
I'm not going to be including help or examples in the install. Those resources are available from the ScriptBasic forum.
Stay tuned ...
Support:
Attached is the latest build / install of ScriptBasic Windows 32 bit. Let me know if you have questions or issues with an e-mail or join the forum to contribute. Here are a few examples to try out the extensions.
The install includes a GUI IDE / Debugger as well as console, Windows, DLL and web server versions of the interpreter.
COM/OLE - SAPI text to speech
--- Code: Script BASIC ---' SAPI COM/OLE Example IMPORT com.sbi voice = COM::CREATE(:SET, "SAPI.SpVoice")COM::CBN(voice, "speak", :CALL, "Welcome to ScriptBasic") COM::RELEASE(voice)
Threads - This extension was a fork from the SBHTTPD application server. It gives console and Windows apps threading ability. It also allows using the MT module for sharing variables between the main process and threads.
--- Code: Script BASIC ---' SBT Demo IMPORT sbt.sbi sb_code = """FUNCTION prtvars(a, b, c) PRINT a,"\\n" PRINT FORMAT("%g\\n", b) PRINT c,"\\n" prtvars = "Function Return"END FUNCTION a = 0b = 0c = """"" sb = SB_New()SB_Configure sb, "C:/Windows/SCRIBA.INI"SB_Loadstr sb, sb_codeSB_NoRun sb' Call function before running scriptfuncrtn = SB_CallSubArgs(sb,"main::prtvars", 123, 1.23, "One, Two, Three")PRINT funcrtn,"\n"' Run script initializing globalsSB_Run sb, ""' Assign variables valuesSB_SetInt sb, "main::a", 321SB_SetDbl sb, "main::b", 32.1SB_SetStr sb, "main::c", "Three,Two,One" & CHR(0)' Call function again with variables assigned in the previous stepSB_CallSubArgs sb, "main::prtvars", _ SB_GetVar(sb, "main::a"), _ SB_GetVar(sb, "main::b"), _ SB_GetVar(sb, "main::c")SB_Destroy sb
123
1.23
One, Two, Three
Function Return
321
32.1
Three,Two,One
CIO Colors
--- Code: Script BASIC ---' Display all the possible console character colors IMPORT cio.sbi cio::SetColor FWhitecio::clscio::SetTitle "Testing console colors"FOR i = 1 TO 255 cio::gotoxy +(i \ 16) * 4 , +(i % 16) * 2 cio::gotoxy( (i \ 16) * 4 , +(i % 16) * 2 ) cio::gotoxy (i \ 16) * 4 , +(i % 16) * 2 cio::SetColor (i) j = i IF i < 100 THEN j = "0" & j PRINT jNEXT icio::SetColor FWhitecio::SetCursor 0i = cio::getch()cio::cls
cURL wget
--- Code: Script BASIC ---'cURL Example - Download War & Peace book as text file. IMPORT curl.sbi ch = curl::init()curl::option(ch, "URL", "http://www.textfiles.com/etext/FICTION/warpeace.txt")curl::option(ch, "FILE", "warpeace.txt")curl::perform(ch)PRINT curl::info(ch, "EFFECTIVE_URL"),"\n"PRINT FORMAT("Data downloaded: %0.0f bytes.\n", curl::info(ch, "SIZE_DOWNLOAD"))PRINT FORMAT("Total download time: %0.3f sec.\n", curl::info(ch, "TOTAL_TIME"))PRINT FORMAT("Average download speed: %0.3f kbyte/sec.\n", curl::info(ch, "SPEED_DOWNLOAD") / 1024)curl::finish(ch)
SQLite
--- Code: Script BASIC ---IMPORT sqlite.sbi db = sqlite::open("sqlite_demo.db") sqlite::execute(db,"create table demo (someval integer, sometxt text);")sqlite::execute(db,"insert into demo values (123,'hello');")sqlite::execute(db, "INSERT INTO demo VALUES (234, 'cruel');")sqlite::execute(db, "INSERT INTO demo VALUES (345, 'world');") stmt = sqlite::query(db,"SELECT * FROM demo")WHILE sqlite::row(stmt) = sqlite::SQLITE3_ROW IF sqlite::fetchhash(stmt, column) THEN PRINT column{"someval"},"\t-\t",column{"sometxt"},"\n" END IFWEND sqlite::close(db)
ODBC
--- Code: Script BASIC ---' Sage 100 Customers - ABC Demo (ProvideX ODBC Driver) IMPORT odbc.sbi dbh = odbc::RealConnect("SAGE100","","")odbc::Query(dbh,"SELECT * FROM AR_Customer") WHILE odbc::FetchHash(dbh, column) PRINT column{"CustomerNo"}," - ",column{"CustomerName"}," - ",column{"TelephoneNo"},"\n"WEND odbc::Close(dbh)
WebExt - JSON to SB Array - Dump - SB Array to JSON
--- Code: Script BASIC ---IMPORT webext.sbi json = """{"QueryResponse":{"Customer":[{"Taxable":true,"BillAddr":{"Id":"99","Line1":"4581 Finch St.","Line2":"crows","City":"Bayshore","CountrySubDivisionCode":"CA","PostalCode":"94326"},"ShipAddr":{"Id":"99","Line1":"4581 Finch St.","Line2":"crows","City":"Bayshore","CountrySubDivisionCode":"CA","PostalCode":"94326"},"Job":false,"BillWithParent":false,"Balance":239,"BalanceWithJobs":239,"CurrencyRef":{"value":"USD","name":"United States Dollar"},"PreferredDeliveryMethod":"Print","IsProject":false,"ClientEntityId":"0","domain":"QBO","sparse":false,"Id":"1","SyncToken":"4","MetaData":{"CreateTime":"2022-06-07T16:48:43-07:00","LastUpdatedTime":"2022-07-15T23:48:50-07:00"},"GivenName":"Amy","FamilyName":"Lauterbach","FullyQualifiedName":"Amy's Bird Sanctuary","CompanyName":"Amy's Bird Sanctuary","DisplayName":"Amy's Bird Sanctuary","PrintOnCheckName":"Amy's Bird Sanctuary","Active":true,"V4IDPseudonym":"002098f70e10816c12487da5ddf91ce731f335","PrimaryPhone":{"FreeFormNumber":"(650) 555-3311"},"PrimaryEmailAddr":{"Address":"Birds@Intuit.com"},"DefaultTaxCodeRef":{"value":"2"}},{"Taxable":false,"BillAddr":{"Id":"3","Line1":"12 Ocean Dr.","City":"Half Moon Bay","CountrySubDivisionCode":"CA","PostalCode":"94213","Lat":"37.4307072","Long":"-122.4295234"},"Job":false,"BillWithParent":false,"Balance":85,"BalanceWithJobs":85,"CurrencyRef":{"value":"USD","name":"United States Dollar"},"PreferredDeliveryMethod":"Print","IsProject":false,"ClientEntityId":"0","domain":"QBO","sparse":false,"Id":"2","SyncToken":"0","MetaData":{"CreateTime":"2022-06-07T16:49:28-07:00","LastUpdatedTime":"2022-06-14T12:56:01-07:00"},"GivenName":"Bill","FamilyName":"Lucchini","FullyQualifiedName":"Bill's Windsurf Shop","CompanyName":"Bill's Windsurf Shop","DisplayName":"Bill's Windsurf Shop","PrintOnCheckName":"Bill's Windsurf Shop","Active":true,"V4IDPseudonym":"002098640048259088425d9597407a9d8707bf","PrimaryPhone":{"FreeFormNumber":"(415) 444-6538"},"PrimaryEmailAddr":{"Address":"Surf@Intuit.com"}},{"Taxable":false,"BillAddr":{"Id":"4","Line1":"65 Ocean Dr.","City":"Half Moon Bay","CountrySubDivisionCode":"CA","PostalCode":"94213","Lat":"37.4300318","Long":"-122.4336537"},"Job":false,"BillWithParent":false,"Balance":0,"BalanceWithJobs":0,"CurrencyRef":{"value":"USD","name":"United States Dollar"},"PreferredDeliveryMethod":"Print","IsProject":false,"ClientEntityId":"0","domain":"QBO","sparse":false,"Id":"3","SyncToken":"0","MetaData":{"CreateTime":"2022-06-07T16:51:22-07:00","LastUpdatedTime":"2022-06-15T12:59:21-07:00"},"GivenName":"Grace","FamilyName":"Pariente","FullyQualifiedName":"Cool Cars","CompanyName":"Cool Cars","DisplayName":"Cool Cars","PrintOnCheckName":"Cool Cars","Active":true,"V4IDPseudonym":"002098f42dce34ccf04f83aa5ffe4cc8202370","PrimaryPhone":{"FreeFormNumber":"(415) 555-9933"},"PrimaryEmailAddr":{"Address":"Cool_Cars@intuit.com"}}],"startPosition":1,"maxResults":3},"time":"2022-08-18T14:23:27.912-07:00"}""" web::json2sba(json)web::sbadump(json)PRINT "\n\n"jsonstr = web::sba2json(json)PRINT jsonstr
sbadump
--- Code: Text ---QueryResponse Customer [1] Taxable = TRUE BillAddr Id = 99 Line1 = 4581 Finch St. Line2 = crows City = Bayshore CountrySubDivisionCode = CA PostalCode = 94326 ShipAddr Id = 99 Line1 = 4581 Finch St. Line2 = crows City = Bayshore CountrySubDivisionCode = CA PostalCode = 94326 Job = FALSE BillWithParent = FALSE Balance = 239 BalanceWithJobs = 239 CurrencyRef value = USD name = United States Dollar PreferredDeliveryMethod = Print IsProject = FALSE ClientEntityId = 0 domain = QBO sparse = FALSE Id = 1 SyncToken = 4 MetaData CreateTime = 2022-06-07T16:48:43-07:00 LastUpdatedTime = 2022-07-15T23:48:50-07:00 GivenName = Amy FamilyName = Lauterbach FullyQualifiedName = Amy's Bird Sanctuary CompanyName = Amy's Bird Sanctuary DisplayName = Amy's Bird Sanctuary PrintOnCheckName = Amy's Bird Sanctuary Active = TRUE V4IDPseudonym = 002098f70e10816c12487da5ddf91ce731f335 PrimaryPhone FreeFormNumber = (650) 555-3311 PrimaryEmailAddr Address = Birds@Intuit.com DefaultTaxCodeRef value = 2 [2] Taxable = FALSE BillAddr Id = 3 Line1 = 12 Ocean Dr. City = Half Moon Bay CountrySubDivisionCode = CA PostalCode = 94213 Lat = 37.4307072 Long = -122.4295234 Job = FALSE BillWithParent = FALSE Balance = 85 BalanceWithJobs = 85 CurrencyRef value = USD name = United States Dollar PreferredDeliveryMethod = Print IsProject = FALSE ClientEntityId = 0 domain = QBO sparse = FALSE Id = 2 SyncToken = 0 MetaData CreateTime = 2022-06-07T16:49:28-07:00 LastUpdatedTime = 2022-06-14T12:56:01-07:00 GivenName = Bill FamilyName = Lucchini FullyQualifiedName = Bill's Windsurf Shop CompanyName = Bill's Windsurf Shop DisplayName = Bill's Windsurf Shop PrintOnCheckName = Bill's Windsurf Shop Active = TRUE V4IDPseudonym = 002098640048259088425d9597407a9d8707bf PrimaryPhone FreeFormNumber = (415) 444-6538 PrimaryEmailAddr Address = Surf@Intuit.com [3] Taxable = FALSE BillAddr Id = 4 Line1 = 65 Ocean Dr. City = Half Moon Bay CountrySubDivisionCode = CA PostalCode = 94213 Lat = 37.4300318 Long = -122.4336537 Job = FALSE BillWithParent = FALSE Balance = 0 BalanceWithJobs = 0 CurrencyRef value = USD name = United States Dollar PreferredDeliveryMethod = Print IsProject = FALSE ClientEntityId = 0 domain = QBO sparse = FALSE Id = 3 SyncToken = 0 MetaData CreateTime = 2022-06-07T16:51:22-07:00 LastUpdatedTime = 2022-06-15T12:59:21-07:00 GivenName = Grace FamilyName = Pariente FullyQualifiedName = Cool Cars CompanyName = Cool Cars DisplayName = Cool Cars PrintOnCheckName = Cool Cars Active = TRUE V4IDPseudonym = 002098f42dce34ccf04f83aa5ffe4cc8202370 PrimaryPhone FreeFormNumber = (415) 555-9933 PrimaryEmailAddr Address = Cool_Cars@intuit.com startPosition = 1 maxResults = 3time = 2022-08-18T14:23:27.912-07:00
sba2json
--- Code: Script BASIC ---{ "QueryResponse": { "Customer": [ { "Taxable": true, "BillAddr": { "Id": "99", "Line1": "4581 Finch St.", "Line2": "crows", "City": "Bayshore", "CountrySubDivisionCode": "CA", "PostalCode": "94326" }, "ShipAddr": { "Id": "99", "Line1": "4581 Finch St.", "Line2": "crows", "City": "Bayshore", "CountrySubDivisionCode": "CA", "PostalCode": "94326" }, "Job": false, "BillWithParent": false, "Balance": 239, "BalanceWithJobs": 239, "CurrencyRef": { "value": "USD", "name": "United States Dollar" }, "PreferredDeliveryMethod": "Print", "IsProject": false, "ClientEntityId": "0", "domain": "QBO", "sparse": false, "Id": "1", "SyncToken": "4", "MetaData": { "CreateTime": "2022-06-07T16:48:43-07:00", "LastUpdatedTime": "2022-07-15T23:48:50-07:00" }, "GivenName": "Amy", "FamilyName": "Lauterbach", "FullyQualifiedName": "Amy's Bird Sanctuary", "CompanyName": "Amy's Bird Sanctuary", "DisplayName": "Amy's Bird Sanctuary", "PrintOnCheckName": "Amy's Bird Sanctuary", "Active": true, "V4IDPseudonym": "002098f70e10816c12487da5ddf91ce731f335", "PrimaryPhone": { "FreeFormNumber": "(650) 555-3311" }, "PrimaryEmailAddr": { "Address": "Birds@Intuit.com" }, "DefaultTaxCodeRef": { "value": "2" } }, { "Taxable": false, "BillAddr": { "Id": "3", "Line1": "12 Ocean Dr.", "City": "Half Moon Bay", "CountrySubDivisionCode": "CA", "PostalCode": "94213", "Lat": "37.4307072", "Long": "-122.4295234" }, "Job": false, "BillWithParent": false, "Balance": 85, "BalanceWithJobs": 85, "CurrencyRef": { "value": "USD", "name": "United States Dollar" }, "PreferredDeliveryMethod": "Print", "IsProject": false, "ClientEntityId": "0", "domain": "QBO", "sparse": false, "Id": "2", "SyncToken": "0", "MetaData": { "CreateTime": "2022-06-07T16:49:28-07:00", "LastUpdatedTime": "2022-06-14T12:56:01-07:00" }, "GivenName": "Bill", "FamilyName": "Lucchini", "FullyQualifiedName": "Bill's Windsurf Shop", "CompanyName": "Bill's Windsurf Shop", "DisplayName": "Bill's Windsurf Shop", "PrintOnCheckName": "Bill's Windsurf Shop", "Active": true, "V4IDPseudonym": "002098640048259088425d9597407a9d8707bf", "PrimaryPhone": { "FreeFormNumber": "(415) 444-6538" }, "PrimaryEmailAddr": { "Address": "Surf@Intuit.com" } }, { "Taxable": false, "BillAddr": { "Id": "4", "Line1": "65 Ocean Dr.", "City": "Half Moon Bay", "CountrySubDivisionCode": "CA", "PostalCode": "94213", "Lat": "37.4300318", "Long": "-122.4336537" }, "Job": false, "BillWithParent": false, "Balance": 0, "BalanceWithJobs": 0, "CurrencyRef": { "value": "USD", "name": "United States Dollar" }, "PreferredDeliveryMethod": "Print", "IsProject": false, "ClientEntityId": "0", "domain": "QBO", "sparse": false, "Id": "3", "SyncToken": "0", "MetaData": { "CreateTime": "2022-06-07T16:51:22-07:00", "LastUpdatedTime": "2022-06-15T12:59:21-07:00" }, "GivenName": "Grace", "FamilyName": "Pariente", "FullyQualifiedName": "Cool Cars", "CompanyName": "Cool Cars", "DisplayName": "Cool Cars", "PrintOnCheckName": "Cool Cars", "Active": true, "V4IDPseudonym": "002098f42dce34ccf04f83aa5ffe4cc8202370", "PrimaryPhone": { "FreeFormNumber": "(415) 555-9933" }, "PrimaryEmailAddr": { "Address": "Cool_Cars@intuit.com" } } ], "startPosition": 1, "maxResults": }, "time": "2022-08-18T14:23:27.912-07:00"}
Download Attached
Support:
If you need PEEK/POKE like functionality the DLLm.dll in conjunction with the DYC extension module provides accessing STRING, INTEGER, FLOAT and DOUBLE memory locations as well as returning a VARPTR. If you have a pointer then using a string and VARPTR isn't needed. Attached is the DLLm.dll which should reside in your ScriptBasic bin directory.
--- Code: Script BASIC ---' PEEK / POKE declare sub dyc alias "dyc" lib "dyc" ' STRINGs="ABCDEFGH"ps=dyc("mc,p,DLLm.DLL,VARPTR,Z",s)dyc("mc,i,DLLm.DLL,POKE8,PL",ps+1,0x62)dyc("mc,i,DLLm.DLL,POKE8,PL",ps+2,0x63)PRINT LEFT(s, 8), "\n"ch=dyc("mc,i,DLLm.DLL,PEEK8,P",ps)PRINT CHR(ch),"\n"ch=dyc("mc,i,DLLm.DLL,PEEK8,P",ps+7)PRINT CHR(ch),"\n\n" ' INTEGERSi=""pl=dyc("mc,p,DLLm.DLL,VARPTR,Z",i)dyc("mc,i,DLLm.DLL,POKE32,PL",pl,123)iv=dyc("mc,i,DLLm.DLL,PEEK32,L",pl)PRINT iv,"\n\n" 'DOUBLESd=""pd=dyc("mc,p,DLLm.DLL,VARPTR,Z",d)dyc("mc,i,DLLm.DLL,POKEDOUBLE,PD",pd,1.23)dv=dyc("mc,d,DLLm.DLL,PEEKDOUBLE,P",pd)PRINT dv & "\n"
AbcDEFGH
A
H
123
1.230000
Support:
This is an update for the LCASE / UCASE bug fix done by AIR. This version is referenced as Windows32 2.3 Build 1.
bin
sbc.exe
sbw.exe
sb_engine.dll
lib
libscriba.dll
Navigation
[0] Message Index
Go to full version