blob: 556e46f15e65dd90fc1bd08e58db2981e9fe4f5c [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
Jack Jansen7aeba452003-02-12 09:58:33 +000010on the Macintosh. All file parameters can be specified as
Nicholas Bastincfa157d2004-06-06 01:17:52 +000011pathnames, \class{FSRef} or \class{FSSpec} objects. This module
12expects a filesystem which supports forked files, so it should not
13be used on UFS partitions.
Jack Jansenda53c521995-10-10 14:43:20 +000014
Fred Drake61885921998-04-03 07:16:46 +000015The \module{macostools} module defines the following functions:
Jack Jansenda53c521995-10-10 14:43:20 +000016
Jack Jansenda53c521995-10-10 14:43:20 +000017
Fred Drake61885921998-04-03 07:16:46 +000018\begin{funcdesc}{copy}{src, dst\optional{, createpath\optional{, copytimes}}}
Jack Jansen7aeba452003-02-12 09:58:33 +000019Copy file \var{src} to \var{dst}. If \var{createpath} is non-zero
Jack Jansen4104b502002-08-06 22:14:23 +000020the folders leading to \var{dst} are created if necessary.
21The method copies data and
Guido van Rossum7e42cab1996-10-15 14:37:31 +000022resource fork and some finder information (creator, type, flags) and
23optionally the creation, modification and backup times (default is to
24copy them). Custom icons, comments and icon position are not copied.
Jack Jansenda53c521995-10-10 14:43:20 +000025\end{funcdesc}
26
Fred Drakecce10901998-03-17 06:33:25 +000027\begin{funcdesc}{copytree}{src, dst}
Jack Jansenda53c521995-10-10 14:43:20 +000028Recursively copy a file tree from \var{src} to \var{dst}, creating
Fred Drake61885921998-04-03 07:16:46 +000029folders as needed. \var{src} and \var{dst} should be specified as
Jack Jansenda53c521995-10-10 14:43:20 +000030pathnames.
31\end{funcdesc}
32
Fred Drakecce10901998-03-17 06:33:25 +000033\begin{funcdesc}{mkalias}{src, dst}
Jack Jansen7aeba452003-02-12 09:58:33 +000034Create a finder alias \var{dst} pointing to \var{src}.
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
Fred Drake8f6ca152000-10-14 04:59:12 +000040pathname or fsspec. This call should tell the finder to redraw the
Guido van Rossum7e42cab1996-10-15 14:37:31 +000041files 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 Drakefe7f3bc1998-07-23 17:55:31 +000052
Fred Drakef6863c11999-03-02 16:37:17 +000053\section{\module{findertools} ---
54 The \program{finder}'s Apple Events interface}
55
56\declaremodule{standard}{findertools}
57 \platform{Mac}
Fred Drakefe7f3bc1998-07-23 17:55:31 +000058\modulesynopsis{Wrappers around the \program{finder}'s Apple Events interface.}
59
Guido van Rossum7e42cab1996-10-15 14:37:31 +000060
61This module contains routines that give Python programs access to some
62functionality provided by the finder. They are implemented as wrappers
Fred Drake61885921998-04-03 07:16:46 +000063around the AppleEvent\index{AppleEvents} interface to the finder.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000064
65All file and folder parameters can be specified either as full
Jack Jansen7aeba452003-02-12 09:58:33 +000066pathnames, or as \class{FSRef} or \class{FSSpec} objects.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000067
Fred Drake61885921998-04-03 07:16:46 +000068The \module{findertools} module defines the following functions:
Guido van Rossum7e42cab1996-10-15 14:37:31 +000069
Guido van Rossum7e42cab1996-10-15 14:37:31 +000070
71\begin{funcdesc}{launch}{file}
72Tell the finder to launch \var{file}. What launching means depends on the file:
73applications are started, folders are opened and documents are opened
74in the correct application.
75\end{funcdesc}
76
77\begin{funcdesc}{Print}{file}
Jack Jansen7aeba452003-02-12 09:58:33 +000078Tell the finder to print a file. 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
Jack Jansen7aeba452003-02-12 09:58:33 +000084\var{destdir}. The function returns an \class{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
Jack Jansen7aeba452003-02-12 09:58:33 +000090\var{destdir}. The function returns an \class{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}