blob: c4c5842382fc62327957fc7b4f3a345e822d40ca [file] [log] [blame]
Fred Drake36499b81997-12-17 14:01:31 +00001\section{Standard Module \sectcode{macostools}}
Guido van Rossume47da0a1997-07-17 16:34:52 +00002\label{module-macostools}
Jack Jansenda53c521995-10-10 14:43:20 +00003\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
Fred Drake19479911998-02-13 06:58:54 +000010\setindexsubitem{(in module macostools)}
Jack Jansenda53c521995-10-10 14:43:20 +000011
Fred Drakecce10901998-03-17 06:33:25 +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
Fred Drakecce10901998-03-17 06:33:25 +000025\begin{funcdesc}{copytree}{src, dst}
Jack Jansenda53c521995-10-10 14:43:20 +000026Recursively 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
Fred Drakecce10901998-03-17 06:33:25 +000031\begin{funcdesc}{mkalias}{src, dst}
Jack Jansenda53c521995-10-10 14:43:20 +000032Create 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
Fred Drake36499b81997-12-17 14:01:31 +000051\section{Standard Module \sectcode{findertools}}
Fred Drakecea0e731998-02-19 19:40:17 +000052\label{module-findertools}
Guido van Rossum7e42cab1996-10-15 14:37:31 +000053\stmodindex{findertools}
54
55This module contains routines that give Python programs access to some
56functionality provided by the finder. They are implemented as wrappers
57around the AppleEvent interface to the finder.
58
59All file and folder parameters can be specified either as full
60pathnames or as \code{FSSpec} objects.
61
62The \code{findertools} module defines the following functions:
63
Fred Drake19479911998-02-13 06:58:54 +000064\setindexsubitem{(in module macostools)}
Guido van Rossum7e42cab1996-10-15 14:37:31 +000065
66\begin{funcdesc}{launch}{file}
67Tell the finder to launch \var{file}. What launching means depends on the file:
68applications are started, folders are opened and documents are opened
69in the correct application.
70\end{funcdesc}
71
72\begin{funcdesc}{Print}{file}
73Tell the finder to print a file (again specified by full pathname or
74FSSpec). The behaviour is identical to selecting the file and using
75the print command in the finder.
76\end{funcdesc}
77
78\begin{funcdesc}{copy}{file, destdir}
79Tell the finder to copy a file or folder \var{file} to folder
80\var{destdir}. The function returns an \code{Alias} object pointing to
81the new file.
82\end{funcdesc}
83
84\begin{funcdesc}{move}{file, destdir}
85Tell the finder to move a file or folder \var{file} to folder
86\var{destdir}. The function returns an \code{Alias} object pointing to
87the new file.
88\end{funcdesc}
89
90\begin{funcdesc}{sleep}{}
91Tell the finder to put the mac to sleep, if your machine supports it.
92\end{funcdesc}
93
94\begin{funcdesc}{restart}{}
95Tell the finder to perform an orderly restart of the machine.
96\end{funcdesc}
97
98\begin{funcdesc}{shutdown}{}
99Tell the finder to perform an orderly shutdown of the machine.
100\end{funcdesc}