1 \section{\module{macostools
} ---
2 Convenience routines for file manipulation
}
4 \declaremodule{standard
}{macostools
}
6 \modulesynopsis{Convenience routines for file manipulation.
}
9 This module contains some convenience routines for file-manipulation
12 The
\module{macostools
} module defines the following functions:
15 \begin{funcdesc
}{copy
}{src, dst
\optional{, createpath
\optional{, copytimes
}}}
16 Copy file
\var{src
} to
\var{dst
}. The files can be specified as
17 pathnames or
\pytype{FSSpec
} objects. If
\var{createpath
} is non-zero
18 \var{dst
} must be a pathname and the folders leading to the
19 destination are created if necessary. The method copies data and
20 resource fork and some finder information (creator, type, flags) and
21 optionally the creation, modification and backup times (default is to
22 copy them). Custom icons, comments and icon position are not copied.
24 If the source is an alias the original to which the alias points is
25 copied, not the aliasfile.
28 \begin{funcdesc
}{copytree
}{src, dst
}
29 Recursively copy a file tree from
\var{src
} to
\var{dst
}, creating
30 folders as needed.
\var{src
} and
\var{dst
} should be specified as
34 \begin{funcdesc
}{mkalias
}{src, dst
}
35 Create a finder alias
\var{dst
} pointing to
\var{src
}. Both may be
36 specified as pathnames or
\pytype{FSSpec
} objects.
39 \begin{funcdesc
}{touched
}{dst
}
40 Tell the finder that some bits of finder-information such as creator
41 or type for file
\var{dst
} has changed. The file can be specified by
42 pathname or fsspec. This call should tell the finder to redraw the
46 \begin{datadesc
}{BUFSIZ
}
47 The buffer size for
\code{copy
}, default
1 megabyte.
50 Note that the process of creating finder aliases is not specified in
51 the Apple documentation. Hence, aliases created with
\function{mkalias()
}
52 could conceivably have incompatible behaviour in some cases.
55 \section{\module{findertools
} ---
56 The
\program{finder
}'s Apple Events interface
}
58 \declaremodule{standard
}{findertools
}
60 \modulesynopsis{Wrappers around the
\program{finder
}'s Apple Events interface.
}
63 This module contains routines that give Python programs access to some
64 functionality provided by the finder. They are implemented as wrappers
65 around the AppleEvent
\index{AppleEvents
} interface to the finder.
67 All file and folder parameters can be specified either as full
68 pathnames or as
\pytype{FSSpec
} objects.
70 The
\module{findertools
} module defines the following functions:
73 \begin{funcdesc
}{launch
}{file
}
74 Tell the finder to launch
\var{file
}. What launching means depends on the file:
75 applications are started, folders are opened and documents are opened
76 in the correct application.
79 \begin{funcdesc
}{Print
}{file
}
80 Tell the finder to print a file (again specified by full pathname or
81 \pytype{FSSpec
}). The behaviour is identical to selecting the file and using
82 the print command in the finder's file menu.
85 \begin{funcdesc
}{copy
}{file, destdir
}
86 Tell the finder to copy a file or folder
\var{file
} to folder
87 \var{destdir
}. The function returns an
\pytype{Alias
} object pointing to
91 \begin{funcdesc
}{move
}{file, destdir
}
92 Tell the finder to move a file or folder
\var{file
} to folder
93 \var{destdir
}. The function returns an
\pytype{Alias
} object pointing to
97 \begin{funcdesc
}{sleep
}{}
98 Tell the finder to put the Macintosh to sleep, if your machine
102 \begin{funcdesc
}{restart
}{}
103 Tell the finder to perform an orderly restart of the machine.
106 \begin{funcdesc
}{shutdown
}{}
107 Tell the finder to perform an orderly shutdown of the machine.