blob: 5713a95e9c8c5cab75040ee686a9dbde4ce7ce7b [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 Jansenda53c521995-10-10 14:43:20 +000018\var{dst} must be a pathname and the folders leading to the
Guido van Rossum7e42cab1996-10-15 14:37:31 +000019destination are created if necessary. The method copies data and
20resource 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.
23
24If the source is an alias the original to which the alias points is
25copied, not the aliasfile.
Jack Jansenda53c521995-10-10 14:43:20 +000026\end{funcdesc}
27
Fred Drakecce10901998-03-17 06:33:25 +000028\begin{funcdesc}{copytree}{src, dst}
Jack Jansenda53c521995-10-10 14:43:20 +000029Recursively copy a file tree from \var{src} to \var{dst}, creating
Fred Drake61885921998-04-03 07:16:46 +000030folders as needed. \var{src} and \var{dst} should be specified as
Jack Jansenda53c521995-10-10 14:43:20 +000031pathnames.
32\end{funcdesc}
33
Fred Drakecce10901998-03-17 06:33:25 +000034\begin{funcdesc}{mkalias}{src, dst}
Jack Jansenda53c521995-10-10 14:43:20 +000035Create a finder alias \var{dst} pointing to \var{src}. Both may be
Fred Drake61885921998-04-03 07:16:46 +000036specified as pathnames or \pytype{FSSpec} objects.
Jack Jansenda53c521995-10-10 14:43:20 +000037\end{funcdesc}
38
Guido van Rossum7e42cab1996-10-15 14:37:31 +000039\begin{funcdesc}{touched}{dst}
40Tell the finder that some bits of finder-information such as creator
41or type for file \var{dst} has changed. The file can be specified by
Fred Drake8f6ca152000-10-14 04:59:12 +000042pathname or fsspec. This call should tell the finder to redraw the
Guido van Rossum7e42cab1996-10-15 14:37:31 +000043files icon.
44\end{funcdesc}
45
Jack Jansenda53c521995-10-10 14:43:20 +000046\begin{datadesc}{BUFSIZ}
47The buffer size for \code{copy}, default 1 megabyte.
48\end{datadesc}
49
50Note that the process of creating finder aliases is not specified in
Fred Drake61885921998-04-03 07:16:46 +000051the Apple documentation. Hence, aliases created with \function{mkalias()}
Jack Jansenda53c521995-10-10 14:43:20 +000052could conceivably have incompatible behaviour in some cases.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000053
Fred Drakefe7f3bc1998-07-23 17:55:31 +000054
Fred Drakef6863c11999-03-02 16:37:17 +000055\section{\module{findertools} ---
56 The \program{finder}'s Apple Events interface}
57
58\declaremodule{standard}{findertools}
59 \platform{Mac}
Fred Drakefe7f3bc1998-07-23 17:55:31 +000060\modulesynopsis{Wrappers around the \program{finder}'s Apple Events interface.}
61
Guido van Rossum7e42cab1996-10-15 14:37:31 +000062
63This module contains routines that give Python programs access to some
64functionality provided by the finder. They are implemented as wrappers
Fred Drake61885921998-04-03 07:16:46 +000065around the AppleEvent\index{AppleEvents} interface to the finder.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000066
67All file and folder parameters can be specified either as full
Fred Drake61885921998-04-03 07:16:46 +000068pathnames or as \pytype{FSSpec} objects.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000069
Fred Drake61885921998-04-03 07:16:46 +000070The \module{findertools} module defines the following functions:
Guido van Rossum7e42cab1996-10-15 14:37:31 +000071
Guido van Rossum7e42cab1996-10-15 14:37:31 +000072
73\begin{funcdesc}{launch}{file}
74Tell the finder to launch \var{file}. What launching means depends on the file:
75applications are started, folders are opened and documents are opened
76in the correct application.
77\end{funcdesc}
78
79\begin{funcdesc}{Print}{file}
80Tell the finder to print a file (again specified by full pathname or
Fred Drake61885921998-04-03 07:16:46 +000081\pytype{FSSpec}). The behaviour is identical to selecting the file and using
Fred Drake8f6ca152000-10-14 04:59:12 +000082the print command in the finder's file menu.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000083\end{funcdesc}
84
85\begin{funcdesc}{copy}{file, destdir}
86Tell the finder to copy a file or folder \var{file} to folder
Fred Drake61885921998-04-03 07:16:46 +000087\var{destdir}. The function returns an \pytype{Alias} object pointing to
Guido van Rossum7e42cab1996-10-15 14:37:31 +000088the new file.
89\end{funcdesc}
90
91\begin{funcdesc}{move}{file, destdir}
92Tell the finder to move a file or folder \var{file} to folder
Fred Drake61885921998-04-03 07:16:46 +000093\var{destdir}. The function returns an \pytype{Alias} object pointing to
Guido van Rossum7e42cab1996-10-15 14:37:31 +000094the new file.
95\end{funcdesc}
96
97\begin{funcdesc}{sleep}{}
Fred Drake61885921998-04-03 07:16:46 +000098Tell the finder to put the Macintosh to sleep, if your machine
99supports it.
Guido van Rossum7e42cab1996-10-15 14:37:31 +0000100\end{funcdesc}
101
102\begin{funcdesc}{restart}{}
103Tell the finder to perform an orderly restart of the machine.
104\end{funcdesc}
105
106\begin{funcdesc}{shutdown}{}
107Tell the finder to perform an orderly shutdown of the machine.
108\end{funcdesc}