Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Support

Pages: 1 [2] 3 4 ... 59
16
What's New / Re: ScriptBasic Core Windows 32 bit - cURL
« 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>


17
What's New / Re: ScriptBasic Core Windows 32 bit - COM Excel
« 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.  

18
What's New / Re: ScriptBasic Core Windows 32 bit - Sage 100 BOI
« 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>


19
What's New / Re: ScriptBasic Core Windows 32 bit - CIO
« 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.  

20
What's New / ScriptBasic Core Windows 32 bit Install
« 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

21
Documentation / ScriptBasic 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


22
What's New / Re: ScriptBasic - Raspberry Pi
« 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.

23
What's New / Re: ScriptBasic - Raspberry Pi
« on: March 31, 2019, 10:19:03 PM »
This shows some of the SDL_gfx graphic primitives.

Code: Script BASIC
  1. ' SDL_gfx Demo
  2.  
  3. IMPORT gfx.bas
  4.  
  5. screen = gfx::Window(700, 600, "ScriptBasic GFX Demo - Raspberry Pi")
  6. gfx::pixelRGBA(screen, 10, 15, 255, 255, 255, 255)
  7. gfx::lineRGBA(screen, 20, 10, 70, 90, 255, 0, 0, 255)
  8. gfx::trigonRGBA(screen, 500, 50, 550, 200, 600, 150, 0, 255, 255, 255)
  9. gfx::filledTrigonRGBA(screen, 200, 200, 300, 50, 400, 200, 0, 0, 255, 255)
  10. gfx::rectangleRGBA(screen, 10, 300, 100, 380, 0, 255, 0, 255)
  11. gfx::boxRGBA(screen, 210, 76, 325, 300, 255, 0, 0, 150)
  12. gfx::ellipseRGBA(screen, 600, 400, 50, 90, 255, 255, 0, 200)
  13. gfx::filledEllipseRGBA(screen, 600, 400, 25, 150, 0, 255, 0, 255)
  14. x[0] = 350
  15. x[1] = 275
  16. x[2] = 300
  17. x[3] = 325
  18. x[4] = 350
  19. x[5] = 400
  20. y[0] = 325
  21. y[1] = 325
  22. y[2] = 390
  23. y[3] = 390
  24. y[4] = 375
  25. gfx::polygonRGBA(screen, x, y, 6, 255, 255, 255, 155)
  26. s[0] = 400
  27. s[1] = 450
  28. s[2] = 450
  29. s[3] = 425
  30. s[4] = 300
  31. t[0] = 400
  32. t[1] = 410
  33. t[2] = 450
  34. t[3] = 425
  35. t[4] = 500
  36. gfx::filledPolygonRGBA(screen, s, t, 5, 255, 0, 255, 155)
  37. gfx::Update
  38. WHILE gfx::KeyName(1) <> "+escape"
  39. WEND
  40. gfx::Close
  41.  

24
What's New / Re: ScriptBasic - Raspberry Pi
« on: March 31, 2019, 10:17:41 PM »
For those not into the retro BBC BASIC graphics primitives, I ported the SDL_gfx extension module to the Raspberry Pi.

Code: Script BASIC
  1. ' ScriptBasic GFX - Alpha Circles
  2.  
  3. IMPORT gfx.bas
  4.  
  5. scrn = gfx::Window(640, 480, "ScriptBasic GFX - Alpha Circles - Raspberry Pi")
  6. ' Random Value Arrays
  7. RANDOMIZE(gfx::Time())
  8. FOR i = 0 TO 512
  9.   rx[i] = RND() % 640
  10.   ry[i] = 60 + RND() % 480 - 80
  11.   rz[i] = RND() % 64
  12.   rr[i] = RND() AND  255
  13.   rg[i] = RND() AND  255
  14.   rb[i] = RND() AND  255
  15.   af = rx[i] / 640
  16.   ra[i] = INT(255 * af)
  17. NEXT
  18.  
  19. ts = gfx::Time()
  20. FOR i = 0 TO 512
  21.   gfx::filledCircleRGBA scrn, rx[i], ry[i], rz[i], rr[i], rg[i], rb[i], ra[i]
  22. NEXT
  23. te = gfx::Time()
  24. gfx::stringColor scrn, 20, 15, "Time: " & FORMAT("%.4f",(te-ts)/1000) & " Seconds." & CHR(0), 0xffffffff
  25. gfx::Update
  26. WHILE gfx::KeyName(1) <> "+escape"
  27. WEND
  28. gfx::Close
  29.  

25
What's New / Re: ScriptBasic - Raspberry Pi
« on: March 31, 2019, 10:16:30 PM »
Finally the graph example. Hopefully other BBC BASIC fans will contribute examples as well.

Code: Script BASIC
  1. ' Graph Demo
  2.  
  3. IMPORT bbc.bas
  4.  
  5. CONST SDLK_ESCAPE = 27
  6.  
  7. BBC::OPEN "ScriptBasic BBC graphdemo - Raspberry Pi"
  8. t1 = BBC::TIME()
  9. BBC::MODE 31
  10. BBC::ORIGIN 800, 600
  11. xlow = -10
  12. xhigh = 10
  13. ylow = -10
  14. yhigh = 10
  15. depth = 10
  16. xscale = 30
  17. yscale = 12
  18. c = -4000
  19.  
  20. FOR x = xlow TO xhigh
  21.   BBC::MOVE xscale * (x + ylow), yscale * (ylow - x) + c / (x * x + ylow * ylow + depth)
  22.   FOR y = ylow TO yhigh
  23.     BBC::DRAW xscale * (x + y), yscale * (y - x) + c / (x * x + y * y + depth)
  24.   NEXT
  25. NEXT
  26. FOR y = ylow TO yhigh
  27.   BBC::MOVE xscale * (xlow + y), yscale * (y - xlow) + c / (xlow * xlow + y * y + depth)
  28.   FOR x = xlow TO xhigh
  29.     BBC::DRAW xscale * (x + y), yscale * (y - x) + c / (x * x + y * y + depth)
  30.   NEXT
  31. NEXT
  32. t2 = BBC::TIME()
  33. t3 = (t2 - t1) / 1000
  34. BBC::OFF
  35. BBC::VDUSTR "Time: " & FORMAT("%.4f", t3) & " seconds."
  36. WHILE BBC::GETKEY(1) <> SDLK_ESCAPE
  37. WEND
  38. BBC::CLOSE
  39.  

26
What's New / Re: ScriptBasic - Raspberry Pi
« on: March 31, 2019, 10:15:30 PM »
Here is the Fren example.

Code: Script BASIC
  1. ' Fern
  2.  
  3. IMPORT bbc.bas
  4.  
  5. BBC::OPEN "ScriptBasic BBC fern - Raspbery Pi"
  6. t1 = BBC::TIME()
  7. BBC::MODE 31
  8. BBC::ORIGIN 200, 100
  9. BBC::OFF
  10. BBC::GCOL 0, 10
  11. x = 0
  12. y = 0
  13. FOR i = 1 TO 80000
  14.   r = BBC::RND(1)
  15.   IF r <= 0.1 THEN
  16.     a = 0
  17.     b = 0
  18.     c = 0
  19.     d = 0.16
  20.     e = 0
  21.     f = 0
  22.   END IF
  23.   IF r > 0.1 AND r <= 0.86 THEN
  24.     a = .85
  25.     b = .04
  26.     c = -.04
  27.     d = .85
  28.     e = 0
  29.     f = 1.6
  30.   END IF
  31.   IF r > 0.86 AND r <= 0.93 THEN
  32.     a = .2
  33.     b = -.26
  34.     c = .23
  35.     d = .22
  36.     e = 0
  37.     f = 1.6
  38.   END IF
  39.   IF r > 0.93 THEN
  40.     a = -.15
  41.     b = .28
  42.     c = .26
  43.     d = .24
  44.     e = 0
  45.     f = .44
  46.   END IF
  47.   newx = a * x + b * y + e
  48.   newy = c * x + d * y + f
  49.   x = newx
  50.   y = newy
  51.   BBC::MOVE 600 + 96 * x, 32 + 96 * y
  52.   BBC::DRAW 600 + 96 * x, 32 + 96 * y
  53. NEXT i
  54. t2 = BBC::TIME()
  55. t3 = (t2-t1)/1000
  56. BBC::VDUSTR "Time: " & FORMAT("%.4f",t3) & " seconds"
  57. BBC::WAITKEY
  58. BBC::CLOSE
  59.  

27
What's New / Re: ScriptBasic - Raspberry Pi
« on: March 31, 2019, 10:14:08 PM »
I was able to get the BBC BASIC graphics extension module working on the Raspberry Pi.

Code: Script BASIC
  1. ' UFO
  2.  
  3. IMPORT bbc.bas
  4.  
  5. BBC::OPEN "ScriptBasic BBC UFO - Raspberry PI"
  6. t1 = BBC::TIME()
  7. BBC::MODE 31
  8. BBC::ORIGIN 800, 600
  9. xs = 2
  10. ys = 2
  11. BBC::GCOL 0, 14
  12. BBC::OFF
  13. a = 700
  14. b = A * A
  15. c = 600
  16. FOR x = 0 TO a STEP xs
  17.   s = x * x
  18.   p = SQR(b - s)
  19.   FOR i = -p TO p STEP 6 * ys
  20.     r = SQR(s + i * i) / a
  21.     q = (r - 1) * SIN(24 * r)
  22.     y = INT(i / 3 + q * c)
  23.     IF i = -p THEN
  24.       m = y
  25.       n = y
  26.     END IF
  27.     IF y > m THEN m = y
  28.     IF y < n THEN n = y
  29.     IF m = y OR n = y THEN
  30.       BBC::PLOT 69, NOT(x), y
  31.       BBC::PLOT 69, x, y
  32.     END IF
  33.   NEXT
  34. NEXT
  35. t2 = BBC::TIME()
  36. t3 = (t2 - t1) / 1000
  37. BBC::OFF
  38. BBC::VDUSTR "Time: " & FORMAT("%.4f", t3) & " seconds."
  39. WHILE BBC::KEYNAME(1) <> "-escape"
  40. WEND
  41. BBC::CLOSE
  42.  


28
What's New / ScriptBasic - Raspberry Pi
« on: March 30, 2019, 02:25:38 PM »
I'm pleased  to announce a release of ScriptBasic for the Raspberry Pi. You can do a traditional install with a .deb file or as an AppImage

This version of the binaries do NOT work on the Raspberry Pi Zero.
(Requires ARM v7 or greater)

DEB Install:

Code: Bash
  1. sudo apt install ./scriptbasic-2.1-linux-armhf.deb

DEB Uninstall:

Code: Bash
  1. sudo apt remove scriptbasic-2.1-linux-armhf

To run a script use scriba <script nane> when using the DEB Install.

To use the AppImage version ScriptBasic, unzip the file in the /usr/local/bin (or a directory in the system path) and use sb <script_name> to run your scripts. To remove ScriptBasic, remove the sb file.

I have added scriptbasic-rpi-zero.deb as an attachment. This version will run on ALL versions of the Raspberry Pi where the scriptbasic-2.1-linux-armhf.deb and AppImage versiosn will only run on the ARM v7 versions of the boards. The same instructions apply just change the name of the .deb file.


ScriptBasic User and Developer Guides

Most of the ScriptBasic development activity is happening on the All BASIC Forum.

Language Features
  • Tradional BASIC syntax
  • Variant style variables (no definition or declaration  needed)
  • Indexed, associative arrays (or combo of both) no practical limits
  • Muilt-threaded - asynchronous / synchronous execution
  • Unlimited seamless expansion via the extension API
  • Embeddable API
  • Footprint less than 800 KB
  • Runs on everything with a single source tree (written in ANSI C)
  • Application proxy web server that runs ScriptBasic code
  • Cascading pre-processor support
  • Debugger with single step execution, break points and more

Extension Modules
  • libcurl + SSL
  • MySQL
  • SQLite
  • ODBC
  • json
  • XML
  • regex
  • CGI
  • zlib
  • SBT - thread support
  • IUP - cross platform portable GUI
  • SDL_gfx graphics primatives with alpha channel support
  • BBC BASIC graphic library
  • more ..

Free - Open Source - MIT License

Raspberry Pi Downloads Attached

29
What's New / Re: Script BASIC Wiki
« on: August 17, 2018, 09:00:00 PM »
I'm looking for a good Mediawiki template that works well with a programming language. The wiki uses the same syntax highlighting engine this forum uses.


30
What's New / Script BASIC Wiki
« on: August 14, 2018, 04:33:53 PM »
I have updated the Script BASIC Wiki to the latest version of Mediawiki. (what runs Wikipedia)

Direct Link
https://scriptbasic.org/wiki

I plan to document the Script BASIC COM extension module in the updated wiki. The wiki has been a resource I have neglected for some time.  :(


Pages: 1 [2] 3 4 ... 59