User Tools

Site Tools


k5:k5.4:start

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 

PUBLIC SUB Main()  
  PRINT 
  PRINT " Aktuelles Datum: " & SetDateToGerman(Now) & "." 
  PRINT " Es war genau " & Format$(Now, "hh:nn:ss") & " Uhr!" 
  PRINT  
END ' Main() 

PRIVATE FUNCTION SetDateToGerman(dDatum AS Date) AS String 
   
  DIM aMonatMatrix, aWochenTagMatrix AS NEW String[] 
  DIM sWochenTag, sTag, sMonat, sJahr AS String 
   
  aMonatMatrix.Clear 
  aMonatMatrix = "Januar","Februar","März","April","Mai","Juni","Juli","August",
              "September","Oktober","November","Dezember"] 
  aWochenTagMatrix.Clear 
  aWochenTagMatrix = Split("Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag", " ") 

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

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

Download

Articles

Download

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: 04.01.2019 by honsek

Page Tools