[Gambas-user] Gambas script execution
Charlie Reinl
Karl.Reinl at ...9...
Tue Nov 24 15:01:30 CET 2009
Am Mittwoch, den 25.11.2009, 00:27 +1100 schrieb
nospam.nospam.nospam at ...626...:
> Matteo Lisi wrote:
> > Hi !
> >
> > The first line:
> > #!/usr/bin/ gbs2
> >
> > it's a typing error
> > the right line is:
> > #!/usr/bin/gbs2
> >
> > Thanks Charlie , but the problem , unfortunatly is not the space !
>
> Could the problem be some other typing error?
Salut,
1.)------ full call --------
:~/gambas/2/f3/scriptTest$ /usr/local/bin/gbs2 -c
~/gambas/2/f3/scriptTest/matteo.ga2script
gbs2: warning: cannot find component dbreportviewer2 required by
DBReportDesigner2
CComponent.CalcSortKey.171: #13: Null object
0: CComponent.CalcSortKey.171
1: CComponent.SortComponents.201
2: CComponent._init.123
3: MMain.MakeVirtualProject.180
4: MMain.Main.83
I'v no idea what, and why that gbs2: warning.
The component exists as User-Component, and of course it has nothing to
do with the script
2.)----- my gbs2 version [rev 2429] ------------------------
:~/gambas/2/f3/scriptTest$ /usr/local/bin/gbs2 -V
2.14.0
3.)------ after a chmod +x and changing to #!/usr/local/bin/gbs2 ------
:~/gambas/2/f3/scriptTest$ ./matteo.ga2script
./matteo.gbs: line 3: syntax error near unexpected token `('
./matteo.gbs: line 3: `FUNCTION GetUsedMemory() AS Integer'
perhaps Benoit or Fabien have a Idea!
--
Amicalement
Charlie
-------------- next part --------------
#!/usr/local/bin/gbs2
FUNCTION GetUsedMemory() AS Integer
DIM sRes AS String
DIM aRes AS String[]
DIM cVal AS NEW Collection
DIM sVal AS String
EXEC ["cat", "/proc/meminfo"] TO sRes
FOR EACH sVal IN Split(sRes, "\n", "", TRUE)
aRes = Split(sVal, " ", "", TRUE)
cVal[Left$(aRes[0], -1)] = CInt(aRes[1])
NEXT
RETURN cVal!MemTotal - cVal!MemFree - cVal!Buffers - cVal!Cached + cVal!SwapTotal - cVal!SwapFree - cVal!SwapCached
END
PRINT Subst("Used memory: &1 bytes", GetUsedMemory())
More information about the User
mailing list