[Gambas-user] Porting from Gambas1 to Gambas2

Benoit Minisini gambas at ...1...
Sun Jan 27 15:03:56 CET 2008


On dimanche 27 janvier 2008, Jeffrey Cobb wrote:
> I'm trying to port an old project from Gambas 1 to Gambas 2 and I've hit
> a snag.  The IDE is saying that "procSystem" is an undefined symbol.  I
> don't understand why as it's clearly defined.  Here are the relevant
> parts of the code:
>
> ' Gambas class file
> PRIVATE procSystem AS Process
>
> PUBLIC SUB RefreshProperties()
>   SHELL "free" FOR READ AS procSystem
>   object.Attach(procSystem, ME, "procSystem")
>   ProcessWait()
> ...
> ...
> END
>
> PUBLIC SUB procSystem_Read()
> DIM sData AS String
> DIM intInput AS Integer
>   sData = ""
>   LINE INPUT #procSystem, sData
>   sData = Trim(sData)
>   strExecArray.Add(sData)
>   strExecArray[0] = Str(strExecArray.Count - 1)
> END
>
> PUBLIC SUB procSystem_Kill()
>   procSystem = NULL
> END
>
> PUBLIC SUB ProcessWait()
>   WHILE (procSystem <> NULL)
>     WAIT 0.1
>   WEND
> END
>
> Any help's appreciated...
> Jeff
>

And more information will be appreciated too! What is the exact error message? 
On which line? It is not clear if it is an error at compilation or at 
execution.

Anyway, there is a syntax change in process execution. Instead of 

>   SHELL "free" FOR READ AS procSystem
>   object.Attach(procSystem, ME, "procSystem")

You must write:

procSystem = SHELL "free" FOR READ AS "procSystem"

I think it should fix your erro.

Moreover, you can run your process that way:

procSystem = SHELL "free" FOR READ AS "procSystem" WAIT

And get rid of your ProcessWait() function.

Regards,

-- 
Benoit Minisini




More information about the User mailing list