From Scriptwiki
Jump to: navigation, search

Opens the specified file and assigns a name to it for later reference.

/fopen [-no] <name> <filename>

If the file doesn't exist, the opening fails (if -n switch isn't specified).

Explanation of the switches:

Switch Meaning
n creates the file if it doesn't already exist, fails if the file does exist.
o creates a new file, overwrites if it exists.

Note that if /fopen fails, the script will continue to run. To check whether it failed or not, you have to take a look at $ferr and $feof. It also echos it to the active window: * fopen unable to open '<name>' (<filename>), however, if you want to make it silent, use .fopen.


/fopen version version.txt

This will "open" the file version.txt in your mircdirectory and assings the name "version" to it. If it doesn't exist in your mircdirectory, /fopen will fail (and echo it to the active window).

/fopen -n moo "C:\moo oo.txt"

This will create "moo oo.txt" on C:\ and open it with the name moo. If moo.txt already existed on C:\, it fails.

See Also