;scr.as ver1.0 ;hsp ver3.2 で作成 /* %author やま %version 1.0 %date 2011/07/28 %url http://hp.vector.co.jp/authors/VA053867/ %port Win %href scr_set scr scr_pause scr_status scr_mode scr_stop %note scr.as をインクリュードして使用してください。 %group スクリーンリーダー制御命令 %dll scr スクリーンリーダー xpread/pcトーカー/FocusTalk の読み上げ制御モジュールです。 ;解説 %index scr_set スクリーンリーダーの初期化 %inst 現在動作中のスクリーンリーダーを調べ動作の準備をします。 読み上げをさせる前には必ず実行させて下さい。 システム変数 stat には動作中のスクリーンリーダーの値を返します。 stat の値 0 = pcトーカー 1 = XPreader 2 = FocusTalk -1 = 何も起動していない、もしくはエラー %index scr スクリーンリーダーでの読み上げ %prm p1,p2 p1=読み上げさせる文字列 p2=0〜 読み上げモードの指定(省略可) %inst スクリーンリーダーの読み上げを実行します。 この命令を実行する前には scr_set 命令でスクリーンリーダーの初期化を行ってください。 p1に読み上げさせる文字列を指定します。 p2で読み上げのモードを指定します。値は下記を合計して使用します。 省略した場合は 0 がセットされます。 0 = 通常の滑らか読み 2 = この音声文を無視しない 4 = 詳細読み 8 == カーソル移動読み 16 = かな漢字変換読み 32 = 低音読み 注意 以下はスクリーンリーダーによって異なります。 pcトーカー/Xpreader 64 = 校閲読み 128 = 必ず出力する 1024 = 1文字簡易読み 2048 == 高音読み FocusTalk 64 = 高音読み 128 = 音声停止中でも強制的に読み上げ %sample scr_set scr "こんばんは、 xprd.as のテスト中です。",0 %index scr_pause 読み上げの一時停止 %inst 読み上げを一時停止させます。 結果はシステム変数 stat に代入されます。 stat の値 0 = 正常終了 -1 = エラー -2 = 既に実行中 %sample scr_pause %index scr_status 再生状態の取得 %inst 再生状態を取得します。 結果はシステム変数 stat に代入されます。 stat の値 0 = 停止 1 = 読み上げ中 %sample scr "こんにちは",0 scr_status %index scr_mode 読み上げモードの追加と削除 %prm p1,p2 p1=追加する読み上げモード p2=削除する読み上げモード %inst 読み上げのモードを指定します。 始めに追加するモード、次に削除する項目を指定します。 値は下記の通り。 pcトーカー/Xpreaderの場合 1 = 標準値を設定 2 = 音声出力 4 = キーコード読み上げ 8 = カーソルキーを読まない 16 = クリップボード読み上げ 32 = マウスカーソル読み上げ 64 = プルダウン(オルト)メニュー読み上げ 128 = スタートメニュー読み上げ 256 = かな漢字変換読み上げ 512 = エクセル読み上げ 1024 = 外部プログラムからの読み上げ 2048 = アクセスキー読み上げ 4096 = ホットキー読み上げ 8192 = 音声をステレオに設定 16384 = 量子化ビットを16ビットに設定 FocusTalk の場合 1 = onに指定するとデフォルト設定になる 2 = 高域強調 4 = 早送りモード(2倍速 ※ Ver.1.0のみ) 8 = 記号読みモード 16 = 制御コード読みモード 32 = URL記号読みモード 64 = E-Mail記号読みモード 128 = 日付推測読みモード 256 = 時間推測読みモード 512 = クリップボード読み 1024 = マウスカーソル読み 2048 = リストビューのカラム読み上げ 4096 = リッチエディット文字属性読み上げ 8192 = キーエコー 0x80000000 = 音声出力(Alt+Shift+Pauseと同機能) %sample scr_mode 16,0 %index scr_stop 読み上げの停止 %inst 読み上げを停止させます。 %sample scr_stop */ #module ;現在動作中スクリーンリーダーの確認と関数定義 #deffunc scr_set onerror gosub *nonscr ;pcトーカー用 dll 読み込み exist ""+dir_sys+"\\PCTKUSR.DLL" if strsize=-1:goto *xpreader #uselib "PCTKUSR.DLL" #func test_pct "SoundStatus" test_pct if stat=0:goto *xpreader reader=0:goto *set ;xpreader用 dll 読み込み *xpreader exist ""+dir_sys+"\\SOUNDP.DLL" ;#include "hspext.as" ; clipset ""+strsize+"":stop if strsize=-1:goto *focustalk #uselib "SOUNDP.DLL" #func test_xprd "SoundStatus" test_xprd if stat=0:goto *focustalk reader=1 ;pcトーカー/XPreader の関数定義 *set #func scrpx "SoundMessage" str,int #func scrpx_pause "SoundPause" #func scrpx_status "SoundStatus" #func scrpx_mode "SoundModifyMode" int,int #func scrpx_stop "SoundStop" return reader ;FocusTalk用 dll 読み込み *focustalk exist ""+dir_sys+"\\FocusTalkExt.DLL" if strsize=-1:return -1 #uselib "FocusTalkExt.DLL" #func test_ft "FT_IsSoundBusy" test_ft if stat!1:reader=-1:return -1 reader=2 ;FocusTalk 関数定義 #func scrf "FT_OutputVoiceText" str,int #func scrf_status "FT_IsSoundBusy" #func scrf_stop "FT_StopSound" #func scrf_pause "FT_PauseSound" #func scrf_mode "FT_ChangeSoundMode" int,int return reader ;エラー発生時の処理 *nonscr return -1 ;各命令実行 ;音声読み上げ #deffunc scr str text,int mode if reader=2:scrf text,mode:else:scrpx text,mode return ;読み上げ一時停止 #deffunc scr_pause if reader=2:scrf_pause:else:scrpx_pause return ;読み上げ状態の取得 #deffunc scr_status if reader=2:scrf_status:else:scrpx_status return ;読み上げモード設定 #deffunc scr_mode int on,int off if reader=2:scrf_mode on,off:else:scrpx_mode on,off return ;読み上げの停止 #deffunc scr_stop if reader=2:scrf_stop:else:scrpx_stop return #global