Fred Drake | 3a0351c | 1998-04-04 07:23:21 +0000 | [diff] [blame] | 1 | \section{Standard Module \module{macostools}} |
Guido van Rossum | e47da0a | 1997-07-17 16:34:52 +0000 | [diff] [blame] | 2 | \label{module-macostools} |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 3 | \stmodindex{macostools} |
| 4 | |
| 5 | This module contains some convenience routines for file-manipulation |
| 6 | on the Macintosh. |
| 7 | |
Fred Drake | 6188592 | 1998-04-03 07:16:46 +0000 | [diff] [blame] | 8 | The \module{macostools} module defines the following functions: |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 9 | |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 10 | |
Fred Drake | 6188592 | 1998-04-03 07:16:46 +0000 | [diff] [blame] | 11 | \begin{funcdesc}{copy}{src, dst\optional{, createpath\optional{, copytimes}}} |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 12 | Copy file \var{src} to \var{dst}. The files can be specified as |
Fred Drake | 6188592 | 1998-04-03 07:16:46 +0000 | [diff] [blame] | 13 | pathnames or \pytype{FSSpec} objects. If \var{createpath} is non-zero |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 14 | \var{dst} must be a pathname and the folders leading to the |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 15 | destination are created if necessary. The method copies data and |
| 16 | resource fork and some finder information (creator, type, flags) and |
| 17 | optionally the creation, modification and backup times (default is to |
| 18 | copy them). Custom icons, comments and icon position are not copied. |
| 19 | |
| 20 | If the source is an alias the original to which the alias points is |
| 21 | copied, not the aliasfile. |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 22 | \end{funcdesc} |
| 23 | |
Fred Drake | cce1090 | 1998-03-17 06:33:25 +0000 | [diff] [blame] | 24 | \begin{funcdesc}{copytree}{src, dst} |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 25 | Recursively copy a file tree from \var{src} to \var{dst}, creating |
Fred Drake | 6188592 | 1998-04-03 07:16:46 +0000 | [diff] [blame] | 26 | folders as needed. \var{src} and \var{dst} should be specified as |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 27 | pathnames. |
| 28 | \end{funcdesc} |
| 29 | |
Fred Drake | cce1090 | 1998-03-17 06:33:25 +0000 | [diff] [blame] | 30 | \begin{funcdesc}{mkalias}{src, dst} |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 31 | Create a finder alias \var{dst} pointing to \var{src}. Both may be |
Fred Drake | 6188592 | 1998-04-03 07:16:46 +0000 | [diff] [blame] | 32 | specified as pathnames or \pytype{FSSpec} objects. |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 33 | \end{funcdesc} |
| 34 | |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 35 | \begin{funcdesc}{touched}{dst} |
| 36 | Tell the finder that some bits of finder-information such as creator |
| 37 | or type for file \var{dst} has changed. The file can be specified by |
| 38 | pathname or fsspec. This call should prod the finder into redrawing the |
| 39 | files icon. |
| 40 | \end{funcdesc} |
| 41 | |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 42 | \begin{datadesc}{BUFSIZ} |
| 43 | The buffer size for \code{copy}, default 1 megabyte. |
| 44 | \end{datadesc} |
| 45 | |
| 46 | Note that the process of creating finder aliases is not specified in |
Fred Drake | 6188592 | 1998-04-03 07:16:46 +0000 | [diff] [blame] | 47 | the Apple documentation. Hence, aliases created with \function{mkalias()} |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 48 | could conceivably have incompatible behaviour in some cases. |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 49 | |
Fred Drake | 3a0351c | 1998-04-04 07:23:21 +0000 | [diff] [blame] | 50 | \section{Standard Module \module{findertools}} |
Fred Drake | cea0e73 | 1998-02-19 19:40:17 +0000 | [diff] [blame] | 51 | \label{module-findertools} |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 52 | \stmodindex{findertools} |
| 53 | |
| 54 | This module contains routines that give Python programs access to some |
| 55 | functionality provided by the finder. They are implemented as wrappers |
Fred Drake | 6188592 | 1998-04-03 07:16:46 +0000 | [diff] [blame] | 56 | around the AppleEvent\index{AppleEvents} interface to the finder. |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 57 | |
| 58 | All file and folder parameters can be specified either as full |
Fred Drake | 6188592 | 1998-04-03 07:16:46 +0000 | [diff] [blame] | 59 | pathnames or as \pytype{FSSpec} objects. |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 60 | |
Fred Drake | 6188592 | 1998-04-03 07:16:46 +0000 | [diff] [blame] | 61 | The \module{findertools} module defines the following functions: |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 62 | |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 63 | |
| 64 | \begin{funcdesc}{launch}{file} |
| 65 | Tell the finder to launch \var{file}. What launching means depends on the file: |
| 66 | applications are started, folders are opened and documents are opened |
| 67 | in the correct application. |
| 68 | \end{funcdesc} |
| 69 | |
| 70 | \begin{funcdesc}{Print}{file} |
| 71 | Tell the finder to print a file (again specified by full pathname or |
Fred Drake | 6188592 | 1998-04-03 07:16:46 +0000 | [diff] [blame] | 72 | \pytype{FSSpec}). The behaviour is identical to selecting the file and using |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 73 | the print command in the finder. |
| 74 | \end{funcdesc} |
| 75 | |
| 76 | \begin{funcdesc}{copy}{file, destdir} |
| 77 | Tell the finder to copy a file or folder \var{file} to folder |
Fred Drake | 6188592 | 1998-04-03 07:16:46 +0000 | [diff] [blame] | 78 | \var{destdir}. The function returns an \pytype{Alias} object pointing to |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 79 | the new file. |
| 80 | \end{funcdesc} |
| 81 | |
| 82 | \begin{funcdesc}{move}{file, destdir} |
| 83 | Tell the finder to move a file or folder \var{file} to folder |
Fred Drake | 6188592 | 1998-04-03 07:16:46 +0000 | [diff] [blame] | 84 | \var{destdir}. The function returns an \pytype{Alias} object pointing to |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 85 | the new file. |
| 86 | \end{funcdesc} |
| 87 | |
| 88 | \begin{funcdesc}{sleep}{} |
Fred Drake | 6188592 | 1998-04-03 07:16:46 +0000 | [diff] [blame] | 89 | Tell the finder to put the Macintosh to sleep, if your machine |
| 90 | supports it. |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 91 | \end{funcdesc} |
| 92 | |
| 93 | \begin{funcdesc}{restart}{} |
| 94 | Tell the finder to perform an orderly restart of the machine. |
| 95 | \end{funcdesc} |
| 96 | |
| 97 | \begin{funcdesc}{shutdown}{} |
| 98 | Tell the finder to perform an orderly shutdown of the machine. |
| 99 | \end{funcdesc} |