summaryrefslogtreecommitdiffstats
path: root/Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html')
-rw-r--r--Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html51
1 files changed, 51 insertions, 0 deletions
diff --git a/Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html b/Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html
new file mode 100644
index 0000000..9d2fe0e
--- /dev/null
+++ b/Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+ <title>Controlling other Applications from MacPython</title>
+ <meta name="generator" content="BBEdit 6.5.3">
+ <link rel="SHORTCUT ICON" href="pythonsmall.gif">
+ <META NAME="AppleIcon" CONTENT="pythonsmall.gif">
+</head>
+<body>
+<h1>Controlling other Applications from MacPython</h1>
+
+<p>Python has a fairly complete implementation of the Open Scripting
+Architecure (OSA, also commonly referred to as AppleScript), allowing
+you to control scriptable applications from your Python program,
+and with a fairly pythonic interface. The following pieces of
+AppleScript and Python are rougly identical (XXXX Not true right now!):</p>
+
+<blockquote><tt><pre>
+tell application "Finder"
+ get name of window 1
+end tell
+</pre></tt></blockquote>
+
+<blockquote><tt><pre>
+import Finder
+
+f = Finder.Finder()
+print f.get(Finder.window(1).name)
+</pre></tt></blockquote>
+
+<p>To send AppleEvents to an application you must first create the Python
+modules interfacing to the terminology of the application (what
+<tt>Script Editor</tt> calls the "Dictionary"). Use the IDE menu command
+<tt>File->Generate OSA Suite...</tt> for this. For more control run</p>
+
+<blockquote><tt>
+pythonw .../Lib/plat-mac/gensuitemodule.py --help
+</tt></blockquote>
+
+<p>from a terminal window.</p>
+
+<h2>Creating a scriptable application in Python</h2>
+
+You can also create a scriptable application in Python, but this is not
+very well documented. For Carbon
+applications you should look at the <tt>MiniAEFrame</tt> module.
+
+</body>
+</html>