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
' 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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you!