blob: 84755222774a07e74161c844ccb33890ca58b547 [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
Fred Drake61885921998-04-03 07:16:46 +00008The \module{macostools} module defines the following functions:
Jack Jansenda53c521995-10-10 14:43:20 +00009
Jack Jansenda53c521995-10-10 14:43:20 +000010
Fred Drake61885921998-04-03 07:16:46 +000011\begin{funcdesc}{copy}{src, dst\optional{, createpath\optional{, copytimes}}}
Jack Jansenda53c521995-10-10 14:43:20 +000012Copy file \var{src} to \var{dst}. The files can be specified as
Fred Drake61885921998-04-03 07:16:46 +000013pathnames or \pytype{FSSpec} objects. If \var{createpath} is non-zero
Jack Jansenda53c521995-10-10 14:43:20 +000014\var{dst} must be a pathname and the folders leading to the
Guido van Rossum7e42cab1996-10-15 14:37:31 +000015destination are created if necessary. The method copies data and
16resource fork and some finder information (creator, type, flags) and
17optionally the creation, modification and backup times (default is to
18copy them). Custom icons, comments and icon position are not copied.
19
20If the source is an alias the original to which the alias points is
21copied, not the aliasfile.
Jack Jansenda53c521995-10-10 14:43:20 +000022\end{funcdesc}
23
Fred Drakecce10901998-03-17 06:33:25 +000024\begin{funcdesc}{copytree}{src, dst}
Jack Jansenda53c521995-10-10 14:43:20 +000025Recursively copy a file tree from \var{src} to \var{dst}, creating
Fred Drake61885921998-04-03 07:16:46 +000026folders as needed. \var{src} and \var{dst} should be specified as
Jack Jansenda53c521995-10-10 14:43:20 +000027pathnames.
28\end{funcdesc}
29
Fred Drakecce10901998-03-17 06:33:25 +000030\begin{funcdesc}{mkalias}{src, dst}
Jack Jansenda53c521995-10-10 14:43:20 +000031Create a finder alias \var{dst} pointing to \var{src}. Both may be
Fred Drake61885921998-04-03 07:16:46 +000032specified as pathnames or \pytype{FSSpec} objects.
Jack Jansenda53c521995-10-10 14:43:20 +000033\end{funcdesc}
34
Guido van Rossum7e42cab1996-10-15 14:37:31 +000035\begin{funcdesc}{touched}{dst}
36Tell the finder that some bits of finder-information such as creator
37or type for file \var{dst} has changed. The file can be specified by
38pathname or fsspec. This call should prod the finder into redrawing the
39files icon.
40\end{funcdesc}
41
Jack Jansenda53c521995-10-10 14:43:20 +000042\begin{datadesc}{BUFSIZ}
43The buffer size for \code{copy}, default 1 megabyte.
44\end{datadesc}
45
46Note that the process of creating finder aliases is not specified in
Fred Drake61885921998-04-03 07:16:46 +000047the Apple documentation. Hence, aliases created with \function{mkalias()}
Jack Jansenda53c521995-10-10 14:43:20 +000048could conceivably have incompatible behaviour in some cases.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000049
Fred Drake36499b81997-12-17 14:01:31 +000050\section{Standard Module \sectcode{findertools}}
Fred Drakecea0e731998-02-19 19:40:17 +000051\label{module-findertools}
Guido van Rossum7e42cab1996-10-15 14:37:31 +000052\stmodindex{findertools}
53
54This module contains routines that give Python programs access to some
55functionality provided by the finder. They are implemented as wrappers
Fred Drake61885921998-04-03 07:16:46 +000056around the AppleEvent\index{AppleEvents} interface to the finder.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000057
58All file and folder parameters can be specified either as full
Fred Drake61885921998-04-03 07:16:46 +000059pathnames or as \pytype{FSSpec} objects.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000060
Fred Drake61885921998-04-03 07:16:46 +000061The \module{findertools} module defines the following functions:
Guido van Rossum7e42cab1996-10-15 14:37:31 +000062
Guido van Rossum7e42cab1996-10-15 14:37:31 +000063
64\begin{funcdesc}{launch}{file}
65Tell the finder to launch \var{file}. What launching means depends on the file:
66applications are started, folders are opened and documents are opened
67in the correct application.
68\end{funcdesc}
69
70\begin{funcdesc}{Print}{file}
71Tell the finder to print a file (again specified by full pathname or
Fred Drake61885921998-04-03 07:16:46 +000072\pytype{FSSpec}). The behaviour is identical to selecting the file and using
Guido van Rossum7e42cab1996-10-15 14:37:31 +000073the print command in the finder.
74\end{funcdesc}
75
76\begin{funcdesc}{copy}{file, destdir}
77Tell the finder to copy a file or folder \var{file} to folder
Fred Drake61885921998-04-03 07:16:46 +000078\var{destdir}. The function returns an \pytype{Alias} object pointing to
Guido van Rossum7e42cab1996-10-15 14:37:31 +000079the new file.
80\end{funcdesc}
81
82\begin{funcdesc}{move}{file, destdir}
83Tell the finder to move a file or folder \var{file} to folder
Fred Drake61885921998-04-03 07:16:46 +000084\var{destdir}. The function returns an \pytype{Alias} object pointing to
Guido van Rossum7e42cab1996-10-15 14:37:31 +000085the new file.
86\end{funcdesc}
87
88\begin{funcdesc}{sleep}{}
Fred Drake61885921998-04-03 07:16:46 +000089Tell the finder to put the Macintosh to sleep, if your machine
90supports it.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000091\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}