Opens the specified file and assigns a name to it for later reference
-n switch creates the file if it does not already exist, fails if the file does exist
-o switch creates a new file, overwriting it if it exists
-a switch opens a file if it exists, creates it if it doesn't
alias fopen {
;set up /fopen command to use mIRC's internal command
;also check to see if fopen has been called with a preceeding "." to
;not show it's results
;%fopen looks something like: !.fopen
var %fopen = $+(!,$iif(!$show,.),fopen)
;check to see if any switches have been specified, if so make sure they are valid.
if (-* iswm $1 && !$regex($1,/^(?:n|o|a)$/i)) {
;handle the syntax error how u feel
}
;if the switches are valid, and the switch is -a
elseif ($1 == -a) {
;check to see if the file exists, and if so, open it with /fopen
if ($isfile($3-)) {
%fopen $2-
}
;if the file doesn't exist, open it with "/fopen -n" to create it.
else {
%fopen -n $2-
}
}
;if /fopen was called without any of the improvements we are trying to make, use the sent command as is.
else {
%fopen $1-
}
}