1 \section{Standard Module
\module{macostools
}}
2 \label{module-macostools
}
3 \stmodindex{macostools
}
5 This module contains some convenience routines for file-manipulation
8 The
\module{macostools
} module defines the following functions:
11 \begin{funcdesc
}{copy
}{src, dst
\optional{, createpath
\optional{, copytimes
}}}
12 Copy file
\var{src
} to
\var{dst
}. The files can be specified as
13 pathnames or
\pytype{FSSpec
} objects. If
\var{createpath
} is non-zero
14 \var{dst
} must be a pathname and the folders leading to the
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.
20 If the source is an alias the original to which the alias points is
21 copied, not the aliasfile.
24 \begin{funcdesc
}{copytree
}{src, dst
}
25 Recursively copy a file tree from
\var{src
} to
\var{dst
}, creating
26 folders as needed.
\var{src
} and
\var{dst
} should be specified as
30 \begin{funcdesc
}{mkalias
}{src, dst
}
31 Create a finder alias
\var{dst
} pointing to
\var{src
}. Both may be
32 specified as pathnames or
\pytype{FSSpec
} objects.
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
42 \begin{datadesc
}{BUFSIZ
}
43 The buffer size for
\code{copy
}, default
1 megabyte.
46 Note that the process of creating finder aliases is not specified in
47 the Apple documentation. Hence, aliases created with
\function{mkalias()
}
48 could conceivably have incompatible behaviour in some cases.
50 \section{Standard Module
\module{findertools
}}
51 \label{module-findertools
}
52 \stmodindex{findertools
}
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
\index{AppleEvents
} interface to the finder.
58 All file and folder parameters can be specified either as full
59 pathnames or as
\pytype{FSSpec
} objects.
61 The
\module{findertools
} module defines the following functions:
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.
70 \begin{funcdesc
}{Print
}{file
}
71 Tell the finder to print a file (again specified by full pathname or
72 \pytype{FSSpec
}). The behaviour is identical to selecting the file and using
73 the print command in the finder.
76 \begin{funcdesc
}{copy
}{file, destdir
}
77 Tell the finder to copy a file or folder
\var{file
} to folder
78 \var{destdir
}. The function returns an
\pytype{Alias
} object pointing to
82 \begin{funcdesc
}{move
}{file, destdir
}
83 Tell the finder to move a file or folder
\var{file
} to folder
84 \var{destdir
}. The function returns an
\pytype{Alias
} object pointing to
88 \begin{funcdesc
}{sleep
}{}
89 Tell the finder to put the Macintosh to sleep, if your machine
93 \begin{funcdesc
}{restart
}{}
94 Tell the finder to perform an orderly restart of the machine.
97 \begin{funcdesc
}{shutdown
}{}
98 Tell the finder to perform an orderly shutdown of the machine.