blob: 78b706d5850245940e5dee79ce70f55251da2acb [file] [log] [blame]
Fred Drakec817e271998-08-10 18:40:22 +00001\section{\module{macostools} ---
Fred Drakef6863c11999-03-02 16:37:17 +00002 Convenience routines for file manipulation}
Fred Drakefe7f3bc1998-07-23 17:55:31 +00003
Fred Drakef6863c11999-03-02 16:37:17 +00004\declaremodule{standard}{macostools}
5 \platform{Mac}
Fred Drakefe7f3bc1998-07-23 17:55:31 +00006\modulesynopsis{Convenience routines for file manipulation.}
7
Jack Jansenda53c521995-10-10 14:43:20 +00008
9This module contains some convenience routines for file-manipulation
10on the Macintosh.
11
Fred Drake61885921998-04-03 07:16:46 +000012The \module{macostools} module defines the following functions:
Jack Jansenda53c521995-10-10 14:43:20 +000013
Jack Jansenda53c521995-10-10 14:43:20 +000014
Fred Drake61885921998-04-03 07:16:46 +000015\begin{funcdesc}{copy}{src, dst\optional{, createpath\optional{, copytimes}}}
Jack Jansenda53c521995-10-10 14:43:20 +000016Copy file \var{src} to \var{dst}. The files can be specified as
Fred Drake61885921998-04-03 07:16:46 +000017pathnames or \pytype{FSSpec} objects. If \var{createpath} is non-zero
Jack Jansen4104b502002-08-06 22:14:23 +000018the folders leading to \var{dst} are created if necessary.
19The method copies data and
Guido van Rossum7e42cab1996-10-15 14:37:31 +000020resource fork and some finder information (creator, type, flags) and
21optionally the creation, modification and backup times (default is to
22copy them). Custom icons, comments and icon position are not copied.
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
Fred Drake61885921998-04-03 07:16:46 +000027folders as needed. \var{src} and \var{dst} should be specified as
Jack Jansenda53c521995-10-10 14:43:20 +000028pathnames.
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
Fred Drake61885921998-04-03 07:16:46 +000033specified as pathnames or \pytype{FSSpec} objects.
Jack Jansenda53c521995-10-10 14:43:20 +000034\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
Fred Drake8f6ca152000-10-14 04:59:12 +000039pathname or fsspec. This call should tell the finder to redraw the
Guido van Rossum7e42cab1996-10-15 14:37:31 +000040files 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
Fred Drake61885921998-04-03 07:16:46 +000048the Apple documentation. Hence, aliases created with \function{mkalias()}
Jack Jansenda53c521995-10-10 14:43:20 +000049could conceivably have incompatible behaviour in some cases.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000050
Fred Drakefe7f3bc1998-07-23 17:55:31 +000051
Fred Drakef6863c11999-03-02 16:37:17 +000052\section{\module{findertools} ---
53 The \program{finder}'s Apple Events interface}
54
55\declaremodule{standard}{findertools}
56 \platform{Mac}
Fred Drakefe7f3bc1998-07-23 17:55:31 +000057\modulesynopsis{Wrappers around the \program{finder}'s Apple Events interface.}
58
Guido van Rossum7e42cab1996-10-15 14:37:31 +000059
60This module contains routines that give Python programs access to some
61functionality provided by the finder. They are implemented as wrappers
Fred Drake61885921998-04-03 07:16:46 +000062around the AppleEvent\index{AppleEvents} interface to the finder.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000063
64All file and folder parameters can be specified either as full
Fred Drake61885921998-04-03 07:16:46 +000065pathnames or as \pytype{FSSpec} objects.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000066
Fred Drake61885921998-04-03 07:16:46 +000067The \module{findertools} module defines the following functions:
Guido van Rossum7e42cab1996-10-15 14:37:31 +000068
Guido van Rossum7e42cab1996-10-15 14:37:31 +000069
70\begin{funcdesc}{launch}{file}
71Tell the finder to launch \var{file}. What launching means depends on the file:
72applications are started, folders are opened and documents are opened
73in the correct application.
74\end{funcdesc}
75
76\begin{funcdesc}{Print}{file}
77Tell the finder to print a file (again specified by full pathname or
Fred Drake61885921998-04-03 07:16:46 +000078\pytype{FSSpec}). The behaviour is identical to selecting the file and using
Fred Drake8f6ca152000-10-14 04:59:12 +000079the print command in the finder's file menu.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000080\end{funcdesc}
81
82\begin{funcdesc}{copy}{file, destdir}
83Tell the finder to copy 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}{move}{file, destdir}
89Tell the finder to move a file or folder \var{file} to folder
Fred Drake61885921998-04-03 07:16:46 +000090\var{destdir}. The function returns an \pytype{Alias} object pointing to
Guido van Rossum7e42cab1996-10-15 14:37:31 +000091the new file.
92\end{funcdesc}
93
94\begin{funcdesc}{sleep}{}
Fred Drake61885921998-04-03 07:16:46 +000095Tell the finder to put the Macintosh to sleep, if your machine
96supports it.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000097\end{funcdesc}
98
99\begin{funcdesc}{restart}{}
100Tell the finder to perform an orderly restart of the machine.
101\end{funcdesc}
102
103\begin{funcdesc}{shutdown}{}
104Tell the finder to perform an orderly shutdown of the machine.
105\end{funcdesc}