summaryrefslogtreecommitdiffstats
path: root/Mac/Lib/test
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1996-09-19 10:49:53 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1996-09-19 10:49:53 (GMT)
commit35bfd3f9d7fb85db454f29c90eade210adfa392c (patch)
tree5f0b2148627ed05b5d26032127483f26563e3e4e /Mac/Lib/test
parent6244867e56df54c38ab92cfa47d6b6bf62bab8d5 (diff)
downloadcpython-35bfd3f9d7fb85db454f29c90eade210adfa392c.zip
cpython-35bfd3f9d7fb85db454f29c90eade210adfa392c.tar.gz
cpython-35bfd3f9d7fb85db454f29c90eade210adfa392c.tar.bz2
Created Finder 7.0 AE interface and a test program that uses the
finder to launch an application.
Diffstat (limited to 'Mac/Lib/test')
-rw-r--r--Mac/Lib/test/testfinderopen.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/Mac/Lib/test/testfinderopen.py b/Mac/Lib/test/testfinderopen.py
new file mode 100644
index 0000000..8ecf424
--- /dev/null
+++ b/Mac/Lib/test/testfinderopen.py
@@ -0,0 +1,33 @@
+"""Make the finder open an application, file or folder"""
+
+import Finder_7_0_Suite
+import aetools
+import MacOS
+import sys
+import macfs
+
+SIGNATURE='MACS'
+
+class Finder(aetools.TalkTo, Finder_7_0_Suite.Finder_7_0_Suite):
+ pass
+
+def open_in_finder(file):
+ """Open a file thru the finder. Specify file by name or fsspec"""
+ finder = Finder(SIGNATURE)
+ fss = macfs.FSSpec(file)
+ vRefNum, parID, name = fss.as_tuple()
+ dir_fss = macfs.FSSpec((vRefNum, parID, ''))
+ file_alias = fss.NewAlias()
+ dir_alias = dir_fss.NewAlias()
+ return finder.open(file_alias, items=[file_alias])
+
+def main():
+ fss, ok = macfs.PromptGetFile('File to launch:')
+ if not ok: sys.exit(0)
+ result = open_in_finder(fss)
+ if result:
+ print 'Result: ', result
+
+if __name__ == '__main__':
+ main()
+