[Gambas-user] Gambas Internet Cafe

Dimitri Bellini dimitribellini at ...69...
Tue Mar 30 15:29:09 CEST 2004


Dear Rob
	thanks for example but i have some problem syntax and gambas :-)
If i create a new Project and cut and paste from your mail when i try to run 
the project Gambas return an error about syntax error on line:

SUB StartMozilla()
    cutofftime = Now + (1.0/24.0)   <----- Error Syntax ?
    Timer1.delay = 1000 
    Timer1.enabled = TRUE
    SHELL "mozilla-firebird" AS MozProcess
END

So i decide to retry with more simple prog like this one below:
------------------------
'Gambas class file
PUBLIC MozProcess AS Process
PUBLIC cutofftime AS Long

PUBLIC SUB btnClose_Click()
  ME.Close()
END

PUBLIC SUB Button1_Click()

  MozStart()

END

SUB MozStart()
  
  cutofftime=Now + (1/24)
  tmrSHELL.Delay=1000
  tmrSHELL.Enabled=TRUE
  SHELL "mozilla" AS MozProcess
  
END

PUBLIC SUB Button2_Click()

    IF Now > 100 THEN
     SHELL "killall -HUP mozilla-bin" WAIT
    ENDIF 

END
-----------------------------
With it Works!!!
But When i try to insert the Function Timer the problem still begin.... :-(
So i decide to change something starting from the name on component Timer like 
this:
-------
PUBLIC MozProcess AS Process
PUBLIC cutofftime AS Date

PUBLIC SUB btnClose_Click()
  ME.Close()
END

PUBLIC SUB Button1_Click()

  MozStart()

END

SUB MozStart()
  
  cutofftime=Now +  (1.0/24.0)
  tmrSHELL.Delay=1000
  tmrSHELL.Enabled=TRUE
  SHELL "mozilla" AS MozProcess
  
END

PUBLIC SUB Button2_Click()

  MozStop()

END

PUBLIC SUB tmrSHELL_Timer()

  IF Now > cutofftime THEN
  '  tmrSHELL.Enabled=FALSE
  '  SHELL "killall -HUP mozilla-bin" WAIT
  '  Message.Info("Sorry, your time is up!")
    MozStop()
  ENDIF

END

SUB MozStop()
  
  tmrSHELL.Enabled=FALSE
  SHELL "killall -HUP mozilla-bin" WAIT
  Message.Info("Sorry, your time is up!")
  
END
--------------------------------
With this stupid mod ( :-) ) Works ..
Thanks for your help.. I hope this simple solution help someone.
Bye
Dimitri

On Tuesday 30 March 2004 00:17, Rob wrote:
> On Monday 29 March 2004 14:23, Dimitri Bellini wrote:
> > Dear Rob
> > 	i try to put your code but i have an error syntax in:
> > - shell "mozilla-firefox" as MozProcess
> > I cant understand why?
>
> It looks like the infamous "Gambas hates tabs" problem.
> If you copy it out of somewhere that won't put tabs on the
> clipboard (like Konsole) it might be okay, but otherwise you
> need to delete the whitespace at the beginning of the line in
> the gambas IDE (even if it appears to be spaces) and recompile.
>
> Turns out you need to killall MozillaFirebird-bin (or whatever
> they call it now) to terminate mozilla because the shell script
> you run to start it seems to go away.
>
> Here's actual working code copied out of my local gambas IDE
> (though I had it killing mozilla after 15 seconds, didn't wait
> an hour :) )
>
> PUBLIC MozProcess AS Process
> PUBLIC cutofftime AS Date
>
> SUB StartMozilla()
>     cutofftime = Now + (1.0/24.0)
>     Timer1.delay = 1000
>     Timer1.enabled = TRUE
>     SHELL "mozilla-firebird" AS MozProcess
> END
>
> PUBLIC SUB Timer1_Timer()
>
>   IF Now > cutofftime THEN StopMozilla
>
> END
>
> SUB StopMozilla()
>   timer1.Enabled = FALSE
>
>   SHELL "killall -HUP MozillaFirebird-bin" WAIT
>   WAIT 2
>   SHELL "killall MozillaFirebird-bin" WAIT
>
>   Message.Info("Sorry, your time is up!")
>
> END
>
>
> Rob
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list