tell application "Microsoft Word" set newDoc to make new document end tell このように新しワード文書を作ろうと思ったら、Parallels Desktop 仮想マシン内の Word が起動しようとします。 恐らく VMware Fusion を入れた場合も同じ現象が発生しますが、 当分の方法として、わざと"Microsoft Word 2011" とかに変更すると、アプリを選択する画面が出てきますので、 Word を選択すれば解決できます。 【追記】もっといい方法を見つかりました。 set WordApp to "/Applications/Microsoft Office 2011/Microsoft Word.app" if not application WordApp is running then tell application WordApp activate end tell end if tell application WordApp set newDoc to make new document end tell しっかりパスまで指定します。 【更に追記】 set ExcelApp to "/Applications/Microsoft ...
Category Archive: Applescript
Applescript で XML DOM を挑戦しよう!
以前、仕事の関係で特定健診のXMLファイルからCSVへ変換するC#プログラムを書きました。 直近、研究のため、WHO薬用植物の本から概念を抽出してXMLに書き込んだり、読み取ったりするPHPプログラムも作りました。 最近、AppleScript で 脆弱性検査結果の XML ファイルの処理をしようと考えています。 まずは、情報集めですね。 AppleScript は中級者のものといわれて、あまり本とか情報がないようです。 DOM で XML を取り扱うのは、いくつかのサイトにはありますが、とりあえず フランスの SATIMAGE とういうサイトを中心に参考します。 フランスのサイトですが、幸い英語のページも用意されています。 トップページに、SmileLab と Smile の2つのソフトが紹介されて、データの可視化とワークフローの自動化のツールですが、 Smile のほうが XMLList osax を利用しています。XMLList osax こそ AppleScript での XML DOM の実装であります。 SATIMAGEでは、XMLList の辞書も提供されています。 XMLList のダウンロードは 下記の2つがありますが、なぜか Build 373 のリンクが切れているようです。 XMLLib osax 3.7.0 (build 373) XMLLib osax 3.7.0 (build 370) 余裕があれば、少しずつサンプルなり追加記事をしていきます。 shyunsei.blogspot.jp 関連サイト: XPath -Tutorial
Applescript で PowerPoint に 正弦波を描く〜(残念!できないよう〜)
下記のスクリプトでサブオブジェクトとプロパティをチェックしましたが、自由に曲線を描くものはありませんでした。>< パワーポイントのファイルはこちらの記事のサンプルを読み込みました。
1 2 3 4 5 6 7 8 |
set targetPPT to (choose file with prompt "チェックする Word ファイルを選んでください!" of type {"PPT", "PPTX"} with multiple selections allowed without invisibles) as string tell application "Microsoft PowerPoint" set targetPresent to open targetPPT set CNT to the number of shapes of slide 1 of active presentation properties of shape 1 of slide 1 of active presentation end tell |
結果は下記の通りです。
1 |
{class:shape, auto shape type:autoshape not primitive, black and white mode:black and white mode automatic, connection site count:10, is connector:false, fill format:fill format of shape 1 of slide 1 of active presentation of application "Microsoft PowerPoint", height:202.625045776367, horizontal flip:false, left position:63.375038146973, line format:line format of shape 1 of slide 1 of active presentation of application "Microsoft PowerPoint", lock aspect ratio:false, name:"Freeform 11", rotation:0.0, shadow format:shadow format of shape 1 of slide 1 of active presentation of application "Microsoft PowerPoint", word art format:word art format of shape 1 of slide 1 of active presentation of application "Microsoft PowerPoint", text frame:text frame of shape 1 of slide 1 of active presentation of application "Microsoft PowerPoint", threeD format:threeD format of shape 1 of slide 1 of active presentation of application "Microsoft PowerPoint", top:91.25, shape type:shape type free form, vertical flip:false, visible:true, width:535.374938964844, z order position:1, link format:link format of shape 1 of slide 1 of active presentation of application "Microsoft PowerPoint", animation settings:animation settings of shape 1 of slide 1 of active presentation of application "Microsoft PowerPoint", media type:missing value, has text frame:true, has table:false, child:false, shape style:line preset9, background style:background not a preset, soft edge format:soft edge format of shape 1 of slide 1 of active presentation of application "Microsoft PowerPoint", glow format:glow format of shape 1 of slide 1 of active presentation of application "Microsoft PowerPoint", reflection format:reflection format of shape 1 of slide 1 of active presentation of application "Microsoft PowerPoint"} |