Language Reference
Documentation

Language

Objects
Internet Objects

GetFile Global Function

The function Getfile returns a file object for a file or directory.

See Also: File,TextInputStream,TextOutputStream

GetFile
Syntax: GetFile(Path as string)

This function creates a file object for the file specified in the absolute path. The string in path must be a valid absolute path for the given operating system the script is running. In MacOS X use a Pofix path not a traditional mac path. You may pass an empty string in which case the file object returned points to the directory where the script is running.

Sample Code

dim f as file

//Returns the desktop folder of a user CTK in MacOS X
f = getfile("/Users/ctk/Desktop")

dim f as file,s as sound

//Gets the folder where the script is running
f = getfile("")

//Opens the sound temp.snd in a folder named Sounds
//in the current folder
f = f.child("Sounds").child("temp.snd")

//Opens the sound and plays it
s = f.OpenAsSound
s.play

dim f as file,s as sound

//Opens the sound temp.snd in a folder named Sounds
//in the current folder

f = getfile("").child("Sounds").child("temp.snd")

s = f.OpenAsSound
s.play