[Gambas-user] Args - got it wrong?

Rolf-Werner Eilert rwe-sse at osnanet.de
Thu Mar 8 12:12:14 CET 2018


Hi folks,

Did I get this wrong? Using Args[], I can read commandline arguments 
given to the program during start, right?

This project is a simple PDF viewer. When I insert this into 
Form_Open(), it doesn't run properly. The program shall get the name of 
the file to be openend by the calling application:

   Select Args.Count
   Case 0
     TextLabel1.Text = "Keine Datei angegeben"
   Case 1
     PDFDatei = Args[0]
     If Not Exist(PDFDatei) Then
       TextLabel1.Text = "??? " & PDFDatei
       Return
     Endif
   Case Else
     TextLabel1.Text = "Zu viele Argumente angegeben"
     Return
   End Select

- When I give the name of the file, I get the name of the project.
- When I give no argument (no argument in Project...Arguments), I get 
the same.

It always lands under Case 1 and finds there is no file named "PDF Viewer".

Can you help me here?

Regards
Rolf


More information about the User mailing list