[Gambas-user] Args - got it wrong?
Benoît Minisini
g4mba5 at gmail.com
Thu Mar 8 12:35:11 CET 2018
Le 08/03/2018 à 12:12, Rolf-Werner Eilert a écrit :
> 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
>
It's Unix standard : the first argument is always the name used for
runnning your program. The real first argument is actually second, and
so on.
--
Benoît Minisini
More information about the User
mailing list