Example #1
0
        public void fncExecuteCommand(String cmd)
        {
            if (appSettings.ExcuteType == 1)
            {
                //cmd = "/" + cmd;
                Clipboard.SetDataObject(cmd);
                if (TargetWindow.fncFindMinecraft())
                {
                    TargetWindow.fncChatOpen();
                    //Thread.Sleep(50);
                    //SendKeyUtility.SendKeyAsync("^v" + fncGetEnd());
                    //SendKeys.Send("^v" + fncGetEnd());
                    Win32API.keybd_paste();
                    if (appSettings.FlgExcute)
                    {
                        Win32API.keybd_click(Win32API.VK_RETURN);
                    }
                }
            }
            else if (appSettings.ExcuteType == 2)
            {
                Clipboard.SetDataObject(cmd);
                if (TargetWindow.fncFindMinecraftServer())
                {
                    //コマンド実行
                    SendKeys.Send(cmd + fncGetEnd());
                    //Win32API.keybd_paste_cmd();
                }
            }
            else if (appSettings.ExcuteType == 3)
            {
                Clipboard.SetDataObject(cmd);
                if (TargetWindow.fncFindBukkitGUI())
                {
                    //マウスポインタの位置を取得する
                    //X座標を取得する
                    int x = Cursor.Position.X;
                    //Y座標を取得する
                    int y = Cursor.Position.Y;

                    //Generalタブをクリック
                    Cursor.Position = new Point(TargetWindow.winRect.left + 30, TargetWindow.winRect.top + 40);
                    mouse_event(WM_LBUTTONDOWN, 0, 0, 0, 0);
                    mouse_event(WM_LBUTTONUP, 0, 0, 0, 0);

                    //テキストボックスにフォーカス合わせる
                    SendKeys.SendWait("{TAB 7}");

                    //コマンド実行
                    SendKeys.SendWait("^V" + fncGetEnd());

                    //マウスポインタの位置を元に戻す
                    Cursor.Position = new Point(x, y);
                }
            }
            if (appSettings.ExcuteType == 4)
            {
                //cmd = "/" + cmd;
                Clipboard.SetDataObject(cmd);
                if (TargetWindow.fncFindNotepad())
                {
                    //SendKeys.Send("^V" + fncGetEnd());
                    Win32API.keybd_paste();
                    if (appSettings.FlgExcute)
                    {
                        Win32API.keybd_click(Win32API.VK_RETURN);
                    }
                }
            }
            //Clipboard.Clear();
        }