Author Topic: ProvideX Linux 64 IUP  (Read 3491 times)

support

  • Administrator
  • *****
  • Posts: 844
    • Script BASIC Open Source Project
ProvideX Linux 64 IUP
« on: June 10, 2015, 11:00:34 PM »
Here is an example of an online dictionary program written in ProvideX (PxBasic) for Ubuntu 64 bit and using the IUP (Portable User Interface) with an interface shared object I wrote.

Update: I included a screen shot of the Windows version of ProvideX and IUP. Theming isn't working but the goal was to show the same PVX code running native GUI on Linux and Windows.

Code: Text
  1. ! Online Dictionary - Px* + IUP
  2.  
  3. BEGIN
  4.  
  5. lib = DLL(ADDR "/home/jrs/pxbasic/pxbiup.so")
  6.  
  7. DIM servers$[0]
  8. servers$[0]="dict.org"
  9.  
  10. about$ = "ProvideX IUP Binding"
  11.  
  12. ! Initialize IUP
  13. ok = DLL(lib, "IupOpen")
  14.  
  15. ! Create main window
  16.  
  17. win = DLL(lib, "IupCreate", "dialog"+$00$)
  18.   ok = DLL(lib, "IupSetAttributes", win, "TITLE="+QUO+"Online Dictionary - ProvideX/IUP"+QUO+", SIZE=500x300"+$00$)
  19.   ok = DLL(lib, "PxBSetCallback", win,"CLOSE_CB"+$00$)
  20.  
  21. ! Create container to house ALL GUI objects
  22.  
  23. vbox = DLL(lib, "IupCreate", "vbox"+$00$)
  24.   ok = DLL(lib, "IupSetAttributes", vbox, "MARGIN=10x10"+$00$)
  25.  
  26. ! Create server panel
  27.  
  28. topBox = DLL(lib, "IupCreate", "hbox"+$00$)
  29.   ok = DLL(lib, "IupSetAttributes", topBox, "GAP=10"+$00$)
  30.   ok = DLL(lib, "IupAppend", vbox, topBox)
  31. serverFrame = DLL(lib, "IupCreate", "frame"+$00$)
  32.   ok = DLL(lib, "IupSetAttributes", serverFrame, "TITLE=Servers, EXPAND=YES"+$00$)
  33.   ok = DLL(lib, "IupAppend", topBox, serverFrame)
  34. serverBox = DLL(lib, "IupCreate", "hbox"+$00$)
  35.   ok = DLL(lib, "IupSetAttributes", serverBox, "GAP=5"+$00$)
  36.   ok = DLL(lib, "IupAppend", serverFrame, serverBox)
  37. serverCombo = DLL(lib, "IupCreate", "list"+$00$)
  38.   ok = DLL(lib, "IupSetAttributes", serverCombo, "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1"+$00$)
  39.   ok = DLL(lib, "IupAppend", serverBox, serverCombo)
  40.   ok = DLL(lib, "PxBSetCallback", serverCombo, "ACTION"+$00$)
  41. btnFetch = DLL(lib, "IupCreate", "button"+$00$)
  42.   ok = DLL(lib, "IupSetAttributes", btnFetch, "TITLE=Fetch, SIZE = 50x"+$00$)
  43.   ok = DLL(lib, "IupAppend", serverBox, btnFetch)
  44.   ok = DLL(lib, "PxBSetCallback", btnFetch, "ACTION"+$00$)
  45.  
  46. ! Create control panel
  47.  
  48. controlFrame = DLL(lib, "IupCreate", "frame"+$00$)
  49.   ok = DLL(lib, "IupSetAttributes", controlFrame, "TITLE=Controls"+$00$)
  50.   ok = DLL(lib, "IupAppend", topBox, controlFrame)
  51. controlBox = DLL(lib, "IupCreate", "hbox"+$00$)
  52.   ok = DLL(lib, "IupSetAttributes", controlBox, "GAP=5"+$00$)
  53.   ok = DLL(lib, "IupAppend", controlFrame, controlBox)
  54. btnAbout = DLL(lib, "IupCreate", "button"+$00$)
  55.   ok = DLL(lib, "IupSetAttributes", btnAbout, "TITLE=About, SIZE = 50x"+$00$)
  56.   ok = DLL(lib, "IupAppend", controlBox, btnAbout)
  57.   ok = DLL(lib, "PxBSetCallback", btnAbout, "ACTION"+$00$)
  58. btnClear = DLL(lib, "IupCreate", "button"+$00$)
  59.   ok = DLL(lib, "IupSetAttributes", btnClear, "TITLE=Clear, SIZE = 50x"+$00$)
  60.   ok = DLL(lib, "IupAppend", controlBox, btnClear)
  61.   ok = DLL(lib, "PxBSetCallback", btnClear, "ACTION"+$00$)
  62. btnExit = DLL(lib, "IupCreate", "button"+$00$)
  63.   ok = DLL(lib, "IupSetAttributes", btnExit, "TITLE=Exit, SIZE = 50x"+$00$)
  64.   ok = DLL(lib, "IupAppend", controlBox, btnExit)
  65.   ok = DLL(lib, "PxBSetCallback", btnExit,"ACTION"+$00$)
  66.  
  67. ! Create dictionary panel
  68.  
  69. dictFrame = DLL(lib, "IupCreate", "frame"+$00$)
  70.   ok = DLL(lib, "IupSetAttributes", dictFrame, "TITLE=Dictionaries"+$00$)
  71.   ok = DLL(lib, "IupAppend", vbox, dictFrame)
  72. serverList = DLL(lib, "IupCreate", "list"+$00$)
  73.   ok = DLL(lib, "IupSetAttributes", serverList, "EXPAND=YES, VISIBLELINES=1"+$00$)
  74.   ok = DLL(lib, "IupAppend", dictFrame, serverList)
  75.   ok = DLL(lib, "PxBSetCallback", serverList, "ACTION"+$00$)
  76.  
  77. ! Create text part
  78.  
  79. transFrame = DLL(lib, "IupCreate", "frame"+$00$)
  80.   ok = DLL(lib, "IupSetAttributes", transFrame, "TITLE=Translation"+$00$)
  81.   ok = DLL(lib, "IupAppend", vbox, transFrame)
  82. text = DLL(lib, "IupCreate", "text"+$00$)
  83.   ok = DLL(lib, "IupSetAttributes", text, "MULTILINE=YES, EXPAND=YES"+$00$)
  84.   ok = DLL(lib, "IupAppend", transFrame, text)
  85.  
  86. ! Create entry and search button
  87.  
  88. bottomBox = DLL(lib, "IupCreate", "hbox"+$00$)
  89.   ok = DLL(lib, "IupSetAttributes", bottomBox, "GAP=10"+$00$)
  90.   ok = DLL(lib, "IupAppend", vbox, bottomBox)
  91. label = DLL(lib, "IupCreate", "label"+$00$)
  92.   ok = DLL(lib, "IupSetAttributes", label, "TITLE="+QUO+"Enter Word to Search For:"+QUO+", SIZE=x12"+$00$)
  93.   ok = DLL(lib, "IupAppend", bottomBox, label)
  94. entry = DLL(lib, "IupCreate", "text"+$00$)
  95.   ok = DLL(lib, "IupSetAttributes", entry, "EXPAND=HORIZONTAL"+$00$)
  96.   ok = DLL(lib, "IupAppend", bottomBox, entry)
  97. btnSearch = DLL(lib, "IupCreate", "button"+$00$)
  98.   ok = DLL(lib, "IupSetAttributes", btnSearch, "TITLE=Search, SIZE=50x"+$00$)
  99.   ok = DLL(lib, "IupAppend", bottomBox, btnSearch)
  100.   ok = DLL(lib, "PxBSetCallback", btnSearch, "ACTION"+$00$)
  101. chkAll = DLL(lib, "IupCreate","toggle"+$00$)
  102.   ok = DLL(lib, "IupSetAttributes", chkAll, "TITLE=ALL, SIZE=x12"+$00$)
  103.   ok = DLL(lib, "IupAppend", bottomBox, chkAll)
  104. chkUTF = DLL(lib, "IupCreate", "toggle"+$00$)
  105.   ok = DLL(lib, "IupSetAttributes", chkUTF, "TITLE=UTF-8, SIZE=x12"+$00$)
  106.   ok = DLL(lib, "IupAppend", bottomBox, chkUTF)
  107.  
  108. ! Add the main GUI container to the Window
  109.  
  110. ok = DLL(lib, "IupAppend", win, vbox)
  111.  
  112. ! Setup dialog defaults
  113.  
  114. ok = DLL(lib, "IupShow", win)
  115. ok = DLL(lib, "IupSetFocus", btnFetch)
  116. FOR i = 0 TO DIM(READ MAX(servers$))
  117.   ok = DLL(lib, "IupSetAttribute", serverCombo, "APPENDITEM"+$00$, servers$[i]+$00$)
  118. NEXT
  119. ok = DLL(lib, "IupSetAttribute", serverCombo, "VALUE"+$00$, "1"+$00$)
  120. ok = DLL(lib, "IupUpdate", serverCombo)
  121. server_selection$ = servers$[0]
  122.  
  123. ! Main processing loop
  124.  
  125. REPEAT
  126.   WAIT: ok = DLL(lib, "IupLoopStepWait")
  127.   this_event = DLL(lib, "GetEvent")
  128.   IF NOT(this_event) THEN GOTO WAIT
  129.   SWITCH this_event
  130.     CASE serverCombo
  131.       GOSUB serverCombo_selected
  132.       BREAK
  133.     CASE btnFetch
  134.       GOSUB btnFetch_clicked
  135.       BREAK
  136.     CASE btnAbout
  137.       GOSUB btnAbout_clicked
  138.       BREAK
  139.     CASE btnClear
  140.       GOSUB btnClear_clicked
  141.       BREAK
  142.     CASE serverList
  143.       GOSUB serverList_selected
  144.       BREAK
  145.     CASE btnSearch
  146.       GOSUB btnSearch_clicked
  147.       BREAK
  148.   END SWITCH
  149. UNTIL this_event = win OR this_event = btnExit
  150. ok = DLL(lib, "IupClose")
  151. ok = DLL(DROP lib)
  152. END
  153.  
  154. ! Callback routines
  155.  
  156. btnAbout_clicked:
  157.   ok = DLL(lib, "IupMessage", "ABOUT"+$00$, about$)
  158. RETURN
  159.  
  160. serverCombo_selected:
  161.   DIM server_selection$(1024)
  162.   ok = DLL(lib, "GetListSelectedText", server_selection$)
  163.   server_selection$ = STP(server_selection$, 2)
  164. RETURN
  165.  
  166. serverList_selected:
  167.   DIM whichDictionary$(1024)
  168.   ok = DLL(lib, "GetListSelectedText", whichDictionary$)
  169.   whichDictionary$ = STP(whichDictionary$, 2)
  170. RETURN
  171.  
  172. btnFetch_clicked:
  173.   dat$ = ""
  174.   DIM _total$[*]
  175.   count = 1
  176.   OPEN (1,BSZ=16384)"[TCP]"+server_selection$+";2628;NoDelay;stream"
  177.   WRITE (1)"SHOW DB"+$0D0A$
  178.   REPEAT
  179.     READ(1)raw_data$
  180.     dat$ = dat$ + raw_data$
  181.   UNTIL POS("250 ok" = raw_data$)
  182.   WRITE(1)"QUIT"+$0D0A$
  183.   CLOSE(1)
  184.   REPEAT
  185.     eol = POS($0D0A$=dat$)
  186.     _total$[count] = dat$(1,eol - 1)
  187.     dat$ = dat$(eol + 2)
  188.     count += 1
  189.   UNTIL dat$ = ""
  190.   FOR cnt = 3 TO count - 3
  191.     ok = DLL(lib, "IupSetAttribute", serverList, "APPENDITEM"+$00$, _total$[cnt]+$00$)
  192.    NEXT cnt
  193.   ok = DLL(lib, "IupSetAttribute", serverList, "APPENDITEM"+$00$, _total$[3]+$00$)
  194.   ok = DLL(lib, "IupSetAttribute", serverList, "VALUE"+$00$, "1"+$00$)
  195.   ok = DLL(lib, "IupUpdate", serverCombo)
  196.   whichDictionary$ = _total$[3]
  197. RETURN
  198.  
  199. G_NetError:
  200.   PRINT "Server ",server_selection$," not available. (",ERROR,")"
  201. RETURN
  202.  
  203. btnClear_clicked:
  204.   ok = DLL(lib, "IupSetAttribute", serverList,"1"+$00$)
  205.   ok = DLL(lib, "IupSetAttribute", text, "VALUE"+$00$, ""+$00$)
  206.   ok = DLL(lib, "IupSetAttribute", entry, "VALUE"+$00$, ""+$00$)
  207. RETURN
  208.  
  209. btnSearch_clicked:
  210.   dict$ = ""
  211.   dat$ = ""
  212.   total$ = ""
  213.   info$ = ""
  214.   ok = DLL(lib, "IupSetAttribute", text, "VALUE"+$00$, "Fetching...."+$00$)
  215.   dict$ = whichDictionary$(1, POS(" " = whichDictionary$) - 1)
  216.   OPEN (1,BSZ=16384)"[TCP]"+server_selection$+";2628;NoDelay;stream"
  217.   chkval$ = FNIupGetString$(DLL(lib, "IupGetAttribute", chkAll, "VALUE"+$00$))
  218.   IF chkval$ = "ON" THEN {
  219.     WRITE(1)"DEFINE * " + FNIupGetString$(DLL(lib, "IupGetAttribute", entry,"VALUE"+$00$)) + $0D0A$
  220.   } ELSE {
  221.     WRITE(1)"DEFINE " + dict$ + " " + FNIupGetString$(DLL(lib, "IupGetAttribute", entry,"VALUE"+$00$)) + $0D0A$
  222.   }
  223.   REPEAT
  224.     READ(1)raw_data$
  225.     data_str$ = data_str$ + raw_data$
  226.   UNTIL POS("250 ok [d/m/c =" = raw_data$)
  227.   WRITE(1)"QUIT"+$0D0A$
  228.   CLOSE(1)
  229.   ! Remove header
  230.   data_str$ = data_str$(POS($0D0A$=data_str$, 1, 2) + 2)
  231.   REPEAT
  232.     eol = POS($0D0A$=data_str$)
  233.     dat$ = data_str$(1,eol - 1)
  234.     data_str$ = data_str$(eol + 2)
  235.     IF dat$(1, 3) <> "151" THEN GOTO IT
  236.       entstr$ = FNIupGetString$(DLL(lib, "IupGetAttribute", entry, "VALUE"+$00$))
  237.       total$ = total$ + "------------------------------" + $0D0A$
  238.       total$ = total$ + dat$(2 + LEN(entstr$) + LEN(dict$)) + $0D0A$
  239.       total$ = total$ + "------------------------------"+ $0D0A$
  240.       REPEAT
  241.         eol = POS($0D0A$=data_str$)
  242.         info$ = data_str$(1,eol - 1)
  243.         data_str$ = data_str$(eol + 2)
  244.         info$ = SUB(info$, CHR(34), CHR(92) + CHR(34))
  245.         IF LEN(info$) AND info$(1, 1) <> "." THEN total$ += STP(info$, 2) + $0D0A$
  246.       UNTIL info$ > "" AND info$(1, 1) = "."
  247.       total$ += $0D0A$
  248.     IT:
  249.   UNTIL data_str$(1, 3) = "250" OR NUM(data_str$(1, 3)) > 499
  250.   IF dat$(1, 3) = "552" THEN total$ = "No match found."
  251.   IF dat$(1, 3) = "501" THEN total$ = "Select a dictionary first!"
  252.   IF dat$(1, 3) = "550" THEN total$ = "Invalid database!"
  253.   ok = DLL(lib, "IupSetAttribute", text, "VALUE"+$00$, total$+$00$)
  254. RETURN
  255.  
  256. L_NetError:
  257.   dat$ = "Could not lookup word! (" + STR(ERR) + ")"
  258.   ok = DLL(lib, "IupSetAttribute", text, "VALUE"+$00$, dat$+$00$)
  259. RETURN
  260.  
  261. ! DLL() return string emulator
  262.  
  263. DEF FNIupGetString$(LOCAL i_ptr)
  264.   LOCAL strlen, pxbuff$
  265.   DIM pxbuff$(4096)
  266.   strlen = DLL(lib, "ptr2pxbstr", i_ptr, pxbuff$)
  267.   RETURN pxbuff$(1,strlen)
  268. END DEF
  269.  

« Last Edit: June 11, 2015, 09:05:22 PM by support »
Script BASIC Project Manager

support

  • Administrator
  • *****
  • Posts: 844
    • Script BASIC Open Source Project
Script BASIC IUP Windows 64 bit
« Reply #1 on: June 11, 2015, 09:10:38 PM »
This is the Online Dictionary example running under Script BASIC for Windows 64 bit. I used my IUP wrapper library to make the code easier to read.

Code: Script BASIC
  1. ' SBx Online Dictionary
  2.  
  3. servers[0]="dict.org"
  4. servers[1]="dict1.us.dict.org"
  5. servers[2]="all.dict.org"
  6.  
  7. about="""This is a Demo
  8. of the IUP GUI Binding
  9. for Scriptbasic"""
  10.  
  11. INCLUDE "SBx"
  12.  
  13. ' Create main window
  14. win = DIALOG()
  15.   SETPROPERTIES win, "TITLE=\"Script BASIC/IUP 64 bit Online Dictionary\", SIZE = 500x300"
  16.   SETEVENT win, "CLOSE_CB", ADDRESS(Win_exit())
  17.  
  18. ' Create container to house ALL GUI objects
  19. vbx = VBOX()
  20.   SETPROPERTIES vbx, "MARGIN=10x10"
  21.  
  22. ' Create server panel
  23. topBox = HBOX()
  24.   SETPROPERTIES topBox, "GAP=10"
  25.   APPEND vbx, topBox
  26. serverFrame = FRAME()
  27.   SETPROPERTIES serverFrame, "TITLE=Servers, EXPAND=YES"
  28.   APPEND topBox, serverFrame
  29. serverBox = HBOX()
  30.   SETPROPERTIES serverBox, "GAP=5"
  31.   APPEND serverFrame, serverBox
  32. serverCombo = LIST()
  33.   SETPROPERTIES serverCombo, "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1"
  34.   APPEND serverBox, serverCombo
  35.   SETEVENT serverCombo, "ACTION", ADDRESS(serverCombo_selected())
  36. btnFetch = BUTTON()
  37.   SETPROPERTIES btnFetch, "TITLE=Fetch, SIZE = 50x"
  38.   APPEND serverBox, btnFetch
  39.   SETEVENT btnFetch, "ACTION", ADDRESS(btnFetch_clicked())
  40.  
  41. ' Create control panel
  42. controlFrame = FRAME()
  43.   SETPROPERTIES controlFrame, "TITLE=Controls"
  44.   APPEND topBox, controlFrame
  45. controlBox = HBOX()
  46.   SETPROPERTIES controlBox, "GAP=5"
  47.   APPEND controlFrame, controlBox
  48. btnAbout = BUTTON()
  49.   SETPROPERTIES btnAbout, "TITLE=About, SIZE = 50x"
  50.   APPEND controlBox, btnAbout
  51.   SETEVENT btnAbout, "ACTION", ADDRESS(btnAbout_clicked())
  52. btnClear = BUTTON()
  53.   SETPROPERTIES btnClear, "TITLE=Clear, SIZE = 50x"
  54.   APPEND controlBox, btnClear
  55.   SETEVENT btnClear, "ACTION", ADDRESS(btnClear_clicked())
  56. btnExit = BUTTON()
  57.   SETPROPERTIES btnExit, "TITLE=Exit, SIZE = 50x"
  58.   APPEND controlBox, btnExit
  59.   SETEVENT btnExit,"ACTION",ADDRESS(Win_exit())
  60.  
  61. ' Create dictionary panel
  62. dictFrame = FRAME()
  63.   SETPROPERTIES dictFrame, "TITLE=\"Dictionaries\""
  64.   APPEND vbx, dictFrame
  65. serverList = LIST()
  66.   SETPROPERTIES serverList, "EXPAND=YES, VISIBLELINES=1"
  67.   APPEND dictFrame, serverList
  68.   SETEVENT serverList, "ACTION", ADDRESS(serverList_selected())
  69.  
  70. ' Create text part
  71. transFrame = FRAME()
  72.   SETPROPERTIES transFrame, "TITLE=\"Translation\""
  73.   APPEND vbx, transFrame
  74. txt = TEXT()
  75.   SETPROPERTIES txt, "MULTILINE=YES, EXPAND=YES"
  76.   APPEND transFrame, txt
  77.  
  78.  
  79. ' Create entry and search button
  80. bottomBox = HBOX()
  81.   SETPROPERTIES bottomBox, "GAP=10"
  82.   APPEND vbx, bottomBox
  83. lbl = LABEL()
  84.   SETPROPERTIES lbl, "TITLE=\"Enter Word to Search For:\", SIZE=x12"
  85.   APPEND bottomBox, lbl
  86. entry = TEXT()
  87.   SETPROPERTIES entry, "EXPAND=HORIZONTAL"
  88.   APPEND bottomBox, entry
  89. btnSearch = BUTTON()
  90.   SETPROPERTIES btnSearch,"TITLE=Search, SIZE=50x"
  91.   APPEND bottomBox, btnSearch
  92.   SETEVENT btnSearch, "ACTION", ADDRESS(btnSearch_clicked())
  93. chkAll = TOGGLE()
  94.   SETPROPERTIES chkAll, "TITLE=ALL, SIZE=x12"
  95.   APPEND bottomBox, chkAll
  96. chkUTF = TOGGLE()
  97.   SETPROPERTIES chkUTF, "TITLE=UTF-8, SIZE=x12"
  98.   APPEND bottomBox, chkUTF
  99.  
  100. ' Add the main GUI container to the Window
  101. APPEND win, vbx
  102.  
  103. ' Setup dialog defaults
  104. SHOW win
  105. FOCUS btnFetch
  106. FOR i = 0 TO UBOUND(servers)
  107.   SETPROPERTY serverCombo, "APPENDITEM", servers[i]
  108. NEXT
  109. SETPROPERTY serverCombo, "VALUE", "1"
  110. UPDATE serverCombo
  111. server_selection = servers[0]
  112. GETEVENT()
  113. END
  114.  
  115.  
  116. ' Callback routines
  117.  
  118. SUB Win_exit
  119.   Iup::ExitLoop = TRUE
  120. END SUB
  121.  
  122. SUB btnAbout_clicked
  123.   MESSAGE "ABOUT", about
  124. END SUB
  125.  
  126. SUB serverCombo_selected
  127.   server_selection = GETITEM()
  128. END SUB
  129.  
  130. SUB serverList_selected
  131.   whichDictionary = GETITEM()
  132. END SUB
  133.  
  134. SUB btnFetch_clicked
  135.   LOCAL dat, total, count
  136.   ON ERROR GOTO G_NetError
  137.   OPEN server_selection & ":2628" FOR SOCKET AS #1
  138.   PRINT#1,"SHOW DB\n"
  139.   LINE INPUT#1, dat
  140.   LINE INPUT#1, dat
  141.   count = 0
  142.   WHILE LEFT(dat, 1) <> "."
  143.     LINE INPUT#1, dat
  144.     IF LEFT(dat, 1) <> "." THEN total[count] = TRIM(dat)
  145.     count+=1
  146.   WEND
  147.   PRINT#1,"QUIT\n"
  148.   CLOSE(#1)
  149.   FOR cnt = 0 TO count - 2
  150.     SETPROPERTY serverList, "APPENDITEM", total[cnt]
  151.   NEXT
  152.   SETPROPERTY serverList, "VALUE", "1"
  153.   UPDATE serverCombo
  154.   whichDictionary = total[0]
  155.   EXIT SUB
  156.  
  157.   G_NetError:
  158.   PRINT "Server ",server_selection," not available. (",ERROR,")\n"
  159. END SUB
  160.  
  161. SUB btnClear_clicked
  162.   CLEAR serverList
  163.   SETPROPERTY txt, "VALUE", ""
  164.   SETPROPERTY entry, "VALUE", ""
  165. END SUB
  166.  
  167. SUB btnSearch_clicked
  168.   LOCAL dict, dat, total, info
  169.   SETPROPERTY txt, "VALUE", "Fetching...."
  170.   ON ERROR GOTO L_NetError
  171.   dict = LEFT(whichDictionary, INSTR(whichDictionary, " "))
  172.   OPEN server_selection & ":2628" FOR SOCKET AS 1
  173.   IF GETPROPERTY(chkAll, "VALUE") THEN
  174.     PRINT#1,"DEFINE * " & GETPROPERTY(entry, "VALUE") & "\n"
  175.   ELSE
  176.     PRINT#1,"DEFINE " & dict & " " & GETPROPERTY(entry, "VALUE") & "\n"
  177.   END IF
  178.   REPEAT
  179.     LINE INPUT#1, dat
  180.     IF LEFT(dat, 3) = "151" THEN
  181.       total &= "------------------------------\r\n"
  182.       total &= RIGHT(dat, LEN(dat) - LEN(GETPROPERTY(entry, "VALUE")) - LEN(dict))
  183.       total &= "------------------------------\r\n"
  184.       REPEAT
  185.         LINE INPUT#1, info
  186.         info = REPLACE(info, CHR(34), CHR(92) & CHR(34))
  187.         IF LEFT(info, 1) <> "." THEN total &= TRIM(info) & "\n"
  188.       UNTIL LEFT(info, 1) = "."
  189.       total &= "\n"
  190.     END IF
  191.   UNTIL LEFT(dat, 3) = "250" OR VAL(LEFT(dat, 3)) > 499
  192.   PRINT#1,"QUIT\n"
  193.   CLOSE(#1)
  194.   IF LEFT(dat, 3) = "552" THEN
  195.     total = "No match found."
  196.   ELSE IF LEFT(dat, 3) = "501" THEN
  197.     total = "Select a dictionary first!"
  198.   ELSE IF LEFT(dat, 3) = "550" THEN
  199.     total = "Invalid database!"
  200.   END IF
  201.   SETPROPERTY txt, "VALUE", total
  202. EXIT SUB
  203.  
  204. L_NetError:
  205.   dat[0] = "Could not lookup word! (" & ERROR & ")"
  206.   SETPROPERTY txt, "VALUE", dat
  207. END SUB
  208.  
Script BASIC Project Manager