コード例 #1
0
ファイル: VoidScripts.cs プロジェクト: Electrominch/BinderV2
 public static object[] MoveCursor(params object[] ps)
 {
     try
     {
         int    endX     = (int)ps[0];
         int    endY     = (int)ps[1];
         int    delay    = (int)ps[2];
         string delayCmd = $"Delay({delay})";
         while (true)
         {
             var pos = System.Windows.Forms.Cursor.Position;
             if (pos.X != endX)
             {
                 pos.X += pos.X < endX ? 1 : -1;
             }
             if (pos.Y != endY)
             {
                 pos.Y += pos.Y < endY ? 1 : -1;
             }
             Meths.SetCursorPos(pos.X, pos.Y);
             if (pos.X == endX && pos.Y == endY)
             {
                 break;
             }
             Interpreter.ExecuteCommand(delayCmd);
         }
     }
     catch (Exception e) { MessageBox.Show(e.ToString()); return(ps); }
     return(ps);
 }
コード例 #2
0
        public static object GetProcessIDForegroundWindow(params object[] ps)
        {
            int id = -1;

            Meths.GetWindowThreadProcessId(Meths.GetForegroundWindow(), ref id);
            return(id);
        }
コード例 #3
0
ファイル: VoidScripts.cs プロジェクト: Electrominch/BinderV2
 public static object[] SetCursorPos(params object[] ps)
 {
     try
     {
         Meths.SetCursorPos((int)ps[0], (int)ps[1]);
     }
     catch (Exception e) { MessageBox.Show(e.ToString()); return(ps); }
     return(ps);
 }
コード例 #4
0
 public static object Compare(params object[] ps)
 {
     if (ps.Length < 2)
     {
         MessageBox.Show("В Compare передано недостаточно аргументов");
         throw new Exception("В Compare передано недостаточно аргументов");
     }
     return(Meths.CompareUniversal(ps[0], ps[1]));
 }
コード例 #5
0
ファイル: VoidScripts.cs プロジェクト: Electrominch/BinderV2
 public static object[] MouseEvent(params object[] ps)
 {
     try
     {
         var Mevent = Enum.Parse(typeof(Meths.MouseEventFlags), ps[0].ToString());
         Meths.mouse_event((uint)(int)Mevent, 0, 0, 0, 0);
     }
     catch (NullReferenceException) { MessageBox.Show("В MouseEvent не передано событие " + ps[0]); return(ps); }
     catch { MessageBox.Show("В MouseEvent не найдено событие " + ps[0]); return(ps); }
     return(ps);
 }
コード例 #6
0
ファイル: VoidScripts.cs プロジェクト: Electrominch/BinderV2
 public static object[] MoveCursorBy(params object[] ps)
 {
     try
     {
         int X = (int)ps[0];
         int Y = (int)ps[1];
         Meths.mouse_event(0x00000001, X, Y, 0, 0);
     }
     catch (Exception e) { MessageBox.Show(e.ToString()); return(ps); }
     return(ps);
 }
コード例 #7
0
ファイル: BoolScripts.cs プロジェクト: Electrominch/BinderV2
        public static object ShowDesktopBackground(params object[] ps)
        {
            bool   show = false;
            IntPtr hWin = Meths.FindWindow("Progman", null);

            if (hWin != IntPtr.Zero)
            {
                return(Meths.ShowWindow(hWin, show ? 0 : 5));
            }

            return(false);
        }
コード例 #8
0
ファイル: VoidScripts.cs プロジェクト: Electrominch/BinderV2
 public static object[] ShowHideDesktopIcons(params object[] ps)
 {
     try
     {
         if (ps.Length == 0)
         {
             return(ps);
         }
         Meths.EnumWindows(new Meths.EnumCallback(Meths.EnumWins), (bool)ps[0] ? (IntPtr)5 : IntPtr.Zero);
         return(ps);
     }
     catch { MessageBox.Show("В ShowHideDesktopIcons первый аргумент типа, несоотвествующего Boolean"); return(ps); }
 }
コード例 #9
0
ファイル: VoidScripts.cs プロジェクト: Electrominch/BinderV2
 public static object[] KeyUp(params object[] ps)
 {
     try
     {
         if (ps.Length == 0)
         {
             return(ps);
         }
         string key = ps[0].ToString();
         Meths.keybd_event((int)Enum.Parse(typeof(Keys), key), 0, 0x02, 0);
         return(ps);
     }
     catch { MessageBox.Show("В KeyDown первый аргумент типа, несоотвествующего string"); return(ps); }
 }
コード例 #10
0
ファイル: BoolScripts.cs プロジェクト: Electrominch/BinderV2
        public static object DesktopIsActive(params object[] ps)
        {
            const int     maxChars  = 256;
            IntPtr        handle    = IntPtr.Zero;
            StringBuilder className = new StringBuilder(maxChars);

            handle = Meths.GetForegroundWindow();

            if (Meths.GetClassName(handle, className, maxChars) > 0)
            {
                string cName = className.ToString();
                if (cName == "Progman" || cName == "WorkerW")
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
コード例 #11
0
 public static object GetForegroundWindow(params object[] ps)
 {
     return(Meths.GetForegroundWindow());
 }