User Tools

Site Tools


5.4.0 Gambas scripting

With the Gambas scripting another scripting language has been created. It is not in competition with the known scripting languages, but complements them in a special way because language elements of gambas are used. The question about a GUI does not arise - it is not needed because a Gambas script is called in a console or executed on a web server.

The program' gbs3' compiles a Gambas script and allows you to execute this script in a console (local). For example, with the program' gbw3' you will be able to start web pages on a web server. The special feature of the illustrations in chapter 5.4.2 for using the program' gbw3' is that no web server has to be used.

Information on the use of CGI scripts and' Gambas WebPages' can be found in chapter 24, while only local Gambas scripts are presented afterwards, for example a simple Gambas script:

#!/usr/bin/env gbs3

  PRINT " Current date: " & SetDateToGerman(Now) & "."
  PRINT " It was precisely" & Format$(Now, "hh:nn:ss") & " Clock!"
END ' Main()

PRIVATE FUNCTION SetDateToGerman(dDatum AS Date) AS String

  DIM aMonatMatrix, aWochenTagMatrix AS NEW String[]
  DIM sWochenTag, sTag, sMonat, sJahr AS String

  aMonatMatrix = "January", "February", "March", "April", "May", "June", "July", "August",
              "September", "October", "November", "December"]
  aWochenTagMatrix = Split("Sunday Monday Tuesday Wednesday Thursday Friday Saturday", " ")

  sWochenTag = aWochenTagMatrix[WeekDay(dDate)]
  sTag = Str(Day(dDate))
  sMonat = aMonatMatrix[Month(dDate) - 1]
  sJahr = Str(Year(dDate))

  RETURN sWochenTag & " - " & sTag & ". " & sMonat & " " & sJahr

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k5/k5.4/start.txt · Last modified: 30.01.2022 (external edit)

Page Tools