Recent Posts

Pages: [1] 2 3 ... 10
1
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on April 22, 2024, 05:39:26 PM »
Here is what the Online Dictionary and Simple Edit examples look like on Linux. The ScriptBasic code was unchanged from the Windows examples.





2
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on April 22, 2024, 01:51:28 PM »
If you have given ScriptBasic a try, I would like to hear your thoughts about using the BASIC with your projects.

This concludes the ScriptBasic 3.0 release announcement.

3
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on April 21, 2024, 08:15:11 PM »
Here is an older IUP demo I converted to ScriptBasic. This shows some of the other controls and using code to create bitmap images for buttons.



Code: ScriptBasic
  1. ' IUP sample.sb
  2.  
  3. IMPORT iup.bas
  4.  
  5. GLOBAL CONST IUP_CENTER = 0xFFFF
  6. GLOBAL CONST IUP_TITLE = "TITLE"
  7. GLOBAL CONST IUP_VALUE = "VALUE"
  8. GLOBAL CONST IUP_SIZE = "SIZE"
  9. GLOBAL CONST IUP_EXPAND = "EXPAND"
  10. GLOBAL CONST IUP_DROPDOWN = "DROPDOWN"
  11. GLOBAL CONST IUP_POSX = "POSX"
  12. GLOBAL CONST IUP_POSY = "POSY"
  13. GLOBAL CONST IUP_BGCOLOR = "BGCOLOR"
  14. GLOBAL CONST IUP_MARGIN = "MARGIN"
  15. GLOBAL CONST IUP_ALIGNMENT = "ALIGNMENT"
  16. GLOBAL CONST IUP_GAP = "GAP"
  17. GLOBAL CONST IUP_MENU = "MENU"
  18.  
  19. img_bits1 = """
  20. 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1
  21. ,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1
  22. ,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1
  23. ,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,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2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
  86. ,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
  87. """
  88.  
  89. SUB init_dialog
  90.  
  91.   img = Iup::Image(32,32, Iup::CreateImg(img_bits1))
  92.   Iup::SetHandle ("img1", img)
  93.   Iup::SetAttribute (img, "0", "0 0 0")
  94.   Iup::SetAttribute (img, "1", "BGCOLOR")
  95.   Iup::SetAttribute (img, "2", "255 0 0")
  96.  
  97.   img = Iup::Image(32,32, Iup::CreateImg(img_bits2))
  98.   Iup::SetHandle ("img2", img)
  99.   Iup::SetAttribute (img, "0", "0 0 0")
  100.   Iup::SetAttribute (img, "1", "0 255 0")
  101.   Iup::SetAttribute (img, "2", "BGCOLOR")
  102.   Iup::SetAttribute (img, "3", "255 0 0")
  103.  
  104.   mnu = Iup::Menu( _
  105.   Iup::Submenu("IupSubmenu 1",Iup::Menu( _
  106.       Iup::SetAttributes(Iup::Item("IupItem 1 Checked"), "VALUE=ON"), _
  107.       Iup::Separator(), _
  108.       Iup::SetAttributes(Iup::Item("IupItem 2 Disabled"), "ACTIVE=NO"))), _
  109.     Iup::Item("IupItem 3"), _
  110.     Iup::Item("IupItem 4"))
  111.   Iup::SetHandle("mnu",mnu)
  112.  
  113.   _frm_1 = Iup::Frame( _
  114.     Iup::Vbox( _
  115.       Iup::Button("Button Text"), _
  116.       Iup::SetAttributes(Iup::Button(), "IMAGE=img1"), _
  117.       Iup::SetAttributes(Iup::Button(), "IMAGE=img1,IMPRESS=img2")))
  118.   Iup::SetAttribute(_frm_1,IUP_TITLE,"IupButton")
  119.  
  120.   _frm_2 = Iup::Frame( _
  121.     Iup::Vbox( _
  122.       Iup::Label("Label Text"), _
  123.       Iup::SetAttributes(Iup::Label(""), "SEPARATOR=HORIZONTAL"), _
  124.       Iup::SetAttributes(Iup::Label(""), "IMAGE=img1")))
  125.   Iup::SetAttribute(_frm_2,IUP_TITLE,"IupLabel")
  126.  
  127.   _frm_3 = Iup::Frame( _
  128.     Iup::Vbox( _
  129.       Iup::SetAttributes(Iup::Toggle("Toggle Text"), "VALUE=ON"), _
  130.       Iup::SetAttributes(Iup::Toggle(""), "IMAGE=img1,IMPRESS=img2"), _
  131.       Iup::SetAttributes(Iup::Frame(Iup::Radio(Iup::Vbox( _
  132.         Iup::Toggle("Toggle Text"), _
  133.         Iup::Toggle("Toggle Text")))), "TITLE=IupRadio")))
  134.   Iup::SetAttribute(_frm_3,IUP_TITLE,"IupToggle")
  135.  
  136.   _text_1 = Iup::Text()
  137.   Iup::SetAttribute(_text_1,IUP_VALUE,"IupText Text")
  138.   Iup::SetAttribute(_text_1,IUP_SIZE,"80x")
  139.  
  140.   _ml_1 = Iup::MultiLine()
  141.   Iup::SetAttribute(_ml_1,IUP_VALUE,"IupMultiline Text\nSecond Line\nThird Line")
  142.   Iup::SetAttribute(_ml_1,IUP_EXPAND,"YES")
  143.   Iup::SetAttribute(_ml_1,IUP_SIZE,"80x60")
  144.  
  145.   _frm_4 = Iup::Frame(Iup::Vbox( _
  146.     _text_1, _
  147.     _ml_1))
  148.   Iup::SetAttribute(_frm_4,IUP_TITLE,"IupText/IupMultiline")
  149.  
  150.   _list_1 = Iup::List()
  151.   Iup::SetAttribute(_list_1,IUP_EXPAND,"YES")
  152.   Iup::SetAttribute(_list_1,IUP_VALUE,"1")
  153.   Iup::SetAttribute(_list_1,"1","Item 1 Text")
  154.   Iup::SetAttribute(_list_1,"2","Item 2 Text")
  155.   Iup::SetAttribute(_list_1,"3","Item 3 Text")
  156.  
  157.   _list_2 = Iup::List()
  158.   Iup::SetAttribute(_list_2,IUP_DROPDOWN,"YES")
  159.   Iup::SetAttribute(_list_2,IUP_EXPAND,"YES")
  160.   Iup::SetAttribute(_list_2,IUP_VALUE,"2")
  161.   Iup::SetAttribute(_list_2,"1","Item 1 Text")
  162.   Iup::SetAttribute(_list_2,"2","Item 2 Text")
  163.   Iup::SetAttribute(_list_2,"3","Item 3 Text")
  164.  
  165.   _list_3 = Iup::List()
  166.   Iup::SetAttribute(_list_3,"EDITBOX","YES")
  167.   Iup::SetAttribute(_list_3,IUP_EXPAND,"YES")
  168.   Iup::SetAttribute(_list_3,IUP_VALUE,"3")
  169.   Iup::SetAttribute(_list_3,"1","Item 1 Text")
  170.   Iup::SetAttribute(_list_3,"2","Item 2 Text")
  171.   Iup::SetAttribute(_list_3,"3","Item 3 Text")
  172.  
  173.   _frm_5 =  Iup::Frame(Iup::Vbox( _
  174.       _list_1, _
  175.       _list_2, _
  176.       _list_3))
  177.   Iup::SetAttribute(_frm_5,IUP_TITLE,"IupList")
  178.  
  179.   _hbox_1 = Iup::Hbox( _
  180.     _frm_1, _
  181.     _frm_2, _
  182.     _frm_3, _
  183.     _frm_4, _
  184.     _frm_5)
  185.  
  186.   _cnv_1 = Iup::Canvas()
  187.   Iup::SetAttribute(_cnv_1,IUP_POSX,"0.0")
  188.   Iup::SetAttribute(_cnv_1,IUP_POSY,"0.0")
  189.   Iup::SetAttribute(_cnv_1,IUP_BGCOLOR,"128 255 0")
  190.  
  191.   _vbox_1 = Iup::Vbox( _
  192.     _hbox_1, _
  193.     _cnv_1)
  194.   Iup::SetAttribute(_vbox_1,IUP_MARGIN,"5x5")
  195.   Iup::SetAttribute(_vbox_1,IUP_ALIGNMENT,"ARIGHT")
  196.   Iup::SetAttribute(_vbox_1,IUP_GAP,"5")
  197.  
  198.   dlg = Iup::Dialog(_vbox_1)
  199.   Iup::SetHandle("dlg",dlg)
  200.   Iup::SetAttribute(dlg,IUP_MENU,"mnu")
  201.   Iup::SetAttribute(dlg,IUP_TITLE,"IupDialog Title")
  202.  
  203. END SUB
  204.  
  205. ' MAIN
  206.  
  207.   Iup::Open()
  208.   init_dialog()
  209.   Iup::Show(Iup::GetHandle("dlg"))
  210.   Iup::MainLoop()
  211.   Iup::Close()
  212.  
4
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on April 21, 2024, 06:36:00 PM »
A simple editor example.



Code: ScriptBasic
  1. ' IUP Simple Editor
  2.  
  3. IMPORT iup.bas
  4.  
  5. CONST IUP_CENTER = 0xFFFF
  6. CONST IUP_DEFAULT = -2
  7.  
  8.  
  9. FUNCTION Open_CB
  10.   LOCAL filedlg, filename, och, olen, fstr
  11.   filedlg = IUP::FileDlg()
  12.   IUP::SetAttribute(filedlg, "DIALOGTYPE", "OPEN")
  13.   IUP::SetAttribute(filedlg, "EXTFILTER", "Text Files|*.txt|All Files|*.*|")
  14.   IUP::Popup(filedlg, IUP_CENTER, IUP_CENTER)
  15.   IF IUP::GetInt(filedlg, "STATUS") <> -1 THEN
  16.     filename = IUP::GetAttribute(filedlg, "VALUE")
  17.     och = FREEFILE()
  18.     OPEN filename FOR BINARY AS och
  19.     olen = FILELEN(filename)
  20.     fstr = INPUT(olen, och)
  21.     IUP::StoreAttribute(multitext, "VALUE", fstr)
  22.     CLOSE(och)
  23.   END IF
  24.   IUP::Destroy(filedlg)
  25.   Open_CB = IUP_DEFAULT
  26. END FUNCTION
  27.  
  28.  
  29. FUNCTION SaveAs_CB
  30.   LOCAL filedlg, filename, sch, fstr
  31.   filedlg = IUP::FileDlg()
  32.   IUP::SetAttribute(filedlg, "DIALOGTYPE", "SAVE")
  33.   IUP::SetAttribute(filedlg, "EXTFILTER", "Text Files|*.txt|All Files|*.*|")
  34.   IUP::Popup(filedlg, IUP_CENTER, IUP_CENTER)
  35.   IF IUP::GetInt(filedlg, "STATUS") <> -1 THEN
  36.     filename = IUP::GetAttribute(filedlg, "VALUE")
  37.     fstr = IUP::GetAttribute(multitext, "VALUE")
  38.     sch = FREEFILE()
  39.     OPEN filename FOR BINARY AS sch
  40.     PRINT #sch, fstr
  41.     CLOSE(sch)
  42.   END IF
  43.   IUP::Destroy(filedlg)
  44.   SaveAs_CB = IUP_DEFAULT
  45. END FUNCTION
  46.  
  47.  
  48. FUNCTION Font_CB
  49.   LOCAL fontdlg, font
  50.   fontdlg = IUP::FontDlg()
  51.   font = IUP::GetAttribute(multitext, "FONT")
  52.   font &= CHR(0)
  53.   IUP::StoreAttribute(fontdlg, "VALUE", font)
  54.   IUP::Popup(fontdlg, IUP_CENTER, IUP_CENTER)
  55.   IF IUP::GetInt(fontdlg, "STATUS") = 1 THEN
  56.     font = IUP::GetAttribute(fontdlg, "VALUE")
  57.     IUP::StoreAttribute(multitext, "FONT", font)
  58.   END IF
  59.   IUP::Destroy(fontdlg)
  60.   Font_CB = IUP_DEFAULT
  61. END FUNCTION
  62.  
  63.  
  64. FUNCTION About_CB
  65.   IUP::Message("About", "   Simple Editor\n\nIUP ScriptBasic Binding")
  66.   About_CB = IUP_DEFAULT
  67. END FUNCTION
  68.  
  69.  
  70. FUNCTION TextPos
  71.   col = IUP::GetTextX()
  72.   lin = IUP::GetTextY()
  73.   IUP::SetAttribute(lbl_statusbar, "TITLE", "Lin " & lin & ", Col " & col)
  74. ' PRINT "Lin " & lin & ", Col " & col, "\n"
  75.  TextPos = IUP_DEFAULT
  76. END FUNCTION  
  77.  
  78. FUNCTION Find_CB
  79.   find_dlg = Iup::GetAttribute(item_find, "FIND_DIALOG")
  80.   config = Iup::GetAttribute(multitext, "CONFIG")
  81.   Iup::Show(config)
  82.   Find_CB = IUP_DEFAULT
  83. END FUNCTION  
  84.  
  85.  
  86. SUB Win_exit
  87.   Iup::ExitLoop = TRUE
  88. END SUB
  89.  
  90.  
  91. ' *** MAIN ***
  92.  
  93. IUP::Open
  94. IUP::ImageLibOpen()
  95.  
  96.  
  97. multitext = IUP::Text()
  98. tbox = IUP::Vbox(multitext)
  99. IUP::SetAttribute(multitext, "MULTILINE", "YES")
  100. IUP::SetAttribute(multitext, "EXPAND", "YES")
  101. ' IUP::SetAttribute(multitext, "VISIBLECOLUMNS", "20")
  102. Iup::SetCallback(multitext, "CARET_CB", ADDRESS(TextPos()))
  103.  
  104. lbl_statusbar = IUP::Label("Lin 1, Col 1")
  105. IUP::SetAttribute(lbl_statusbar, "NAME", "STATUSBAR")
  106. IUP::SetAttribute(lbl_statusbar, "EXPAND", "HORIZONTAL")
  107. IUP::SetAttribute(lbl_statusbar, "PADDING", "10x5")
  108.  
  109. item_open = IUP::Item("Open")
  110. btn_open = IUP::Button()
  111. IUP::SetAttribute(btn_open, "IMAGE", "IUP_FileOpen")
  112. IUP::SetAttribute(btn_open, "FLAT", "Yes")
  113. IUP::SetAttribute(btn_open, "CANFOCUS", "No")
  114.  
  115. item_saveas = IUP::Item("Save As")
  116. btn_save = IUP::Button("")
  117. IUP::SetAttribute(btn_save, "IMAGE", "IUP_FileSave")
  118. IUP::SetAttribute(btn_save, "FLAT", "Yes")
  119. IUP::SetAttribute(btn_save, "CANFOCUS", "No")
  120.  
  121. item_exit = IUP::Item("Exit")
  122.  
  123. item_find = IUP::Item("Find...")
  124. btn_find = IUP::Button("")
  125. IUP::SetAttribute(btn_find, "IMAGE", "IUP_EditFind")
  126. IUP::SetAttribute(btn_find, "FLAT", "Yes")
  127. IUP::SetAttribute(btn_find, "CANFOCUS", "No")
  128.  
  129. toolbar_hb = IUP::Hbox( _
  130.     btn_open, _
  131.     btn_save, _
  132.     IUP::SetAttributes(IUP::Label(), "SEPARATOR=VERTICAL"), _
  133.     btn_find)
  134.  
  135. IUP::SetAttribute(toolbar_hb, "MARGIN", "5x5")
  136. IUP::SetAttribute(toolbar_hb, "GAP", "2")
  137.  
  138. item_goto = IUP::Item("Go To...")
  139. item_font = IUP::Item("Font...")
  140. item_about = IUP::Item("About...")
  141.  
  142. Iup::SetCallback(item_exit,"ACTION", ADDRESS(Win_exit()))
  143. IUP::SetCallback(item_open, "ACTION", ADDRESS(Open_CB()))
  144. IUP::SetCallback(item_saveas, "ACTION", ADDRESS(SaveAs_CB()))
  145. IUP::SetCallback(item_font, "ACTION", ADDRESS(Font_CB()))
  146. IUP::SetCallback(item_about, "ACTION", ADDRESS(About_CB()))
  147. IUP::SetCallback(item_find, "ACTION", ADDRESS(Find_CB()))
  148.  
  149. file_menu = IUP::Menu( _
  150.     item_open, _
  151.     item_saveas, _
  152.     IUP::Separator(), _
  153.     item_exit)
  154. edit_menu = IUP::Menu( _
  155.     item_find, _
  156.     item_goto)
  157. format_menu = IUP::Menu(item_font)
  158. help_menu = IUP::Menu(item_about)
  159.  
  160. sub_menu_file = IUP::Submenu("File", file_menu)
  161. sub_menu_edit = IUP::Submenu("Edit", edit_menu)
  162. sub_menu_format = IUP::Submenu("Format", format_menu)
  163. sub_menu_help = IUP::Submenu("Help", help_menu)
  164.  
  165. menu = IUP::Menu( _
  166.     sub_menu_file, _
  167.     sub_menu_edit, _
  168.     sub_menu_format, _
  169.     sub_menu_help)
  170.  
  171.  
  172. vbox = IUP::Vbox(toolbar_hb, tbox, lbl_statusbar)
  173.  
  174. dlg = IUP::Dialog(vbox)
  175. IUP::SetAttributeHandle(dlg, "MENU", menu)
  176. IUP::SetAttribute(dlg, "TITLE", "Simple Editor")
  177. IUP::SetAttribute(dlg, "SIZE", "QUARTERxQUARTER")
  178. IUP::ShowXY(dlg, IUP_CENTER, IUP_CENTER)
  179. IUP::SetAttribute(dlg, "USERSIZE")
  180. Iup::SetCallback(dlg, "CLOSE_CB", ADDRESS(Win_exit()))
  181.  
  182. IUP::MainLoop
  183. IUP::Close
  184.  

5
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on April 21, 2024, 04:39:18 PM »
I was able to get IUP working with ScriptBasic Windows 64 bit. This is an example is using sbw64.exe which has Windows styles support and runs as a true Windows app.

I don't plan on releasing IUP until it's tested on Linux and a direct callback method upgrade is done. I use VB6 + VBCCR to build COM form / class object DLLs that ScriptBasic uses on Windows 32 bit.



Code: ScriptBasic
  1. ' IUP Online Dictionary
  2.  
  3. IMPORT iup.bas
  4.  
  5. servers[0]="dict.org"
  6. servers[1]="dict1.us.dict.org"
  7. servers[2]="all.dict.org"
  8.  
  9. about="""This is a Demo
  10. of the IUP GUI Binding
  11. for Scriptbasic"""
  12.  
  13. ' Initialize IUP
  14. Iup::Open()
  15.  
  16. ' Create main window
  17.  
  18. win = Iup::Create("dialog")
  19.   Iup::SetAttributes(win, "TITLE=\"ScriptBasic IUP Online Dictionary\", SIZE=500x300")
  20.   Iup::SetCallback(win,"CLOSE_CB",ADDRESS(Win_exit()))
  21.  
  22. ' Create container to house ALL GUI objects
  23.  
  24. vbox = Iup::Create("vbox")
  25.   Iup::SetAttributes(vbox, "MARGIN=10x10")
  26.  
  27. ' Create server panel
  28.  
  29. topBox = Iup::Create("hbox")
  30.   Iup::SetAttributes(topBox, "GAP=10")
  31.   Iup::Append(vbox, topBox)
  32. serverFrame = Iup::Create("frame")
  33.   Iup::SetAttributes(serverFrame, "TITLE=Servers, EXPAND=YES")
  34.   Iup::Append(topBox, serverFrame)
  35. serverBox = Iup::Create("hbox")
  36.   Iup::SetAttributes(serverBox, "GAP=5")
  37.   Iup::Append(serverFrame, serverBox)
  38. serverCombo = Iup::Create("list")
  39.   Iup::SetAttributes(serverCombo, "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1")
  40.   Iup::Append(serverBox, serverCombo)
  41.   Iup::SetCallback(serverCombo, "ACTION", ADDRESS(serverCombo_selected()))
  42. btnFetch = Iup::Create("button")
  43.   Iup::SetAttributes(btnFetch, "TITLE=Fetch, SIZE = 50x")
  44.   Iup::Append(serverBox, btnFetch)
  45.   Iup::SetCallback(btnFetch, "ACTION", ADDRESS(btnFetch_clicked()))
  46.  
  47. ' Create control panel
  48.  
  49. controlFrame = Iup::Create("frame")
  50.   Iup::SetAttributes(controlFrame, "TITLE=Controls")
  51.   Iup::Append(topBox, controlFrame)
  52. controlBox = Iup::Create("hbox")
  53.   Iup::SetAttributes(controlBox, "GAP=5")
  54.   Iup::Append(controlFrame, controlBox)
  55. btnAbout = Iup::Create("button")
  56.   Iup::SetAttributes(btnAbout, "TITLE=About, SIZE = 50x")
  57.   Iup::Append(controlBox, btnAbout)
  58.   Iup::SetCallback(btnAbout, "ACTION", ADDRESS(btnAbout_clicked()))
  59. btnClear = Iup::Create("button")
  60.   Iup::SetAttributes(btnClear, "TITLE=Clear, SIZE = 50x")
  61.   Iup::Append(controlBox, btnClear)
  62.   Iup::SetCallback(btnClear, "ACTION", ADDRESS(btnClear_clicked()))
  63. btnExit = Iup::Create("button")
  64.   Iup::SetAttributes(btnExit, "TITLE=Exit, SIZE = 50x")
  65.   Iup::Append(controlBox, btnExit)
  66.   Iup::SetCallback(btnExit,"ACTION",ADDRESS(Win_exit()))
  67.  
  68. ' Create dictionary panel
  69.  
  70. dictFrame = Iup::Create("frame")
  71.   Iup::SetAttributes(dictFrame, "TITLE=Dictionaries")
  72.   Iup::Append(vbox, dictFrame)
  73. serverList = Iup::Create("list")
  74.   Iup::SetAttributes(serverList, "EXPAND=YES, VISIBLELINES=1")
  75.   Iup::Append(dictFrame, serverList)
  76.   Iup::SetCallback(serverList, "ACTION", ADDRESS(serverList_selected()))
  77.  
  78. ' Create text part
  79.  
  80. transFrame = IUP::Create("frame")
  81.   Iup::SetAttributes(transFrame, "TITLE=Translation")
  82.   Iup::Append(vbox, transFrame)
  83. text = Iup::Create("text")
  84.   Iup::SetAttributes(text, "MULTILINE=YES, EXPAND=YES")
  85.   Iup::Append(transFrame, text)
  86.  
  87. ' Create entry and search button
  88.  
  89. bottomBox = Iup::Create("hbox")
  90.   Iup::SetAttributes(bottomBox, "GAP=10")
  91.   Iup::Append(vbox, bottomBox)
  92. label = Iup::Create("label")
  93.   Iup::SetAttributes(label, "TITLE=\"Enter Word to Search For:\", SIZE=x12")
  94.   Iup::Append(bottomBox, label)
  95. entry = Iup::Create("text")
  96.   Iup::SetAttributes(entry, "EXPAND=HORIZONTAL")
  97.   Iup::Append(bottomBox, entry)
  98. btnSearch = Iup::Create("button")
  99.   Iup::SetAttributes(btnSearch,"TITLE=Search, SIZE=50x")
  100.   Iup::Append(bottomBox, btnSearch)
  101.   Iup::SetCallback(btnSearch, "ACTION", ADDRESS(btnSearch_clicked()))
  102. chkAll = Iup::Create("toggle")
  103.   Iup::SetAttributes(chkAll, "TITLE=ALL, SIZE=x12")
  104.   Iup::Append(bottomBox, chkAll)
  105. chkUTF = Iup::Create("toggle")
  106.   Iup::SetAttributes(chkUTF, "TITLE=UTF-8, SIZE=x12")
  107.   Iup::Append(bottomBox, chkUTF)
  108.  
  109. ' Add the main GUI container to the Window
  110.  
  111. Iup::Append(win, vbox)
  112.  
  113. ' Setup dialog defaults
  114.  
  115. Iup::Show(win)
  116. Iup::SetFocus(btnFetch)
  117. FOR i = 0 TO UBOUND(servers)
  118.   Iup::SetAttribute(serverCombo, "APPENDITEM", servers[i])
  119. NEXT
  120. Iup::SetAttribute(serverCombo, "VALUE", "1")
  121. Iup::Update(serverCombo)
  122. server_selection = servers[0]
  123.  
  124. ' Main processing loop
  125.  
  126. Iup::MainLoop()
  127. Iup::Close()
  128. END
  129.  
  130. ' Callback routines
  131.  
  132. SUB Win_exit
  133.   Iup::ExitLoop = TRUE
  134. END SUB
  135.  
  136. SUB btnAbout_clicked
  137.   Iup::Message("ABOUT", about)
  138. END SUB
  139.  
  140. SUB serverCombo_selected
  141.   server_selection = Iup::GetListText()
  142. END SUB
  143.  
  144. SUB serverList_selected
  145.   whichDictionary = Iup::GetListText()
  146. END SUB
  147.  
  148. SUB btnFetch_clicked
  149.   LOCAL dat, total, count
  150.   ON ERROR GOTO G_NetError
  151.   OPEN server_selection & ":2628" FOR SOCKET AS #1
  152.   PRINT#1,"SHOW DB\n"
  153.   LINE INPUT#1, dat
  154.   LINE INPUT#1, dat
  155.   count = 0
  156.   WHILE LEFT(dat, 1) <> "."
  157.     LINE INPUT#1, dat
  158.     IF LEFT(dat, 1) <> "." THEN total[count] = TRIM(dat)
  159.     count+=1
  160.   WEND
  161.   PRINT#1,"QUIT\n"
  162.   CLOSE(#1)
  163.   FOR cnt = 0 TO count - 2
  164.     Iup::SetAttribute(serverList, "APPENDITEM", total[cnt])
  165.   NEXT
  166.   Iup::SetAttribute(serverList, "VALUE", "1")
  167.   Iup::Update(serverCombo)
  168.   whichDictionary = total[0]
  169.   EXIT SUB
  170.  
  171.   G_NetError:
  172.   PRINT "Server ",server_selection," not available. (",ERROR,")\n"
  173. END SUB
  174.  
  175. SUB btnClear_clicked
  176.   Iup::ClearList(serverList)
  177.   Iup::SetAttribute(text, "VALUE", "")
  178.   Iup::SetAttribute(entry, "VALUE", "")
  179. END SUB
  180.  
  181. SUB btnSearch_clicked
  182.   LOCAL dict, dat, total, info
  183.   IUP::SetAttribute(text, "VALUE","Fetching....")
  184.   ON ERROR GOTO L_NetError
  185.   dict = LEFT(whichDictionary, INSTR(whichDictionary, " "))
  186.   OPEN server_selection & ":2628" FOR SOCKET AS 1
  187.   IF Iup::GetAttribute(chkAll, "VALUE") THEN
  188.     PRINT#1,"DEFINE * " & Iup::GetAttribute(entry,"VALUE") & "\n"
  189.   ELSE
  190.     PRINT#1,"DEFINE " & dict & " " & Iup::GetAttribute(entry,"VALUE") & "\n"
  191.   END IF
  192.   REPEAT
  193.     LINE INPUT#1, dat
  194.     IF LEFT(dat, 3) = "151" THEN
  195.       total$ &= "------------------------------\r\n"
  196.       total$ &= RIGHT(dat, LEN(dat) - LEN(Iup::GetAttribute(entry, "VALUE")) - LEN(dict))
  197.       total$ &= "------------------------------\r\n"
  198.       REPEAT
  199.         LINE INPUT#1, info
  200.         info = REPLACE(info, CHR(34), CHR(92) & CHR(34))
  201.         IF LEFT(info, 1) <> "." THEN total &= TRIM(info) & "\n"
  202.       UNTIL LEFT(info, 1) = "."
  203.       total &= "\n"
  204.     END IF
  205.   UNTIL LEFT(dat, 3) = "250" OR VAL(LEFT(dat, 3)) > 499
  206.   PRINT#1,"QUIT\n"
  207.   CLOSE(#1)
  208.   IF LEFT(dat, 3) = "552" THEN
  209.     total = "No match found."
  210.   ELSE IF LEFT(dat, 3) = "501" THEN
  211.     total = "Select a dictionary first!"
  212.   ELSE IF LEFT(dat, 3) = "550" THEN
  213.     total = "Invalid database!"
  214.   END IF
  215.   Iup::SetAttribute(text, "VALUE", total)
  216. EXIT SUB
  217.  
  218. L_NetError:
  219.   dat[0] = "Could not lookup word! (" & ERROR & ")"
  220.   Iup::SetAttribute(text, "VALUE", dat)
  221. END SUB
  222.  
6
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on April 19, 2024, 03:45:00 PM »
If you would like to have both 32 and 64 bit versions of ScriptBasic for Windows installed, this is how I have my system setup.

ScriptBasic by default uses SCRIBA.INI as its compiled configuration file with both 32 and 64 bit versions. If you create a scriba.conf configuration file in your bin directory the SCRIBA.INI isn't needed. The other issue with using the C:\Windows directory is it requires ADMIN privileges to create/change/delete it.

1. Install the 32 bit version and move the SCRIBA.INI (C:\Windows) to your ScriptBasic install bin directory and rename it to scriba.conf. Rename SCRIBA.INI.txt to scriba.conf.txt.

2. Install the 64 bit version and do the same as the previous step. In addition rename the 64 bit sbw.exe version to sbwin.exe so it doesn't conflict with the 32 bit version.

To modify your configuration change directory to your bin and execute this command.  This assumes you installed ScriptBasic in the default directories.

32 Bit
sbc -f C:\ScriptBasic\bin\scriba.conf -k scriba.conf.txt

64 Bit
scriba -f C:\ScriptBasic64\bin\scriba.conf -k scriba.conf.txt

The 32 bit version uses xxxx.sbi for IMPORT / INCLUDE files. The 64 bit version uses .bas. Keep that in mind if you're sharing scripts between versions.


7
Scripting Languages / Re: ScriptBasic 3.0 - Windows 64 Bit Install
« Last post by John on April 18, 2024, 06:32:30 PM »
I created a Windows 64 bit ScriptBasic installer which I attached.

If you wish to use the examples provided on the sb-dev-win32 repository, change the include file attribute from .sbi to .bas. In the example scripts

Download Attached
8
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on April 17, 2024, 09:19:49 PM »
This OxygenBasic example embedding ScriptBasic (libscriab.dll) gets the current weather with the curl extension module and using the LIKE ScriptBasic function to parse the temperature from the JSON response.

weather.o2bas
Code: Text
  1. ' O2 SB cURL OpenWeather Example
  2.  
  3. % filename "weather.exe"
  4. includepath "$/inc/"
  5. uses rtl64
  6. include "sbembed.inc"
  7. #console
  8. uses console
  9.  
  10. sys pProgram, fnsn
  11. sbData *arg
  12. sbData *argr
  13. string cr = chr(13,10)
  14.  
  15. pProgram = scriba_new(@newmem, @freemem)
  16. scriba_LoadConfiguration(pProgram, "C:\Windows\SCRIBA.INI")
  17. scriba_SetFileName(pProgram, "weather.sb")
  18. scriba_LoadSourceProgram(pProgram)
  19. scriba_Run(pProgram, "")
  20.  
  21. @arg = scriba_NewSbArgs(pProgram, "s", "Lynden,US")
  22. fnsn = scriba_LookupFunctionByName(pProgram, "main::get_weather")
  23. @argr = scriba_NewSbArgs(pProgram,"s", "")
  24. scriba_CallArgEx(pProgram, fnsn, argr, 1, arg)
  25. string json = argr.str
  26. string mask = `*temp":*,*`
  27. @arg = scriba_NewSbArgs(pProgram, "s s", json, mask)
  28. fnsn = scriba_LookupFunctionByName(pProgram, "main::sb_like")
  29. @argr = scriba_NewSbArgs(pProgram,"i", 0)
  30. scriba_CallArgEx(pProgram, fnsn, argr, 2, arg)
  31. @arg = scriba_NewSbArgs(pProgram, "i", 2)
  32. fnsn = scriba_LookupFunctionByName(pProgram, "main::sb_match")
  33. @argr = scriba_NewSbArgs(pProgram,"s", "")
  34. scriba_CallArgEx(pProgram, fnsn, argr, 1, arg)
  35. print "Lynden WA Temperature is " + argr.str + " F" + cr
  36.  
  37. scriba_DestroySbArgs(pProgram, arg, 2)
  38. scriba_DestroySbArgs(pProgram, argr, 1)
  39. scriba_destroy(pProgram)
  40.  

weather.sb
Code: ScriptBasic
  1. ' OpenWeather - Embedded Example
  2.  
  3. IMPORT curl.bas
  4.  
  5. FUNCTION Get_Weather(place)
  6.   ch = curl::init()
  7.   curl::option(ch, "URL", "https://api.openweathermap.org/data/2.5/weather?q=" & place & "&units=imperial&appid=OpenWeather_API-KEY")
  8.   curl::option(ch, "CUSTOMREQUEST", "GET")
  9.   response = curl::perform(ch)
  10.   curl::finish(ch)
  11.   PRINT response,"\n\n"
  12.   Get_Weather = response
  13. END FUNCTION
  14.  
  15. ' REPLACE
  16. FUNCTION sb_replace(basestr, searchstr, replacestr, occurances, startpos)
  17.   sb_replace = REPLACE(basestr, searchstr, replacestr, occurances, startpos)
  18. END FUNCTION
  19.  
  20. ' LIKE
  21. FUNCTION sb_like(basestr, mask)
  22.   ok = basestr LIKE mask
  23.   sb_like = ok
  24. END FUNCTION
  25.  
  26. ' MATCH
  27. FUNCTION sb_match(segment)
  28.   sb_match = JOKER(segment)
  29. END FUNCTION  
  30.  

Output

C:\OxygenBasic\demos\ScriptBasic>weather
{"coord":{"lon":-122.4521,"lat":48.9465},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"base":"stations","main":{"temp":46.13,"feels_like":46.13,"temp_min":43.59,"temp_max":48.63,"pressure":1028,"humidity":58},"visibility":10000,"wind":{"speed":1.01,"deg":166,"gust":3},"clouds":{"all":0},"dt":1713413156,"sys":{"type":2,"id":2090762,"country":"US","sunrise":1713359602,"sunset":1713409479},"timezone":-25200,"id":5802035,"name":"Lynden","cod":200}

Lynden WA Temperature is 46.13 F

C:\OxygenBasic\demos\ScriptBasic>

9
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on April 16, 2024, 10:16:36 PM »
I found a workaround for the issue. It seems the problem is with assigning with double literals.

Code: Text
  1. double dp = 2.2
  2. scriba_SetVariable(pProgram, v_b, SBT_DOUBLE, 0, dp, "", 0)
  3.  

Output

C:\OxygenBasic\demos\ScriptBasic>getsetvars
1
0.2
Three

101
2.2000000000000002
Thirty Three

C:\OxygenBasic\demos\ScriptBasic>

10
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on April 16, 2024, 08:44:00 PM »
I tried a different embedding example that was more complex and refined. (o2 embed include) The problem seems to be OxygenBasic setting a double in a structure. Getting a double seems to work.

Using SBT to develop your embedding scripts before using them in your development environment is handy.

Embedding ScriptBasic also gives you access to all the extension modules it supports including COM.

getsetvars.o2bas
Code: Text
  1. % filename "getsetvars.exe"
  2. includepath "$/inc/"
  3. uses rtl64
  4. include "sbembed.inc"
  5. #console
  6. uses console
  7.  
  8. sys pProgram
  9. sbData *arg
  10. string cr = chr(13,10)
  11.  
  12. string src = `IMPORT "testvars.sb"` + cr
  13.  
  14. pProgram = scriba_new(@newmem, @freemem)
  15. scriba_LoadConfiguration(pProgram, "C:\Windows\SCRIBA.INI")
  16. scriba_SetFileName(pProgram, "none")
  17. scriba_LoadProgramString(pProgram, src, len(src))
  18. scriba_Run(pProgram, "")
  19.  
  20. sys v_a = scriba_LookupVariableByName(pProgram, "main::a")
  21. sys v_b = scriba_LookupVariableByName(pProgram, "main::b")
  22. sys v_c = scriba_LookupVariableByName(pProgram, "main::c")
  23.  
  24. ' Get defined variable values
  25.  
  26. scriba_GetVariable(pProgram, v_a, @@arg)
  27. print arg.lng + cr
  28. scriba_GetVariable(pProgram, v_b, @@arg)
  29. print arg.dbl + cr
  30. scriba_GetVariable(pProgram, v_c, @@arg)
  31. print arg.str + cr + cr
  32.  
  33. ' Set variable values
  34.  
  35. scriba_SetVariable(pProgram, v_a, SBT_LONG, 101, 0.0, "", 0)
  36. scriba_SetVariable(pProgram, v_b, SBT_DOUBLE, 0, 2.2, "", 0)
  37. scriba_SetVariable(pProgram, v_c, SBT_STRING, 0, 0.0, "Thirty Three", 12)
  38.  
  39. ' Get changed variable values
  40.  
  41. scriba_GetVariable(pProgram, v_a, @@arg)
  42. print arg.lng + cr
  43. scriba_GetVariable(pProgram, v_b, @@arg)
  44. print arg.dbl + cr
  45. scriba_GetVariable(pProgram, v_c, @@arg)
  46. print arg.str + cr
  47.  
  48. scriba_DestroySbArgs(pProgram, arg, 1)
  49. scriba_destroy(pProgram)
  50.  

sbembed.inc
Code: Text
  1. ' ScriptBasic Embedding Include
  2.  
  3. % libScriba = "libScriba.dll"
  4.  
  5. type SbData
  6.   typ as dword
  7.   siz as dword
  8.   union {
  9.     undef as sys
  10.     dbl   as double
  11.     lng   as sys
  12.     str   as char*
  13.     strz  as char*
  14.   }
  15. end type
  16.  
  17. #define SBT_UNDEF  0
  18. #define SBT_DOUBLE 1
  19. #define SBT_LONG   2
  20. #define SBT_STRING 3
  21. #define SBT_ZCHAR  4
  22.  
  23. sys sb = LoadLibrary libScriba
  24. extern ms64
  25.   bind sb
  26.   {
  27.   scriba_new
  28.   scriba_SetStdin()
  29.   scriba_SetStdout()
  30.   scriba_SetEmbedPointer()
  31.   scriba_LoadConfiguration
  32.   scriba_destroy
  33.   scriba_DestroySbData
  34.   scriba_SetFileName
  35.   scriba_LoadSourceProgram
  36.   scriba_LoadProgramString
  37.   scriba_Run
  38.   scriba_GetVariable
  39.   scriba_SetVariable
  40.   scriba_LookupVariableByName
  41.   scriba_LookupFunctionByName
  42.   scriba_Call
  43.   scriba_CallArg
  44.   scriba_NewSbArgs
  45.   scriba_CallArgEx
  46.   scriba_DestroySbArgs
  47.   scriba_DestroySbData
  48.   scriba_NewSbString
  49.   }
  50. end extern
  51.  
  52. function newmem ms64 (sys le) as sys, export
  53.   return getmemory le
  54. end function
  55.  
  56. function freemem ms64 (sys p) export
  57.   freememory p
  58. end function
  59.  

testvars.sb
Code: ScriptBasic
  1. a = 1
  2. b = .2
  3. c = "Three"
  4.  

Output

C:\OxygenBasic\demos\ScriptBasic>getsetvars
1
0.2
Three

101
#qNAN
Thirty Three

C:\OxygenBasic\demos\ScriptBasic>

Pages: [1] 2 3 ... 10