blob: 4930d7039123d305519bca831a4e482756e7c09e [file] [log] [blame]
Fred Drake3a0351c1998-04-04 07:23:21 +00001\section{Standard Module \module{macostools}}
Fred Drakefe7f3bc1998-07-23 17:55:31 +00002\declaremodule{standard}{macostools}
3
4\modulesynopsis{Convenience routines for file manipulation.}
5
Jack Jansenda53c521995-10-10 14:43:20 +00006
7This module contains some convenience routines for file-manipulation
8on the Macintosh.
9
Fred Drake61885921998-04-03 07:16:46 +000010The \module{macostools} module defines the following functions:
Jack Jansenda53c521995-10-10 14:43:20 +000011
Jack Jansenda53c521995-10-10 14:43:20 +000012
Fred Drake61885921998-04-03 07:16:46 +000013\begin{funcdesc}{copy}{src, dst\optional{, createpath\optional{, copytimes}}}
Jack Jansenda53c521995-10-10 14:43:20 +000014Copy file \var{src} to \var{dst}. The files can be specified as
Fred Drake61885921998-04-03 07:16:46 +000015pathnames or \pytype{FSSpec} objects. If \var{createpath} is non-zero
Jack Jansenda53c521995-10-10 14:43:20 +000016\var{dst} must be a pathname and the folders leading to the
Guido van Rossum7e42cab1996-10-15 14:37:31 +000017destination are created if necessary. The method copies data and
18resource fork and some finder information (creator, type, flags) and
19optionally the creation, modification and backup times (default is to
20copy them). Custom icons, comments and icon position are not copied.
21
22If the source is an alias the original to which the alias points is
23copied, not the aliasfile.
Jack Jansenda53c521995-10-10 14:43:20 +000024\end{funcdesc}
25
Fred Drakecce10901998-03-17 06:33:25 +000026\begin{funcdesc}{copytree}{src, dst}
Jack Jansenda53c521995-10-10 14:43:20 +000027Recursively copy a file tree from \var{src} to \var{dst}, creating
Fred Drake61885921998-04-03 07:16:46 +000028folders as needed. \var{src} and \var{dst} should be specified as
Jack Jansenda53c521995-10-10 14:43:20 +000029pathnames.
30\end{funcdesc}
31
Fred Drakecce10901998-03-17 06:33:25 +000032\begin{funcdesc}{mkalias}{src, dst}
Jack Jansenda53c521995-10-10 14:43:20 +000033Create a finder alias \var{dst} pointing to \var{src}. Both may be
Fred Drake61885921998-04-03 07:16:46 +000034specified as pathnames or \pytype{FSSpec} objects.
Jack Jansenda53c521995-10-10 14:43:20 +000035\end{funcdesc}
36
Guido van Rossum7e42cab1996-10-15 14:37:31 +000037\begin{funcdesc}{touched}{dst}
38Tell the finder that some bits of finder-information such as creator
39or type for file \var{dst} has changed. The file can be specified by
40pathname or fsspec. This call should prod the finder into redrawing the
41files icon.
42\end{funcdesc}
43
Jack Jansenda53c521995-10-10 14:43:20 +000044\begin{datadesc}{BUFSIZ}
45The buffer size for \code{copy}, default 1 megabyte.
46\end{datadesc}
47
48Note that the process of creating finder aliases is not specified in
Fred Drake61885921998-04-03 07:16:46 +000049the Apple documentation. Hence, aliases created with \function{mkalias()}
Jack Jansenda53c521995-10-10 14:43:20 +000050could conceivably have incompatible behaviour in some cases.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000051
Fred Drake3a0351c1998-04-04 07:23:21 +000052\section{Standard Module \module{findertools}}
Fred Drakefe7f3bc1998-07-23 17:55:31 +000053\declaremodule{standard}{findertools}
54
55\modulesynopsis{Wrappers around the \program{finder}'s Apple Events interface.}
56
Guido van Rossum7e42cab1996-10-15 14:37:31 +000057
58This module contains routines that give Python programs access to some
59functionality provided by the finder. They are implemented as wrappers
Fred Drake61885921998-04-03 07:16:46 +000060around the AppleEvent\index{AppleEvents} interface to the finder.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000061
62All file and folder parameters can be specified either as full
Fred Drake61885921998-04-03 07:16:46 +000063pathnames or as \pytype{FSSpec} objects.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000064
Fred Drake61885921998-04-03 07:16:46 +000065The \module{findertools} module defines the following functions:
Guido van Rossum7e42cab1996-10-15 14:37:31 +000066
Guido van Rossum7e42cab1996-10-15 14:37:31 +000067
68\begin{funcdesc}{launch}{file}
69Tell the finder to launch \var{file}. What launching means depends on the file:
70applications are started, folders are opened and documents are opened
71in the correct application.
72\end{funcdesc}
73
74\begin{funcdesc}{Print}{file}
75Tell the finder to print a file (again specified by full pathname or
Fred Drake61885921998-04-03 07:16:46 +000076\pytype{FSSpec}). The behaviour is identical to selecting the file and using
Guido van Rossum7e42cab1996-10-15 14:37:31 +000077the print command in the finder.
78\end{funcdesc}
79
80\begin{funcdesc}{copy}{file, destdir}
81Tell the finder to copy a file or folder \var{file} to folder
Fred Drake61885921998-04-03 07:16:46 +000082\var{destdir}. The function returns an \pytype{Alias} object pointing to
Guido van Rossum7e42cab1996-10-15 14:37:31 +000083the new file.
84\end{funcdesc}
85
86\begin{funcdesc}{move}{file, destdir}
87Tell the finder to move a file or folder \var{file} to folder
Fred Drake61885921998-04-03 07:16:46 +000088\var{destdir}. The function returns an \pytype{Alias} object pointing to
Guido van Rossum7e42cab1996-10-15 14:37:31 +000089the new file.
90\end{funcdesc}
91
92\begin{funcdesc}{sleep}{}
Fred Drake61885921998-04-03 07:16:46 +000093Tell the finder to put the Macintosh to sleep, if your machine
94supports it.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000095\end{funcdesc}
96
97\begin{funcdesc}{restart}{}
98Tell the finder to perform an orderly restart of the machine.
99\end{funcdesc}
100
101\begin{funcdesc}{shutdown}{}
102Tell the finder to perform an orderly shutdown of the machine.
103\end{funcdesc}