blob: 3a3c3a3e521b093bdfbff5a9217008068ca1c0d4 [file] [log] [blame]
Jack Jansenda53c521995-10-10 14:43:20 +00001
2\section{Standard module \sectcode{macostools}}
3\stmodindex{macostools}
4
5This module contains some convenience routines for file-manipulation
6on the Macintosh.
7
8The \code{macostools} module defines the following functions:
9
10\renewcommand{\indexsubitem}{(in module macostools)}
11
Guido van Rossum7e42cab1996-10-15 14:37:31 +000012\begin{funcdesc}{copy}{src\, dst\optional{\, createpath, copytimes}}
Jack Jansenda53c521995-10-10 14:43:20 +000013Copy file \var{src} to \var{dst}. The files can be specified as
14pathnames or \code{FSSpec} objects. If \var{createpath} is non-zero
15\var{dst} must be a pathname and the folders leading to the
Guido van Rossum7e42cab1996-10-15 14:37:31 +000016destination are created if necessary. The method copies data and
17resource fork and some finder information (creator, type, flags) and
18optionally the creation, modification and backup times (default is to
19copy them). Custom icons, comments and icon position are not copied.
20
21If the source is an alias the original to which the alias points is
22copied, not the aliasfile.
Jack Jansenda53c521995-10-10 14:43:20 +000023\end{funcdesc}
24
25\begin{funcdesc}{copytree}{src\, dst}
26Recursively copy a file tree from \var{src} to \var{dst}, creating
27folders as needed. \var{Src} and \var{dst} should be specified as
28pathnames.
29\end{funcdesc}
30
31\begin{funcdesc}{mkalias}{src\, dst}
32Create a finder alias \var{dst} pointing to \var{src}. Both may be
33specified as pathnames or \var{FSSpec} objects.
34\end{funcdesc}
35
Guido van Rossum7e42cab1996-10-15 14:37:31 +000036\begin{funcdesc}{touched}{dst}
37Tell the finder that some bits of finder-information such as creator
38or type for file \var{dst} has changed. The file can be specified by
39pathname or fsspec. This call should prod the finder into redrawing the
40files icon.
41\end{funcdesc}
42
Jack Jansenda53c521995-10-10 14:43:20 +000043\begin{datadesc}{BUFSIZ}
44The buffer size for \code{copy}, default 1 megabyte.
45\end{datadesc}
46
47Note that the process of creating finder aliases is not specified in
48the Apple documentation. Hence, aliases created with \code{mkalias}
49could conceivably have incompatible behaviour in some cases.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000050
51\section{Standard module \sectcode{findertools}}
52\stmodindex{findertools}
53
54This module contains routines that give Python programs access to some
55functionality provided by the finder. They are implemented as wrappers
56around the AppleEvent interface to the finder.
57
58All file and folder parameters can be specified either as full
59pathnames or as \code{FSSpec} objects.
60
61The \code{findertools} module defines the following functions:
62
63\renewcommand{\indexsubitem}{(in module macostools)}
64
65\begin{funcdesc}{launch}{file}
66Tell the finder to launch \var{file}. What launching means depends on the file:
67applications are started, folders are opened and documents are opened
68in the correct application.
69\end{funcdesc}
70
71\begin{funcdesc}{Print}{file}
72Tell the finder to print a file (again specified by full pathname or
73FSSpec). The behaviour is identical to selecting the file and using
74the print command in the finder.
75\end{funcdesc}
76
77\begin{funcdesc}{copy}{file, destdir}
78Tell the finder to copy a file or folder \var{file} to folder
79\var{destdir}. The function returns an \code{Alias} object pointing to
80the new file.
81\end{funcdesc}
82
83\begin{funcdesc}{move}{file, destdir}
84Tell the finder to move a file or folder \var{file} to folder
85\var{destdir}. The function returns an \code{Alias} object pointing to
86the new file.
87\end{funcdesc}
88
89\begin{funcdesc}{sleep}{}
90Tell the finder to put the mac to sleep, if your machine supports it.
91\end{funcdesc}
92
93\begin{funcdesc}{restart}{}
94Tell the finder to perform an orderly restart of the machine.
95\end{funcdesc}
96
97\begin{funcdesc}{shutdown}{}
98Tell the finder to perform an orderly shutdown of the machine.
99\end{funcdesc}