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 | |
Fred Drake | cce1090 | 1998-03-17 06:33:25 +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 | |
Fred Drake | cce1090 | 1998-03-17 06:33:25 +0000 | [diff] [blame] | 25 | \begin{funcdesc}{copytree}{src, dst} |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 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 | |
Fred Drake | cce1090 | 1998-03-17 06:33:25 +0000 | [diff] [blame] | 31 | \begin{funcdesc}{mkalias}{src, dst} |
Jack Jansen | da53c52 | 1995-10-10 14:43:20 +0000 | [diff] [blame] | 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}} |
Fred Drake | cea0e73 | 1998-02-19 19:40:17 +0000 | [diff] [blame] | 52 | \label{module-findertools} |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 53 | \stmodindex{findertools} |
| 54 | |
| 55 | This module contains routines that give Python programs access to some |
| 56 | functionality provided by the finder. They are implemented as wrappers |
| 57 | around the AppleEvent interface to the finder. |
| 58 | |
| 59 | All file and folder parameters can be specified either as full |
| 60 | pathnames or as \code{FSSpec} objects. |
| 61 | |
| 62 | The \code{findertools} module defines the following functions: |
| 63 | |
Fred Drake | 1947991 | 1998-02-13 06:58:54 +0000 | [diff] [blame] | 64 | \setindexsubitem{(in module macostools)} |
Guido van Rossum | 7e42cab | 1996-10-15 14:37:31 +0000 | [diff] [blame] | 65 | |
| 66 | \begin{funcdesc}{launch}{file} |
| 67 | Tell the finder to launch \var{file}. What launching means depends on the file: |
| 68 | applications are started, folders are opened and documents are opened |
| 69 | in the correct application. |
| 70 | \end{funcdesc} |
| 71 | |
| 72 | \begin{funcdesc}{Print}{file} |
| 73 | Tell the finder to print a file (again specified by full pathname or |
| 74 | FSSpec). The behaviour is identical to selecting the file and using |
| 75 | the print command in the finder. |
| 76 | \end{funcdesc} |
| 77 | |
| 78 | \begin{funcdesc}{copy}{file, destdir} |
| 79 | Tell the finder to copy a file or folder \var{file} to folder |
| 80 | \var{destdir}. The function returns an \code{Alias} object pointing to |
| 81 | the new file. |
| 82 | \end{funcdesc} |
| 83 | |
| 84 | \begin{funcdesc}{move}{file, destdir} |
| 85 | Tell the finder to move a file or folder \var{file} to folder |
| 86 | \var{destdir}. The function returns an \code{Alias} object pointing to |
| 87 | the new file. |
| 88 | \end{funcdesc} |
| 89 | |
| 90 | \begin{funcdesc}{sleep}{} |
| 91 | Tell the finder to put the mac to sleep, if your machine supports it. |
| 92 | \end{funcdesc} |
| 93 | |
| 94 | \begin{funcdesc}{restart}{} |
| 95 | Tell the finder to perform an orderly restart of the machine. |
| 96 | \end{funcdesc} |
| 97 | |
| 98 | \begin{funcdesc}{shutdown}{} |
| 99 | Tell the finder to perform an orderly shutdown of the machine. |
| 100 | \end{funcdesc} |