<div dir="ltr">Hello,<br><a href="http://gambaswiki.org/wiki/doc/whatisgambas?nh">http://gambaswiki.org/wiki/doc/whatisgambas?nh</a><br><a href="http://gambaswiki.org/wiki/doc/whatisgambas?nh#t4">http://gambaswiki.org/wiki/doc/whatisgambas?nh#t4</a><br><div>Gambas 3.14 output:</div><div><span style="color:rgb(0,0,0);font-family:"Source Code Pro",monospace;font-size:14.6667px;white-space:pre">MMain.GetUsedMemory.14: #6: Type mismatch: wanted Integer, got String instead
MMain.GetUsedMemory.14 MMain.Main.23 </span><br></div><div><span style="color:rgb(0,0,0);font-family:"Source Code Pro",monospace;font-size:14.6667px;white-space:pre"><br></span></div><div><span style="color:rgb(0,0,0);font-family:"Source Code Pro",monospace;font-size:14.6667px;white-space:pre">While I do not fully understand the Type mismatch (got String !?, really ?).</span></div><div><span style="color:rgb(0,0,0);font-family:"Source Code Pro",monospace;font-size:14.6667px;white-space:pre">-When I replace </span>Cint(aRes[1] with CLong(aRes[1]) it works again.</div><div><br></div><div><span style="color:rgb(0,0,0);font-family:"Source Code Pro",monospace;font-size:14.6667px;white-space:pre">Used memory: 265040 Kb /* Output checked on Gambas Playground for stable and daily</span><br></div><div><span style="color:rgb(0,0,0);font-family:"Source Code Pro",monospace;font-size:14.6667px;white-space:pre">
Who could please update the script on Gambaswiki ?</span></div><div><span style="color:rgb(0,0,0);font-family:"Source Code Pro",monospace;font-size:14.6667px;white-space:pre"><br></span></div><div>Scripting with Gambas is nice and gets the job done with good performance.<br>Just wrote a script for testing connectivity, hopefully its useful.<br><a href="https://github.com/pebauer68/scripts/blob/master/networkcheck">https://github.com/pebauer68/scripts/blob/master/networkcheck</a> <span style="color:rgb(0,0,0);font-family:"Source Code Pro",monospace;font-size:14.6667px;white-space:pre"><br></span></div><div><span style="color:rgb(0,0,0);font-family:"Source Code Pro",monospace;font-size:14.6667px;white-space:pre"><br></span></div><div><span style="color:rgb(0,0,0);font-family:"Source Code Pro",monospace;font-size:14.6667px;white-space:pre">Best Regards,
Peter</span></div><div><span style="color:rgb(0,0,0);font-family:"Source Code Pro",monospace;font-size:14.6667px;white-space:pre"><br></span></div><div><span style="color:rgb(0,0,0);font-family:"Source Code Pro",monospace;font-size:14.6667px;white-space:pre">Working Script:</span></div><div>Function GetUsedMemory() As Integer<br> <br> Dim sRes As String<br> Dim aRes As String[]<br> Dim cVal As New Collection<br> Dim sVal As String<br> <br> Exec ["cat", "/proc/meminfo"] To sRes<br> <br> For Each sVal In Split(sRes, "\n", "", True)<br> aRes = Split(sVal, " ", "", True)<br> cVal[Left$(aRes[0], -1)] = <b>CLong(aRes[1])</b><br> Next<br> <br> Return cVal!MemTotal - cVal!MemFree - cVal!Buffers - cVal!Cached + cVal!SwapTotal - cVal!SwapFree - cVal!SwapCached<br> <br>End<br> <br>Print Subst("Used memory: &1 Kb", GetUsedMemory())<br></div><div><span style="color:rgb(0,0,0);font-family:"Source Code Pro",monospace;font-size:14.6667px;white-space:pre"><br></span></div><div><span style="color:rgb(0,0,0);font-family:"Source Code Pro",monospace;font-size:14.6667px;white-space:pre"><br></span></div></div>