blob: 06ddbc7a5412bda8c7eac08ec52018f34a319b64 [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
11pathnames, \class{FSRef} or \class{FSSpec} objects.
Jack Jansenda53c521995-10-10 14:43:20 +000012
Fred Drake61885921998-04-03 07:16:46 +000013The \module{macostools} module defines the following functions:
Jack Jansenda53c521995-10-10 14:43:20 +000014
Jack Jansenda53c521995-10-10 14:43:20 +000015
Fred Drake61885921998-04-03 07:16:46 +000016\begin{funcdesc}{copy}{src, dst\optional{, createpath\optional{, copytimes}}}
Jack Jansen7aeba452003-02-12 09:58:33 +000017Copy file \var{src} to \var{dst}. 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 Jansen7aeba452003-02-12 09:58:33 +000032Create a finder alias \var{dst} pointing to \var{src}.
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
Fred Drake8f6ca152000-10-14 04:59:12 +000038pathname or fsspec. This call should tell the finder to redraw the
Guido van Rossum7e42cab1996-10-15 14:37:31 +000039files 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 Drakefe7f3bc1998-07-23 17:55:31 +000050
Fred Drakef6863c11999-03-02 16:37:17 +000051\section{\module{findertools} ---
52 The \program{finder}'s Apple Events interface}
53
54\declaremodule{standard}{findertools}
55 \platform{Mac}
Fred Drakefe7f3bc1998-07-23 17:55:31 +000056\modulesynopsis{Wrappers around the \program{finder}'s Apple Events interface.}
57
Guido van Rossum7e42cab1996-10-15 14:37:31 +000058
59This module contains routines that give Python programs access to some
60functionality provided by the finder. They are implemented as wrappers
Fred Drake61885921998-04-03 07:16:46 +000061around the AppleEvent\index{AppleEvents} interface to the finder.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000062
63All file and folder parameters can be specified either as full
Jack Jansen7aeba452003-02-12 09:58:33 +000064pathnames, or as \class{FSRef} or \class{FSSpec} objects.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000065
Fred Drake61885921998-04-03 07:16:46 +000066The \module{findertools} module defines the following functions:
Guido van Rossum7e42cab1996-10-15 14:37:31 +000067
Guido van Rossum7e42cab1996-10-15 14:37:31 +000068
69\begin{funcdesc}{launch}{file}
70Tell the finder to launch \var{file}. What launching means depends on the file:
71applications are started, folders are opened and documents are opened
72in the correct application.
73\end{funcdesc}
74
75\begin{funcdesc}{Print}{file}
Jack Jansen7aeba452003-02-12 09:58:33 +000076Tell the finder to print a file. The behaviour is identical to selecting the file and using
Fred Drake8f6ca152000-10-14 04:59:12 +000077the print command in the finder's file menu.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000078\end{funcdesc}
79
80\begin{funcdesc}{copy}{file, destdir}
81Tell the finder to copy a file or folder \var{file} to folder
Jack Jansen7aeba452003-02-12 09:58:33 +000082\var{destdir}. The function returns an \class{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
Jack Jansen7aeba452003-02-12 09:58:33 +000088\var{destdir}. The function returns an \class{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}