• 締切済み

applescript システム環境設定 サウンドについて

初心者なのですが、Applescriptを用いていろいろ出来たらいいなぁと思って現在特訓しています。 今作ろうと思っているのが、システム環境設定の中のサウンドの環境設定をいじるものです。 具体的に言うと「入力」の中のマイク入力の入力レベルの値をとることです。 ライブラリに音の大きさの調節などのサンプルはありました。 またインターネット上で、サウンドを出力する装置の選択なども見つけました。 http://www.measure-zero.jp/blog/2009/Feb/19 【ボリューム調整】 tell application "System Preferences" activate set current pane to pane "com.apple.preference.sound" end tell tell application "System Events" if UI elements enabled then tell slider 1 of group 1 of window 1 of process "System Preferences" if value is 0.5 then set value to 0.8 else set value to 0.5 end if end tell else tell application "System Preferences" activate set current pane to pane "com.apple.preference.universalaccess" display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\"" end tell end if end tell この中の slider 1 of group 1 of window 1 of process "System Preferences" とか、例えば今回でしたらボリュームはどのように取得すればよいのかなどはどのように調べるものなのですか? get UI Element of it とかも上手く使えなくて・・・ あともしご存知でしたら、入力音量や入力レベルの取得方法をお教えいただけますでしょうか? 何も知らなくてすいません・・・

みんなの回答

  • kringon
  • ベストアンサー率55% (29/52)
回答No.2

>プラグインのみフリーということなのでしょうか? 確かフリーが存在していたと思います。ただ現在のintel Mac上で動作するようなものがあるか?シェアウエアならリンクのmonkyサイトにサウンドレベル取得関数があったと思います。 >REALbasicを用いて同時にこれらの入力レベル全てを入手することは可能かどうか分かりますか? USBではちょっと難しくて自分にはわかりませんが、可能だと思います。 でも、かなり専門的な知識が必要になると思われます。 自分にできる範囲での回答になるのですが、それぞれアナログサウンドポートを自作のA/Dコンバーターに通して、それをシリアルポート経由で音声レベルをMac上で監視するということであれば、複数音源でも大丈夫です。

参考URL:
http://www.monkeybreadsoftware.de/realbasic/
kkkkeeennn
質問者

お礼

なるほど・・・ ちょっと難しそうですね・・・ Realbasicも視野に入れて考えてみます! ありがとうございます!!

  • kringon
  • ベストアンサー率55% (29/52)
回答No.1

>入力音量や入力レベルの取得方法をお教えいただけますでしょうか? AppleScriptは簡単なマクロしか使ったことがありませんので、回答できるほどのスキルはありませんが、参考になるかも? 漢字Talk時代に外部機器の簡単な監視のためにサウンド入力ポートをインターフェースにしようと考えた事があります。(serialポートになるとハードの作成が面倒なので) ところがAppleScriptの基本機能では出来そうも無く、OSAXという拡張機能を調べてみました。しかし存在しませんでした。 AppleScriptからのアクセスは難しいと思います。 結局、REALbasicのプラグイン(フリーウエア)を使ってなんとかできました。

kkkkeeennn
質問者

補足

なるほど・・・やはり難しいのですね・・・ありがとうございます。 REALbasicについては使ったことはないのですが、検索して少し見てみました。これは有料の商品なのですか?プラグインのみフリーということなのでしょうか? と、現在複数の音源をUSBを通じてつないでいます。REALbasicを用いて同時にこれらの入力レベル全てを入手することは可能かどうか分かりますか?>< なんか質問だらけになってしまって申し訳ありません。

関連するQ&A

  • AppleScript で・・

    お世話になります。 OS10.6環境で“システム環境設定”の“日付と時刻”を開けるAppleScriptをエディターで作製してみるのですが、エラーが出て(error "System Preferences でエラーが起きました:pane \"com.apple.DateAndTIme\" を pane \"com.apple.DateAndTIme\" に設定できません。" number -10006 from pane "com.apple.DateAndTIme")“日付と時刻”まで行き着きません、他の項目はたどり着くのですが、記述に問題があるかと思いますがさっぱりです、お手数ですがアドバイスいただけると助かります。 ー以下スクリプトー tell application "System Preferences" activate set current pane to pane "com.apple.dateandtime" end tell ー以上ー 例えば "com.apple.dateandtime"のdateandtimeをnetworkにすればネットワークが開くのですが・・

    • ベストアンサー
    • Mac
  • AppleScriptで教えて欲しいです。

    現在、clipboardと同じ名前のフォルダー1つ(例:ABC123)のみ処理する。 →これを、clipboardの名前を含むフォルダー1つ(例:ABC123.4)のみ処理する。 に変更したいです。 ちなみにclipboardの名前を含むフォルダーは、1つしか存在しません。 申し訳ありませんが、実際の業務で使用している下記のスクリプト(無駄な部分も多少あるかと思いますが)を出来る限り変更を加えず、可能でしょうか? 無理であれば、大幅変更も可能ですので、ご教授の程、宜しくお願い致します。 global Num global fp set Num to the clipboard tell application "Finder" my shikyuseihan2data() --支給製版2課データ try duplicate fp to folder "data" of disk "HD" move fp to folder "jus:5)製版行き: 2課使用済" end try end tell --アクセス権 tell application "Terminal" activate do script with command "chmod -R 775 /Volumes/HD/data" quit end tell --支給製版2課のデータ on shikyuseihan2data() tell application "Finder" set x to name of every disk if "jus" is in x then else mount volume "afp://10.1.30.10/jus/" end if try set fp to "jus:5)製版行き:" & Num & ":" as text set fp to fp as alias end try end tell end shikyuseihan2data

    • ベストアンサー
    • Mac
  • Applescript バックグランドでメール送信

    以下のようなApplescriptがあります。 ファイルを開くと自動でメールを送信する物です。 件名: あいうえお 本文: かきくけこ 宛先: xxxxx@xxxxx.xx icalを使って定時送信をしているのですが、以下のスクリプトですと、起動するたびにメール作成の画面がフォーカスされてしまいます。常時バックグランドで処理をしたいのですがどうすればいいでしょうか。 ------------------------------------------------ tell application "Mail" set newMessage to make new outgoing message with properties {subject:"あいうえお", content:"かきくけこ", visible:true} tell newMessage to make new to recipient at end of to recipients with properties {address:"xxxxx@xxxxx.xx"} end tell tell application "System Events" tell application process "Mail" to set frontmost to true keystroke "T" using {command down, shift down} end tell tell application "System Events" tell application process "Mail" to set frontmost to true keystroke "D" using {command down, shift down} end tell ------

    • ベストアンサー
    • Mac
  • apple script の作成につきましての質問です。

    こんにちは、いつもお世話になっております。 現在、game pad companionという、 マウスのボタンを割り当てるシェアソフトを使用しています。 使用環境はPowerBook G4 17/1,5 OS X Tigerです。 マウスは Logicool MX-900 Bluetooth mouseです。 起動後、システム環境設定のパネルを開き GamePadCompanionを一度立ち上げて 「中止」ボタンを押し、その後に「開始」ボタンを 押さなければ、割り当てが適用されません。 そこでその操作をapplescriptにしたものを、 以前この掲示板で作っていただいたのですが、 OSをPantherからTigerに変えたところ動作しなくなってしまいました。 アプリケーション形式のapplescriptをを立ち上げると、 環境設定パネルが開き、GamePadCompanionまでは行くのですが、 それ以降進まなくなってしまいます。 そこで、エラー表記が 「NSReceiverEvaluationScriptError:4」と出ます。 applescriptをどのように訂正したら、 上記のような動作にすることができますでしょうか? 以前、教えていただきましたapplescriptは 「 tell application "System Preferences" activate set current pane to pane "com.carvware.gamecompanionpref" end tell tell application "System Events" tell process "System Preferences" tell window 1 click button "中止" delay 1 --1秒待つ click button "開始" end tell end tell end tell quit of application "System Preferences"」です。 よろしくお願いいたします。 また、applescriptの作成の仕方なのですが やりたい動作を行っているものを、 scriptエディタなどでダイレクトに文字に変えるような方法はありませんでしょうか? 自分なりにヘルプを読みながらやってみたのですが、 できませんでした。。。 質問ばかりですが、よろしくお願いいたします。

    • ベストアンサー
    • Mac
  • Apple Scriptでシステム環境設定の項目を変更したい

    Apple Scriptでシステム環境設定の項目を変更したい システム環境設定>スピーチ>音声認識のSpeakable Itemの入切の切り替えをキーボードショートカットで行いたいのですが、 キーボードショートカットの方はKeyboard Maestroなりを利用するとして、 システム環境設定のApple Scriptからのいじりかたが分かりません。 参考になる質問があるので(http://okwave.jp/qa/q5496340.html) 大体の方法は分かりましたが…… set current pane to pane "com.apple.preference.sound" のcom.apple.preference.~に何を入れれば良いのかが分かりません。 同様に、出てきたタブや項目名(slider 1など)も、指定の仕方は分かっても、どの項目がどれに相当するかが分かりません。 何か調べる方法があるのでしょうか? ぜひご教授ください。

    • ベストアンサー
    • Mac
  • AppleScriptでiCalを動かしてみたが

    以前に下記のようなAppleScriptがネット上に有りましたが(1999年12月28日) ----------------------------------------------実行 set dSta to my date "2013年6月4日火曜日 0:00:00" set dEnd to my date "2013年6月4日火曜日 16:00:00" -- 検索するカレンダー名 set calName to "仕事" -- 結果を格納する変数 set copyText to "" tell application "Calendar" set theList to every event of calendar calName whose (start date ≥ dSta) and (end date ≤ dEnd) repeat with x in theList set aDate to (start date of x) set copyText to copyText & (aDate as text) & tab & summary of x & (ASCII character 10) end repeat end tell -- 結果をクリップボードにコピー set copyText2 to my Sortsc(copyText) set the clipboard to copyText2 on Sortsc(aData) do shell script "echo " & quoted form of aData & " | sort -d" end Sortsc ------------------------------------------------------------- 今回これを利用したい思い osx10.8 applescript エディタ2.5.1にて起動してみようとしましたが下記のような不思議な現象がでました。 set dSta to my date "2013年6月4日火曜日 0:00:00" set dEnd to my date "2013年6月4日火曜日 16:00:00" としていますが date "1999年12月28日火曜日 0:00:00" and end date ≤ date "1999年12月28日火曜日 16:00:00" となってしまった。 なぜそうなったのかが分かりません。 どなたかご存知のお方がおられましたらご教授いただきたいのですが。 -----------------------------------返された値 tell application "Calendar" get every event of calendar "仕事" whose start date ≥ date "1999年12月28日火曜日 0:00:00" and end date ≤ date "1999年12月28日火曜日 16:00:00" --> {} end tell tell current application do shell script "echo '' | sort -d" --> "" end tell tell application "AppleScript Editor" set the clipboard to "" end tell ------------------------------------------------------------- 因にosx10.6 AppleScript2.3にはきちんと返された値は内容が取得されています。

    • ベストアンサー
    • Mac
  • indesignでのapplescript

    はじめまして、indesign CS3で使用するapplescriptに関しての質問です。 自動で出力をしてくれるスクリプトを作りたいと思い、やってみたのですがうまくいきません。 色々調べて作ってみたのがこれです。 tell application "Finder" set filesInFolder to files in (choose folder) repeat with theFile in filesInFolder if name extension of theFile is "indd" then -- 拡張子を指定 set priset to "B4" -- プリントプリセットを指定 tell application "Adobe InDesign CS3" activate open theFile tell document 1 print using priset without print dialog close saving no end tell end tell end if end repeat end tell ここまではなんとかできたのですが、現段階では1階層下までのinddドキュメントしか読取ってくれません。 1見開きごとにパッケージしてできた子フォルダを一つの親フォルダにまとめることが多いので、フォルダ▶フォルダ▶.inddになります。 これでは親フォルダを指定したときに2階層下の子フォルダに分かれて入っている複数の.inddを一気に出力することができません。 何か解決策はありませんでしょうか? また、現段階に関してのご指摘もございましたらよろしくお願いします。

  • AppleScript 添削希望

    以下のスクリプトを1回実行するとデスクトップにフォルダ「t01」ができるのですが、 2回目以降「t02」とはならず、「test」のままで止まってしまいます。 OS 10.5.8 です。どこか間違ってるのでしょうか。 tell application "Finder" duplicate folder "test" of folder "_test" of desktop to desktop with replacing try set name of folder "test" of desktop to "t01" on error try set name of folder "test" of desktop to "t02" on error try set name of folder "test" of desktop to "t03" end try end try end try end tell

    • ベストアンサー
    • Mac
  • AppleScriptでpathを取得

    クリックしたファイルの絶対パスをクリップボードに保存する AppleScript(以下に記載)があるのですが、これでは クリップボードの中身が '/Users/ABC/Desktop/tmp1.jpg' '/Users/ABC/Desktop/tmp2.jpg' となります。 クオーテーション「 ' 」なしで、クリップボードに保存したいのですが どのようにすれば良いのでしょうか。 rest of characters of などを使ってどうにか組もうとしたのですが 初心者にはできませんでした。 どなたか、よろしくお願いします。 tell application "Finder" set theItems to "__OBJ_PATH__" set theResult to "" set old_delims to AppleScript's text item delimiters set AppleScript's text item delimiters to ":" set max to count of (every text item of theItems) repeat with num from 1 to max set theResult to theResult & quoted form of (text item num of theItems) if max > 1 and num < max then set theResult to "theResult" & " " end if end repeat set AppleScript's text item delimiters to old_delims set the clipboard to theResult end tell

  • AppleScriptがエラーになる

    osx10.8.4  AppleScriptエディタ2.5.1 にて以下の内容でFileMaker11へテキストデータを貼付けようとしましたところ ----------------------- set dbName to "test.fp7" tell application "FileMaker Pro Advanced" activate tell database dbName set contents of field "myText" to "ABC" end tell end tell ----------------------- error "FileMaker Pro Advanced でエラーが起きました:オブジェクトが見つかりません。 ----------------------- とのエラーが出ました。 ちなみにosx10.6.8 AppleScriptエディタ2.3ではテキストは読み込まれます。 osx10.8.4 の仕様が変わったのでしょうか 2・3日前にosのバージョンアップをしましたがそれが関係していたのでしょうか。 どなたかご存知の方がおられましたらご教授下さい。

    • ベストアンサー
    • Mac