Пример #1
0
 public static void LoadScripts()
 {
     InternalScripts.RegisterScripts();
     foreach (string file in Directory.GetFiles(ScriptCompiler.ScriptRoot))
     {
         if (Path.GetExtension(file) == ".tls")
         {
             ScriptCompiler.InterpretScript(file);
         }
         else if (Path.GetExtension(file) == ".ahk-tl")
         {
             AHKScript.ParseFromFile(file);
         }
     }
 }
Пример #2
0
        private static void RunScript(string script)
        {
            string[] calls = script.Split(';');
            foreach (string call in calls)
            {
                string   command = call.Split(',')[0];
                string[] args    = call.Replace(command + ",", "").Split(',');

                switch (command)
                {
                case "send":
                    SendKeys.SendWait(args[0]);
                    break;

                case "sleep":
                    InternalScripts.Sleep(int.Parse(args[0]));
                    break;

                case "move":
                    HardwareRobot.MovePhysicalCursor(int.Parse(args[0]), int.Parse(args[1]));
                    break;

                case "click":
                    for (int i = int.Parse(args[1]); i > 0; i--)
                    {
                        if (args[0] == "left")
                        {
                            HardwareRobot.DoLeftClick(Cursor.Position.X, Cursor.Position.Y, HardwareRobot.ActionTypes.PHYSICAL);
                        }
                        else
                        {
                            HardwareRobot.DoRightClick(Cursor.Position.X, Cursor.Position.Y, HardwareRobot.ActionTypes.PHYSICAL);
                        }
                    }
                    break;

                case "unreg_mouse_hooks":
                    HardwareListener.UnregisterMouseHooks();
                    break;

                case "reg_mouse_hooks":
                    HardwareListener.RegisterMouseHooks();
                    break;
                }
            }
        }