3. MacPython OSA $B%b%8%e!<%k(B

$BK\>O$G$O!"%*!<%W%s%9%/%j%W%F%#%s%0%"!<%-%F%/%A%c(B(Open Scripting Architecure$B!"(BOSA$B!"0lHLE*$K$O(B AppleScript $B$H8F$P$l$k(B)$B$N8=:_$N(B Python $BMQl$9$kM=Dj$G$9!#(B

AppleScript $B$H(B OSA $B$NMM!9$J%3%s%]!<%M%s%H$N5-=R$N$?$a$K!"$^$?!"%"!<%-(B $B%F%/%A%c$*$h$SMQ8l$K$D$$$F$NM}2r$rF@$k$?$a$K!"%"%C%W%k$NJ8=q$rFI$`I,(B $BMW$,$"$j$^$9!#(B"Applescript Language Guide" $B$O35G0$N%b%G%k$*$h$SMQ8l!"(BStandard Suite$B$K$D$$(B $B$F@bL@$7$?J8=q$G$9!#(B"Open Scripting Architecture" $BJ8=q$O!"%"(B $B%W%j%1!<%7%g%s%W%m%0%i%^$N;kE@$+$i(B OSA $B$r;HMQ$9$kJ}K!$K$D$$$F@bL@(B $B$7$F$$$^$9!#$3$l$i$NJ8=q$O(BApple$B%X%k%W%S%e!<%o$N(BDeveloper Documentation $BCf$N(BCore Technologies$B%;%/%7%g%s$K$"$j$^$9!#(B

$B%"%W%j%1!<%7%g%s$r%9%/%j%W%H$GA`:n$9$kNc$H$7$F!"Finder $B%&%#%s%I%&$NL>A0$r

tell application "Finder"
    get name of window 1
end tell

Python$B$G$O0J2<$N%3!<%I$GF1$8;v$,$G$-$^$9!#(B

import Finder

f = Finder.Finder()
print f.get(f.window(1).name)

$BG[I[$5$l$F$$$k(B Python $B%i%$%V%i%j$O!"(BStandard Suite $B$r $B%"%W%j%1!<%7%g%s$K(B AppleEvent $B$rAw$k$?$a$K$O!"%"%W%j%1!<%7%g%s$NMQ8l(B (Script Editor$B$,!V<-=q!W$H8F$V$b$N(B)$B$K@\B3$9$k(B Python $B%Q%C%1!<(B $B%8$r:G=i$K:n@.$7$J$1$l$P$J$j$^$;$s!#$3$l$O!"(BPythonIDE $B$NFbIt(B $B$+$i!"$"$k$$$O!"%3%^%s%I%i%$%s$+$i$N%9%?%s%I%"%m%s$N%W%m%0%i%`$H$7$F(B gensuitemodule.py $B%b%8%e!<%k$r gensuitemodule.py $B%b%8%e!<%k$G@8@.$5$l$k=PNO$OB?$/$N%b%8%e!<%k(B $B$rHw$($?%Q%C%1!<%8$N$?$a!"A4$F$N(B Suite $B$r%W%m%0%i%`$NCf$G(B 1 $B$D$K$^$H$a(B $B$FMxMQ$G$-$k$h$&$K$9$k$?$a$K(B __init__ $B%b%8%e!<%k$,DI2C$5$l$F(B $B$$$^$9!#(BPython $B7Q>5%0%i%U$O(B AppleScript $B7Q>5%0%i%U$rM}2r$9$k$N$G!"(B Standard Suite $B$r%5%]!<%H$7$F$$$F!"M>J,$J0z?t$rHw$($?(B1$B$D$"$k$$$O(B2$B$D$N(B $BJQ?t$r3HD%$9$k;v$,$G$-$k$h$&$K%W%m%0%i%`<-=q$,=q$+$l$F$$$?>l9g!"=PNO$5(B $B$l$?(B Suite $B$O!"(BStdSuites.Standard_Suite $B$+$i$9$Y$F$r%$%s%]!<(B $B%H$7$F:F%(%/%9%]!<%H$7!"$5$i$K3HD%5!G=$r$b$C$?%a%=%C%I$r%*!<%P!<%i%$%I(B $B$9$k%b%8%e!<%k(B Standard_Suite $B$r4^$_$^$9!#(B gensuitemodule $B$N=PNO$O?M4V$KH=FI2DG=$G!"(BPython docstrings$BCf(B $B$K$O%*%j%8%J%k$N(B AppleScript $B<-=q$K$"$C$?J8=q$r4^$s$G$$$^$9!#$7$?$,$C(B $B$F!"$=$l$rFI$`$3$H$OM-MQ$J>pJs8;$H$J$j$^$9!#(B

$B=PNO$5$l$?%Q%C%1!<%8$O!"%a%=%C%I$H$7$F(B AppleScript $BJQ?t$r$9$Y$F4^$_!"(B $BBh(B1$B$N0z?t$H$7$F$ND>@\%*%V%8%'%/%H$r4^$_!"%-!<%o!<%I0z?t$H$7$F$N$9$Y$F(B $B$N%*%W%7%g%s$N0z?t$r4^$`!"%Q%C%1!<%8$HF1$8L>A0$rHw$($?$N$b$m$b$m$NJ*$H$7$F $BJQ?t$rf.window(1).name.get() $B$NBe$j$K(B f.get(f.window(1).name) $B$rMxMQ$9$kI,MW$,$"$j$^$9!#(B

AppleScript $B<1JL;R$,(B Python $B<1JL;R$HF1$8$G$J$$>l9g!"L>A0$O>/?t$N5,B'$K(B $B$h$C$FH=JL$7$^$9!#(B

Python $B$O!"$5$i$K(B Python $B$G%9%/%j%W%HBP1~%"%W%j%1!<%7%g%s$r:n@.$9$k;v(B $B$r%5%]!<%H$7$F$$$^$9!#
gensuitemodule   OSA辞書からスタブパッケージを作成します。
aetools   Apple Eventを送るための基本的なサポート
aepack   Python変数とAppleEventデータコンテナ間の変換
aetypes   Apple Event オブジェクトモデルの Python 表現
MiniAEFrame   オープンスクリプティングアーキテクチャ(OSA)サーバ(``Apple Events'')のサポート。

$B$5$i$K!"(BFinder, Terminal, Explorer, Netscape, CodeWarrior, SystemEvents $B$=$7$F(B StdSuites $B$N%5%]!<%H%b%8%e!<%k$O!"$"$i$+$8$a@8@.$5$l$F$$$^$9!#(B

$B$40U8+$d$4;XE&$r$*4s$;$K$J$j$?$$J}$O!"(B $B$3$N%I%-%e%a%s%H$K$D$$$F(B... $B$r$4Mw$/$@$5$$!#(B