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