Link to home
Start Free TrialLog in
Avatar of igfp
igfp

asked on

Command Line Options

I have a problem. On my spalsh screen I test if there is a determined file using this code:

    ' Check command options
    If Command <> "" Then
        If Chr(34) <> Left(Command, 1) Then
            FileName = Command
        Else
            lencommand% = Len(Command) - 2
            FileName$ = Mid(Command, 2, lencommand%)
        End If
    Else
    End If
   
    ' check file
    On Error GoTo nofile:
    Dim strTemp As String * 1
    Dim i As Integer
    i = 0
    Open "file.txt" For Input As 1#
    Do Until EOF(1)
    i% = i% + 1
    Line Input #1, strTemp
    Loop
    Close #1
    If i% <> 70 Or FileLen("file.txt") <> 6368 Then
nofile:
    MsgBox "No file"
    End
    Else
    End If

This works fine if there is no command line. When I drag a file to the aplication icon it causes an error opening the file that I want to check. Is there anything I can do? I don't understand why. It's supposed to open and check file.txt wherever the aplication is. (this file will be there as well)

Thank you
ASKER CERTIFIED SOLUTION
Avatar of GERTJAN
GERTJAN

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of igfp
igfp

ASKER

that's it!!! Apparently once there is a command line input it confunds everything (no idea why) but telling the program to open on App.Path corrects the problem! Excellent!
Thank you!