VOICEROID+ 東北ずん子をHSPから制御するモジュールです。前シリーズと仕様が変わっています。NGワード系の処理が入っていません。
VOICEROID+ 東北ずん子をHSPから制御するモジュールです。前シリーズと仕様が変わっています。NGワード系の処理が入っていません。
#include "user32.as"#include "kernel32.as"#module __VOICEROID_ZUNKO__#deffunc zunko_init// ウィンドウ名とかクラス名とかzunkowname1 = "VOICEROID+ 東北ずん子*"zunkowname2 = "VOICEROID+ 東北ずん子"zunkomainclass = "WindowsForms10.Window.8.app.0.17ad52b"zunkoeditclass = "WindowsForms10.RichEdit20W.app.0.17ad52b"zunkobuttonclass = "WindowsForms10.BUTTON.app.0.17ad52b"return// ボイスロイドの起動数を調べる#defcfunc GetZunkoRunningNumVh = 0 : c = 0repeatFindWindowExA 0, h, zunkomainclass, zunkowname1if stat == 0{FindWindowExA 0, h, zunkomainclass, zunkowname2}h = stat// 0 になるまでループif h == 0 {c = cnt : break}loopreturn c// ボイスロイドのトップのウィンドウを取得#defcfunc GetZunkoTopWindowVFindWindowA zunkomainclass, zunkowname1if stat == 0{FindWindowA zunkomainclass, zunkowname2}return stat// ボイスロイドのテキストボックスを取得#defcfunc GetZunkoTextBoxVFindWindowExA GetZunkoTopWindowV(), 0, zunkomainclass, 0hChild = statFindWindowExA hChild, 0, zunkomainclass, 0 // その子を取得(長男)FindWindowExA hChild, stat, zunkomainclass, 0 // 2番目(次男)hChild = statFindWindowExA hChild, 0, zunkomainclass, 0 // 2番目の兄弟の孫(長男)を取得FindWindowExA stat, 0, zunkomainclass, 0FindWindowExA stat, 0, zunkomainclass, 0FindWindowExA stat, 0, zunkomainclass, 0hChild = statFindWindowExA hChild, 0, zunkoeditclass, 0return stat// ボイスロイドの再生ボタンを取得#defcfunc GetZunkoPlayButtonVFindWindowExA GetZunkoTopWindowV(), 0, zunkomainclass, 0hChild = statFindWindowExA hChild, 0, zunkomainclass, 0 // その子を取得(長男)FindWindowExA hChild, stat, zunkomainclass, 0 // 2番目(次男)hChild = statFindWindowExA hChild, 0, zunkomainclass, 0 // 2番目の兄弟の孫(長男)を取得FindWindowExA stat, 0, zunkomainclass, 0FindWindowExA stat, 0, zunkomainclass, 0FindWindowExA stat, 0, zunkomainclass, 0hChild = statFindWindowExA hChild, 0, zunkomainclass, 0hChild = statFindWindowExA hChild, 0, zunkobuttonclass, 0return stat// ボイスロイドの停止ボタンを取得#defcfunc GetZunkoStopButtonVFindWindowExA GetZunkoTopWindowV(), 0, zunkomainclass, 0hChild = statFindWindowExA hChild, 0, zunkomainclass, 0 // その子を取得(長男)FindWindowExA hChild, stat, zunkomainclass, 0 // 2番目(次男)hChild = statFindWindowExA hChild, 0, zunkomainclass, 0 // 2番目の兄弟の孫(長男)を取得FindWindowExA stat, 0, zunkomainclass, 0FindWindowExA stat, 0, zunkomainclass, 0FindWindowExA stat, 0, zunkomainclass, 0hChild = statFindWindowExA hChild, 0, zunkomainclass, 0hChild = statFindWindowExA hChild, 0, zunkobuttonclass, 0FindWindowExA hChild, stat, zunkobuttonclass, 0return stat// ボイスロイドのテキストボックスを全選択する#deffunc ZunkoTextAllSelectVsendmsg GetZunkoTextBoxV(), /*EM_SETSEL*/0x00B1, 0, -1return stat// ボイスロイドのテキストボックスにクリップボード経由で貼り付け#deffunc ZunkoTextPasteVsendmsg GetZunkoTextBoxV(), 0x0301/*WM_COPY*/, 0, 0return stat// ボイスロイドのテキストボックスをUNDO#deffunc ZunkoTextUndoVsendmsg GetZunkoTextBoxV(), 0x0304/*WM_UNDO*/, 0, 0return stat// ボイスロイドのテキストボックスを切り取る#deffunc ZunkoTextCutVsendmsg GetZunkoTextBoxV(), 0x0300/*WM_CUT*/, 0, 0return stat// ボイスロイドのテキストボックスをコピー#deffunc ZunkoTextCopyVsendmsg GetZunkoTextBoxV(), 0x0301/*WM_COPY*/, 0, 0return stat// ボイスロイドのテキストボックスを消去(選択されてるか所のみを消します)#deffunc ZunkoTextDeleteVsendmsg GetZunkoTextBoxV(), 0x0303/*WM_CLEAR*/, 0, 0return stat// ボイスロイドのテキストボックスを消去(選択されてなくても消します)#deffunc ZunkoTextDelete2Vmsg = ""sendmsg GetZunkoTextBoxV(), 0x000C/*WM_SETTEXT*/, 0, varptr(msg)return stat// テキストボックスに代入します(直接)#deffunc ZunkoSetTextV str _msgmsg = _msgsendmsg GetZunkoTextBoxV(), 0x000C/*WM_SETTEXT*/, 0, varptr(msg)return stat// テキストを再生します。#deffunc ZunkoPlayTextVsendmsg GetZunkoPlayButtonV(), 0x00F5/*BM_CLICK*/, 0, 0return// テキスト再生を停止します。#deffunc ZunkoStopTextVsendmsg GetZunkoStopButtonV(), 0x00F5/*BM_CLICK*/, 0, 0return// 再生中かチェック(再生中の場合は1)// 0 停止中 1 再生中 2 一時停止中#defcfunc IsZunkoPlayingVsdim tmp, 64sendmsg GetZunkoPlayButtonV(), 0x000D/*WM_GETTEXT*/, 64-1, varptr(tmp)if stat == 0 : return 0if instr(tmp, 0, "一時停止") != -1 {return 0}else : if instr(tmp, 0, "再開") != -1{return 2}return 1#global// ↓これは必ず必要zunko_init// サンプル// 起動している場合は 1以上が返る。if GetZunkoRunningNumV() > 0 {ZunkoSetTextV "東京特許許可局"ZunkoPlayTextV}