View Single Post
  #6 (permalink)  
Old 03-10-2008, 06:48 PM
Hennell Hennell is offline
Junior Member
 
Join Date: Nov 2007
Posts: 14
Lightbulb

Ah, thanks agraham, the help file, your last comment and some trial and error seem to have got it all working now. Suddenly it all seems quite obvious.

my code for anyone else with the problem is:

Code:
(In app start)
If ArrayLen(Args()) = 1 Then 'Will catch if a single argument is given. (Like a file name)
	file = args(0)
	If SubString(file,StrLength(file) - 3, 3) <> "jgf" Then 'Checks the file extension to see if its the right type. 
		Msgbox(File & " is not a valid file","Error")
		Return
	End If
	opendialog1.File = file
	LoadFile
Which seems to work fine.

EDIT: First version only worked when given an argument to check. . New code checks if the argument is there...

Last edited by Hennell : 03-11-2008 at 09:58 AM. Reason: code bug :) + add comment.
Reply With Quote