Recent Posts

Pages: 1 [2] 3 4 ... 10
11
What's New / Re: ScriptBasic Core Windows 32 bit - Asynchronous Thread
« Last post by Support on May 25, 2021, 03:28:00 PM »
This example creates a ScriptBasic asynchronous thread from a string of source code, sets / gets variables and calls a function.

Code: Script BASIC
  1. ' SBT - Create and call child process script as text source
  2.  
  3. IMPORT sbt.sbi
  4.  
  5. sb_code = """
  6. FUNCTION prtvars(a, b, c)
  7.  PRINT a,"\\n"
  8.  PRINT FORMAT("%g\\n", b)
  9.  PRINT c,"\\n"
  10.  prtvars = "Function Return"
  11. END FUNCTION
  12.  
  13. a = 0
  14. b = 0
  15. c = ""
  16. """
  17.  
  18. sb = SB_New()
  19. SB_Configure sb, "C:/Windows/SCRIBA.INI"
  20. SB_Loadstr sb, sb_code
  21. SB_NoRun sb
  22. ' Call function before running script
  23. funcrtn = SB_CallSubArgs(sb,"main::prtvars", 123, 1.23, "One, Two, Three")
  24. PRINT funcrtn,"\n"
  25. ' Run script initializing globals
  26. SB_Run sb, ""
  27. ' Assign variables values
  28. SB_SetInt sb, "main::a", 321
  29. SB_SetDbl sb, "main::b", 32.1
  30. SB_SetStr sb, "main::c", "Three,Two,One" & CHR(0)
  31. ' Call function again with variables assigned in the previous step
  32. SB_CallSubArgs sb, "main::prtvars", _
  33.           SB_GetVar(sb, "main::a"), _
  34.           SB_GetVar(sb, "main::b"), _
  35.           SB_GetVar(sb, "main::c")
  36. SB_Destroy sb
  37.  


C:\sb_build\examples>sbc sbt_demo.sb
123
1.23
One, Two, Three
Function Return
321
32.1
Three,Two,One

C:\sb_build\examples>

12
What's New / Re: ScriptBasic Core Windows 32 bit - ODBC
« Last post by Support on May 25, 2021, 03:27:14 PM »
This example uses the ODBC extension module to get the customers from the Sage 100 ABC demo company.

Code: Script BASIC
  1. ' Sage 100 Customers - ABC Demo (ProvideX ODBC Driver)
  2.  
  3. IMPORT odbc.sbi
  4.  
  5. dbh = odbc::RealConnect("SOTAMAS90","","")
  6. odbc::Query(dbh,"SELECT * FROM AR_Customer")
  7.  
  8. WHILE odbc::FetchHash(dbh, column)
  9.   PRINT column{"CustomerNo"}," - ",column{"CustomerName"}," - ",column{"TelephoneNo"},"\n"
  10. WEND
  11.  
  12. odbc::Close(dbh)
  13.  


C:\sb_build\examples>sbc odbc_100.sb
ABF - American Business Futures - (414) 555-4787
ABS - ABS - Sage cloud for invoices - (949) 555-7814
AVNET - Avnet Processing Corp - (414) 555-2635
BRESLIN - Breslin Parts Supply - (414) 555-9654
HILLSB - Hillsboro Service Center - (414) 555-6599
INACTIV - Inactive Customer **INACTIVE** - (414) 555--8747
INTMEX - Int. Cust with Mexican Address Name expanded to 50 - +52 646 177 1466
MAVRK - Maverick Papers - (312) 861-1200
RSSUPPL - R & S Supply Corp. - (414) 555-5587
SHEPARD - Shepard Motorworks - (414) 555-6544
ALLENAP - Allen's Appliance Repair - (714) 555-3121
AMERCON - American Concrete Service - (714) 555-2134
ATOZ - A To Z Carpet Supply - (714) 555-2231
AUTOCR - Autocraft Accessories - (714) 555-0101
BAYPYRO - Bay Pyrotronics Corp. - (415) 555-9654
CAPRI - Capri Sailing Ships - (714) 555-4421
CUSTOM - Custom Craft Products - (714) 555-7848
GREALAR - Greater Alarm Company - (714) 555-5531
JELLCO - Jellco Packing - (714) 555-9451
ORANGE - Orange Door & Window Co. - (714) 555-7823

C:\sb_build\examples>

13
What's New / Re: ScriptBasic Core Windows 32 bit - FFI
« Last post by Support on May 25, 2021, 03:26:23 PM »
This example uses the DYC extension module to make a dynamic FFI call to the Windows MessageBox API function.

Code: Script BASIC
  1. ' DYC - FFI Extension
  2.  
  3. DECLARE SUB DLL ALIAS "dyc" LIB "dyc"
  4.  
  5. PRINT DLL("ms,i,USER32.DLL,MessageBox,PZZL", 0, "Message Text", "Title", 3)
  6.  
  7. '""" Return Values
  8. Titlebar Exit = 2
  9. Yes = 6
  10. No = 7
  11. Cancel = 2
  12. """
  13.  


C:\sb_build\examples>sbc dyc_msgbox.sb
6
C:\sb_build\examples>

14
What's New / Re: ScriptBasic Core Windows 32 bit - cURL
« Last post by Support on May 25, 2021, 03:25:19 PM »
This example uses the cURL extension module to download the text version of the War and Peace book.

Code: Script BASIC
  1. 'cURL Example - Download War & Peace book as text file.
  2.  
  3. IMPORT curl.sbi
  4.  
  5. ch = curl::init()
  6. curl::option(ch, "URL", "http://www.textfiles.com/etext/FICTION/warpeace.txt")
  7. curl::option(ch, "FILE", "warpeace.txt")
  8. curl::perform(ch)
  9. PRINT curl::info(ch, "EFFECTIVE_URL"),"\n"
  10. PRINT FORMAT("Data downloaded: %0.0f bytes.\n", curl::info(ch, "SIZE_DOWNLOAD"))
  11. PRINT FORMAT("Total download time: %0.3f sec.\n", curl::info(ch, "TOTAL_TIME"))
  12. PRINT FORMAT("Average download speed: %0.3f kbyte/sec.\n", curl::info(ch, "SPEED_DOWNLOAD") / 1024)
  13. curl::finish(ch)
  14.  


C:\sb_build\examples>sbc curl_wget.sb
http://www.textfiles.com/etext/FICTION/warpeace.txt
Data downloaded: 4434670 bytes.
Total download time: 1.672 sec.
Average download speed: 2590.150 kbyte/sec.

C:\sb_build\examples>

15
What's New / Re: ScriptBasic Core Windows 32 bit - COM Excel
« Last post by Support on May 25, 2021, 03:24:16 PM »
This example populates an Excel spreadsheet using the COM/OLE Automation extension module.

Code: Script BASIC
  1. ' Excel Example
  2.  
  3. IMPORT com.sbi
  4.  
  5. oExcelApp = COM::CREATE(:SET, "Excel.Application")
  6. oWorkBook = COM::CBN(oExcelApp, "Workbooks", :GET)
  7. oExcelWorkbook = COM::CBN(oWorkBook, "Add", :CALL)
  8. oExcelSheet = COM::CBN(oExcelWorkbook, "Worksheets", :GET, 1)
  9. FOR i=1 TO 10
  10.   FOR j=1 TO 10
  11.     oCell = COM::CBN(oExcelSheet, "Cells", :GET, i, j)
  12.     COM::CBN(oCell, "Value", :LET, "test-" & i & "-" & j)
  13.     COM::RELEASE(oCell)
  14.   NEXT
  15. NEXT
  16. COM::CBN(oExcelWorkbook, "SaveAs", :CALL, CURDIR() & "\\sbexcel.xlsx")
  17. COM::CBN(oExcelWorkbook, "Close", :CALL)
  18. COM::CBN(oExcelApp, "Quit", :CALL)
  19.  
  20. PRINT "Spreadsheet Created\n"
  21.  
  22. COM::RELEASE(oExcelSheet)
  23. COM::RELEASE(oExcelWorkbook)
  24. COM::RELEASE(oWorkBook)
  25. COM::RELEASE(oExcelApp)
  26.  
16
What's New / Re: ScriptBasic Core Windows 32 bit - Sage 100 BOI
« Last post by Support on May 25, 2021, 03:22:13 PM »
This is an example of using the COM/OLE extension module with the Sage 100 accounting software getting the first Customer in the table.

Code: Script BASIC
  1. ' Sage 100 - First Customer - Print Selected Columns
  2.  
  3. IMPORT com.sbi
  4.  
  5. oscript = COM::CREATE(:SET, "ProvideX.Script")
  6. COM::CBN(oScript, "Init", :CALL, "C:\\Sage\\Sage 100 Standard\\MAS90\\Home")
  7.  
  8. osession = COM::CBN(oscript, "NewObject", :SET, "SY_Session")
  9. COM::CBN(osession, "nSetUser", :CALL, "UserID", "Password")
  10. COM::CBN(osession, "nsetcompany", :CALL, "ABC")
  11. COM::CBN(osession, "nSetDate", :CALL, "A/R", "20210520")
  12. COM::CBN(osession, "nSetModule", :CALL, "A/R")
  13. ocust = COM::CBN(oscript, "NewObject", :SET, "AR_Customer_svc", osession)
  14. COM::CBN(ocust, "nMoveFirst", :CALL)
  15. CustomerNo = COM::CBN(ocust, "sCustomerNo", :GET)
  16. CustomerName = COM::CBN(ocust, "sCustomerName", :GET)
  17. City = COM::CBN(ocust, "sCity", :GET)
  18. State = COM::CBN(ocust, "sState", :GET)
  19. TelephoneNo = COM::CBN(ocust, "sTelephoneNo", :GET)
  20. COM::CBN(ocust, "DropObject", :CALL)
  21. COM::CBN(osession, "DropObject", :CALL)
  22. COM::RELEASE(oscript)
  23.  
  24. PRINT "Customer:  ", CustomerNo, "  ", CustomerName, "  ", City, "  ", State, "  ", TelephoneNo, "\n"
  25.  


C:\sb_build\examples>sbc com_100.sb
Customer:  ABF  American Business Futures  Milwaukee  WI  (414) 555-4787

C:\sb_build\examples>

17
What's New / Re: ScriptBasic Core Windows 32 bit - CIO
« Last post by Support on May 25, 2021, 03:08:22 PM »
The cio_colors.sb program uses the CIO extension module for console mode screen attributes.

Code: Script BASIC
  1. ' Display all the possible console character colors
  2.  
  3. IMPORT cio.sbi
  4.  
  5. cio::SetColor FWhite
  6. cio::cls
  7. cio::SetTitle "Testing console colors"
  8. FOR i = 1 TO 255
  9.   cio::gotoxy +(i \ 16) * 4 , +(i % 16) * 2
  10.   cio::gotoxy( (i \ 16) * 4 , +(i % 16) * 2 )
  11.   cio::gotoxy (i \ 16) * 4 , +(i % 16) * 2
  12.   cio::SetColor (i)
  13.   j = i
  14.   IF i < 100 THEN j = "0" & j
  15.   PRINT j
  16. NEXT i
  17. cio::SetColor FWhite
  18. cio::SetCursor 0
  19. i = cio::getch()
  20. cio::cls
  21.  
18
What's New / ScriptBasic Core Windows 32 bit Install
« Last post by Support on May 25, 2021, 03:07:09 PM »
The attached ScriptBasic Windows install is a core distribution with the essential extension modules included. A User Guide is included as a Windows .CHM help file. The following posts to this thread are examples that are also included with the install program.



Core Extension Modules
  • COM/OLE Automation
  • cURL Library
  • ODBC
  • SQLite
  • Dynamic FFI
  • Asynchronous / Synchronous Threading

ScriptBasic User Guide

ScriptBasic SandBox Repository

ScriptBasic Download Attached
19
Documentation / ScriptBasic Support
« Last post by Support on January 02, 2021, 03:09:09 AM »


The ScriptBasic (MIT Common License) open source project is maintained by John Spikowski. (Peter Verhas - original author) I'm a senior developer offering affordable programming support for ScriptBasic, Sage 100 and Quickbooks accounting packages.


EMAIL: support@scriptbasic.org
LINKEDIN: John Spikowski
PHONE/TEXT: 360-941-0452
LOCATION: Anacortes, WA USA

20
What's New / Re: ScriptBasic - Raspberry Pi
« Last post by Support on March 31, 2019, 10:20:21 PM »
Attached are the extension modules and dependencies need for the bbc and gfx extension modules. These extensions only work with the DEB install at this time.

One must install the SDL 1.2 and SDL_gfx 1.2 runtime libraries.

sudo apt-get install libsdl1.2debian-1.2.15+dfsg1-4+rpt2
sudo apt-get install libsdl-gfx1.2-5-2.0.25-5

BBC
1. unzip the bbc.zip file in a temp directory
2. sudo cp bbc.so /usr/local/lib/scriba/
3. sudo cp bbc.bas /usr/local/include/scriba/
4. sudo cp libbbc.so /usr/lib/


SDL_gfx
1. unzip the gfx.zip file in a temp directory
2. sudo cp gfx.so /usr/local/lib/scriba/
3. sudo cp gfx.bas /usr/local/include/scriba/

Use the ScriptBasic example code posted in this thread to test your installation.
Pages: 1 [2] 3 4 ... 10