<div dir="ltr">Hello,<div>I tried to make Gambas GUI controls usable for bash scripts via TCP/IP sockets</div><div>Somehow it works ! Bash scripts need socat to talk to Gambas sockets.</div><div>Simple example App:<br><a href="https://www.bitkistl.com/2020/05/gambas3-gui-server-bash.html">https://www.bitkistl.com/2020/05/gambas3-gui-server-bash.html</a><br></div><div><a href="https://gambas.one/gambasfarm/?id=823&action=search">https://gambas.one/gambasfarm/?id=823&action=search</a></div><div><div><br></div><div>GUI controls/objects/properties can be queried from a bash script the following way:</div><div>by classname   -   eg: textbox </div><div>by classname.object, instance number and property name  - eg: textbox1.text    </div></div><div><br></div><div>#!/bin/bash<br>gambas() { socat -t 1 tcp:localhost:9090 -; }  # connect to gambas GUI <br>while :<br>do <br>  var=$(gambas)   # wait for gambas event<br>  if [ $? -eq 1 ]; then echo "Cannot connect to Gambas App"; exit; fi<br>  echo "Event: " $var<br>  if [ -z "$var" ]; then echo "Disonnected"; break; fi <br>  if [ $var = "Button1_clicked" ]; then <br>    var=$(echo "textbox1.text" | gambas )   # read property value<br>    echo "Age: " $var<br>    if <br>    fi             <br>done</div><div><br></div><div>Introspection of Gambas Controls,Classes, and Object instances work fine now.</div><div><br></div><div>Public Sub full_instrospect(clsname As String)<br></div><div>   Dim cls As Class<br>   Dim count, pos As Integer<br>   Dim oo As Object<br>   Dim string$, result As String<br>   Dim propname, objname, clsn, instance_num As String<br>   <br>   Print "clsname: "; clsname<br>   pos = InStr(clsname, ".")<br>   If pos > 0 Then  <br>        clsn = Left$(clsname, pos - 1)                         ' button1.foreground\n<br>        propname = Trim$(Right$(clsname, Len(clsname) - pos))  ' foreground<br>        objname = clsn<br>        clsname = Left$(clsn, -1)     'remove number           ' button1      <br>        Else <br>        clsname = Trim$(clsname)  <br>        If IsNumber(Right$(clsname)) Then <br>        instance_num = Right$(clsname) <br>        clsname = Left$(clsname, -1)  'remove number           ' button1<br>        Endif<br>      Endif  <br>        <br>   Try cls = Class.Load(clsname)<br>   If Error Then <br>     Print "full_instrospect() "; Error.Text<br>     Print #rsock, "full_instrospect() "; Error.Text<br>     Return<br>   Endif<br>   <br>   If instance_num Then clsname = clsname & instance_num        ' button1 <br>   Print "Controls: "; Me.Controls.Count                        ' number of controls<br>   <br>For Each oo In Me.Controls<br>If Not propname Then Print #rsock, " "; Trim$(<a href="http://oo.name">oo.name</a>)<br>If UCase$(<a href="http://oo.name">oo.name</a>) = UCase$(clsname)                     ' can we find a class or an instance of a class ?<br>  Print "Found cls object: "; clsname<br>      Break<br>Else If UCase$(<a href="http://oo.name">oo.name</a>) = UCase$(objname)<br> Print "Found cls.object object: "; clsname; " "; objname<br>   Try result = Object.GetProperty(oo, propname)<br>     If Error Then<br>        Print #rsock, "full_instrospect() "; Error.Text<br>           Return<br>     Endif<br>     Print #rsock, result<br>     Return         <br>    Else       <br>    Endif      <br>  Next         <br>  Print oo               <br>  Print oo.Name; ":"     <br>  count = 0<br>  For Each string$ In cls.Symbols      'iterate over all symbols<br>     Print string$; ",";<br>     Print #rsock, string$; ",";<br>     count += 1<br>  Next<br>  Print "\nSymbols found: "; count; "\n"<br>  Print #rsock, "\nSymbols found: "; count; "\n"<br><br> count = 0<br> For Each string$ In cls.Symbols<br>         Print "\nTRY: "; clsname; " "; count; " ";<br>         If Not objname Then Print #rsock, "\nTRY: "; clsname; " "; count; " ";<br>         Try result = Object.GetProperty(oo, string$)<br>             If result Not Begins ":" 'is an event !<br>                    Print "Symbol: "; string$; " Value: "; result; "";<br>                    If Not objname Then Print #rsock, "Symbol: "; string$; " Value: "; result; "";<br>                    Endif<br>         If Error Then<br>           Print " Error: "; Error.code; " "; Error.Text; " ";<br>           Print #rsock, " Error: "; Error.code; " "; Error.Text; " ";<br>         Endif<br>         count += 1<br>     Next<br>     Print #rsock, "\n"<br> End    <br><br></div><div>BR,</div><div>Peter</div><div><a href="https://www.bitkistl.com">https://www.bitkistl.com</a></div></div>