class CommandRule(MappingRule): mapping = { "next tab [<n>]": R(Key("c-pgdown") * Repeat(extra="n"), rdescript="Notepad++: Next Tab"), "prior tab [<n>]": R(Key("c-pgup") * Repeat(extra="n"), rdescript="Notepad++: Prior Tab"), "close tab [<n>]": R(Key("c-w") * Repeat(extra="n"), rdescript="Notepad++: Close Tab"), "stylize <n2>": R(Mouse("right") + Key("down:6/5, right") + (Key("down") * Repeat(extra="n2")) + Key("enter"), rdescript="Notepad++: Stylize"), "remove style": R(Mouse("right") + Key("down:6/5, right/5, down:5/5, enter"), rdescript="Notepad++: Remove Style"), "preview in browser": R(Key("cas-r"), rdescript="Notepad++: Preview In Browser"), # requires function list plug-in: "function list": R(Key("cas-l"), rdescript="Notepad++: Function List"), } extras = [ Dictation("text"), IntegerRef("n", 1, 100), IntegerRef("n2", 1, 10), ] defaults = {"n": 1}
def send_input(n, action): s = control.nexus().comm.get_com("grids") int_a = int(action) response = None if int_a != 2: s.go(str(n)) elif int_a == 2: response = s.retrieve_data_for_highlight(str(int(n))) s.kill() navigation.wait_for_grid_exit() if int_a == 0: Playback([(["mouse", "left", "click"], 0.0)]).execute() elif int_a == 1: Playback([(["mouse", "right", "click"], 0.0)]).execute() elif int_a == 2: x1 = response["l"] + 2 x2 = response["r"] y = response["y"] Mouse("[{}, {}]".format(x1, y)).execute() time.sleep(0.1) Mouse("left:down").execute() Mouse("[{}, {}]".format(x2, y)).execute() time.sleep(0.1) Mouse("left:up").execute()
def connect_pre(): StartApp(R"C:\Program Files (x86)\Pritunl\pritunl.exe").execute() Pause("500").execute() Mouse("(0.92, 0.1), left").execute() Pause('100').execute() Mouse("(0.92, 0.1), left").execute() Pause('400').execute() Text(sand_pass).execute() Pause('50').execute() Mouse("(0.75, 0.1), left").execute()
def send_input(x, y, action, nexus): s = nexus.comm.get_com("grids") s.move_mouse(int(x), int(y)) int_a = int(action) if (int_a == 0) | (int_a == 1): s.kill() grids.wait_for_death(settings.DOUGLAS_TITLE) if int_a == 0: Mouse("left").execute() elif int_a == 1: Mouse("right").execute()
def send_input(pre, color, n, action, nexus): s = nexus.comm.get_com("grids") s.move_mouse(int(pre), int(color), int(n)) int_a = int(action) if (int_a == 0) | (int_a == 1): s.kill() grids.wait_for_death(settings.DOUGLAS_TITLE) time.sleep(0.1) if int_a == 0: Mouse("left").execute() elif int_a == 1: Mouse("right").execute()
def drag_highlight(n1, n2): s = control.nexus().comm.get_com("grids") response1 = s.retrieve_data_for_highlight(str(int(n1))) response2 = s.retrieve_data_for_highlight(str(int(n2))) s.kill() Grid.wait_for_grid_exit() x11 = response1["l"] + 2 y1 = response1["y"] x22 = response2["r"] y2 = response2["y"] Mouse("[{}, {}]".format(x11, y1)).execute() time.sleep(0.1) Mouse("left:down").execute() Mouse("[{}, {}]".format(x22, y2)).execute() time.sleep(0.1) Mouse("left:up").execute()
def __init__(self, slack_n, outlook_n): self.slack = Key("w-" + slack_n + "/100") self.my_team = Key("c-2/30") self.myself = Key("cs-t/100") + Text("you") + Key("enter/50") self.msg_field = Mouse("[400, 1000]") # sometimes needs to be selected self.copy_msg = Key("up/30, c-a/30, c-c/30") self.outlook = Key("w-" + outlook_n + "/50") self.copy_from_slack = self.slack + self.my_team + self.myself + self.msg_field + self.copy_msg
def move_to_position(self, offset=(0, 0)): if not self.has_gaze_point(): return False x = max(0, int(self.last_gaze_point[0]) + offset[0]) y = max(0, int(self.last_gaze_point[1]) + offset[1]) print("Moving to last gaze: {}".format(self.last_gaze_point)) Mouse("[%d, %d]" % (x, y)).execute() return True
def elite_target(name): global elite_mode global elite_driving_speed if name == "ahead": if elite_mode == "flight": Function(elite_long_key, pre="f7", name="w").execute() elif elite_mode == "driving": Mouse("right:down/5, right:up/10").execute()
def double_click(): """Places the mouse the grid coordinates and double clicks the left mouse button. """ (positionX, positionY) = _init_mouse_action() if positionX != None and positionY != None: Mouse("[%s, %s], left:2" % (positionX, positionY)).execute() disable_navigation_grammar()
def connect_cisco(): StartApp( R"C:\Program Files (x86)\Cisco\Cisco AnyConnect Secure Mobility Client\vpnui.exe" ).execute() Pause("100").execute() Mouse("(0.85, 0.5), left").execute() Pause("100").execute() Text(in_pass).execute() Key('enter').execute()
def shift_click(): """Places the mouse the grid coordinates and holds down the SHIFT-key while clicking the left mouse button. """ (positionX, positionY) = _init_mouse_action() if positionX != None and positionY != None: Key("shift:down/5").execute() Mouse("[%s, %s], left" % (positionX, positionY)).execute() Key("shift:up/5").execute() disable_navigation_grammar()
class GlobalRule(MappingRule): mapping = { '[<text>] go to sleep': Function(go_to_sleep), 'mouse': Key('f3,f4/350,f4'), "touch": Mouse("left"), "touch two": Mouse("left:2"), 'touch are': Mouse('right'), "touch mid": Mouse("middle"), "[<n>] scroll down": (Mouse("wheeldown") + Pause('5')) * Repeat(extra='n') * 2, "[<n>] scroll up": (Mouse("wheelup") + Pause('5')) * Repeat(extra='n') * 2, "[<n>] scroll right": (Mouse("wheelright") + Pause('5')) * Repeat(extra='n') * 2, "[<n>] scroll left": (Mouse("wheelleft") + Pause('5')) * Repeat(extra='n') * 2, "drag": Mouse("left:down"), "drop": Mouse("left:up"), "[<n>] alt tab": Key("alt:down,tab/50:%(n)d/50,alt:up"), "alt tab show": Key("alt:down,tab/10,s-tab"), 'reload natlink': Function(reload_natlink), } extras = [ IntegerRef('n', 1, 101, default=1), Dictation('text'), ]
def select_text(self, text_query): """Selects text which matches the provided query.""" try: return utils.select_text(self.os_controller, text_query) except base.UnsupportedSelectionError: # Fall back to mouse-based text selection. text_info = utils.get_text_info(self.os_controller, text_query) if text_info and text_info.start_coordinates and text_info.end_coordinates: Mouse("[%d, %d], left:down, [%d, %d]/10, left:up" % (text_info.start_coordinates + text_info.end_coordinates)).execute() return True else: return False
class CustomKeysRule(MappingRule): mapping = { "windows": Key('win:down/3, win:up/3'), "caster reboot": Mimic("reboot caster"), "magic":Mouse("left:down/3, left:up/3"), "space bar":Key("space:down/3, space:up/3"), "foot pedal <footPedalMode>":Function(setFootPedalMode), "ecks box controller <onOff>":Function(setControllerMode), "look":Key("f15") # "foot pedal mouse":Function(lambda:writeIni("footMode","mouse")) } extras = [ Choice("footPedalMode",foot_pedal_modes), Choice("onOff",{"on":"on","off":"off"}) ]
class NPPRule(MergeRule): pronunciation = "notepad plus plus" mapping = { "stylize <n2>": R(Mouse("right") + Key("down:6/5, right") + (Key("down") * Repeat(extra="n2")) + Key("enter"), rdescript="Notepad++: Stylize"), "remove style": R(Mouse("right") + Key("down:6/5, right/5, down:5/5, enter"), rdescript="Notepad++: Remove Style"), "preview in browser": R(Key("cas-r"), rdescript="Notepad++: Preview In Browser"), # requires function list plug-in: "function list": R(Key("cas-l"), rdescript="Notepad++: Function List"), } extras = [ Dictation("text"), IntegerRefST("n", 1, 100), IntegerRefST("n2", 1, 10), ] defaults = {"n": 1}
def mouse_drag(): """Holds down the left mouse button while moving the mouse mouse from a previous position to the current position. """ global MOUSE_MARK_POSITION if MOUSE_MARK_POSITION: (startX, startY) = MOUSE_MARK_POSITION (targetX, targetY) = _init_mouse_action() mouseString = "[%s, %s], left:down/10, [%s, %s], left:up/10" % (startX, startY, targetX, targetY) Mouse(mouseString).execute() MOUSE_MARK_POSITION = None else: print("Mouse drag failed, no start position marked.") disable_navigation_grammar()
def move(chess_letter, chess_number, chess_letter2, chess_number2): if not Board.right_bottom or not Board.left_top: raise Exception("Board not calibrated!") logger.info((Board.right_bottom, Board.left_top)) width = Board.right_bottom[0] - Board.left_top[0] height = Board.right_bottom[1] - Board.left_top[1] logger.info(str((width, height))) x1, y1 = float(chess_letter), float(chess_number) logger.info(str((x1, y1))) source = (x_coord(Board.left_top[0], width, x1, Board.flipped), y_coord(Board.left_top[1], height, y1, Board.flipped)) logger.info(str(source)) x2, y2 = float(chess_letter2), float(chess_number2) destination = (x_coord(Board.left_top[0], width, x2, Board.flipped), y_coord(Board.left_top[1], height, y2, Board.flipped)) logger.info(str(destination)) click_action = "%s, left:down, %s, left:up" % (str(source), str(destination)) logger.info(click_action) Mouse(click_action).execute()
def curse(direction, direction2, nnavi500, dokick): x, y = 0, 0 d = str(direction) d2 = str(direction2) if d == "up" or d2 == "up": y = -nnavi500 if d == "down" or d2 == "down": y = nnavi500 if d == "left" or d2 == "left": x = -nnavi500 if d == "right" or d2 == "right": x = nnavi500 Mouse("<" + str(x) + ", " + str(y) + ">").execute() if int(dokick) != 0: if int(dokick) == 1: left_click() elif int(dokick) == 2: right_click()
class core(MergeRule): non = coreNon pronunciation = CORE["pronunciation"] mapping = { "[<big>] <letter>": Function(alphabet), CORE["numbers_prefix"] + " <numbers>": Text("%(numbers)s"), "<punctuation>": Key("%(punctuation)s"), "[<modifier>] <direction> [<n>]": Key("%(modifier)s" + "%(direction)s:%(n)s"), "<repeatable_key> [<n>]": Key("%(repeatable_key)s") * Repeat(extra="n"), "<non_repeatable_key>": Key("%(non_repeatable_key)s"), CORE["dictation_prefix"] + " <text>": Text("%(text)s"), "shift click": Key("shift:down") + Mouse("left") + Key("shift:up"), } extras = [ Dictation("text"), IntegerRef("n", 1, 10), IntegerRef("numbers", 0, CORE["numbers_max"]), Choice("big", {CORE["capitals_prefix"]: True}), Choice("letter", CORE[_LETTERS]), Choice("punctuation", CORE["punctuation"]), Choice("repeatable_key", CORE["repeatable_keys"]), Choice("non_repeatable_key", CORE["non_repeatable_keys"]), Choice("direction", CORE[_DIRECTIONS]), Choice("modifier", CORE["modifiers"]), ] defaults = { "big": False, "n": 1, "modifier": "", }
"search tabs": Key("ctrl:down, tab"), "free": Key("alt:up") + Key("shift:up") + Key("ctrl:up"), "folders": Key("w-b/10, s-tab/10, enter"), "foxy": Key("w-b/10, s-tab/10, right:1/10, enter"), "foxy reload": Key("w-b/10, s-tab/10, right:1/10, enter/10, f5"), "Eddie": Key("w-b/10, s-tab/10, right:2/10, enter"), "Heidi": Key("w-b/10, s-tab/10, right:3/10, enter"), "chrome": Key("w-b/10, s-tab/10, right:4/10, enter"), "skype": Key("w-b/10, s-tab/10, right:5/10, enter"), "chrome reload": Key("w-b/10, s-tab/10, right:4/10, enter/10, f5"), "bashing": Key("w-b/10, s-tab/10, right:5/10, enter"), "como": Mimic("\\no-caps-on") + Mimic("\\no-space-on"), "escape": Key('escape'), "switch tab": Key('c-tab'), "new one": Key('c-n'), "kick": Mouse('left'), "rye kick": Mouse('right'), "dee kick": Mouse('left:2'), "block": Key("f6"), "address bar": Key ("a-d"), "logout of computer": Key ("w-l"), "crack": Key("s-f10") + Key("down"), "open file" : Key("c-o"), "logout" : Mimic("press windows ell"), # svn } ) grammar = Grammar("general")
class NavigationNon(MappingRule): mapping = { "<direction> <time_in_seconds>": AsynchronousAction( [L(S(["cancel"], Key("%(direction)s"), consume=False))], repetitions=1000, blocking=False), "erase multi clipboard": R(Function(navigation.erase_multi_clipboard, nexus=_NEXUS), rdescript="Erase Multi Clipboard"), "find": R(Key("c-f"), rdescript="Find"), "find next [<n>]": R(Key("f3"), rdescript="Find Next") * Repeat(extra="n"), "find prior [<n>]": R(Key("s-f3"), rdescript="Find Prior") * Repeat(extra="n"), "find everywhere": R(Key("cs-f"), rdescript="Find Everywhere"), "replace": R(Key("c-h"), rdescript="Replace"), "(F to | F2)": R(Key("f2"), rdescript="Key: F2"), "(F six | F6)": R(Key("f6"), rdescript="Key: F6"), "(F nine | F9)": R(Key("f9"), rdescript="Key: F9"), "[show] context menu": R(Key("s-f10"), rdescript="Context Menu"), 'kick': R(Function(navigation.kick, nexus=_NEXUS), rdescript="Mouse: Left Click"), 'kick mid': R(Function(navigation.kick_middle, nexus=_NEXUS), rdescript="Mouse: Middle Click"), 'psychic': R(Function(navigation.kick_right, nexus=_NEXUS), rdescript="Mouse: Right Click"), '(kick double|double kick)': R(Function(navigation.kick, nexus=_NEXUS) * Repeat(2), rdescript="Mouse: Double Click"), "shift right click": R(Key("shift:down") + Mouse("right") + Key("shift:up"), rdescript="Mouse: Shift + Right Click"), "curse <direction> [<direction2>] [<nnavi500>] [<dokick>]": R(Function(navigation.curse), rdescript="Curse"), "scree <direction> [<nnavi500>]": R(Function(navigation.wheel_scroll), rdescript="Wheel Scroll"), "colic": R(Key("control:down") + Mouse("left") + Key("control:up"), rdescript="Mouse: Ctrl + Left Click"), "garb [<nnavi500>]": R(Mouse("left") + Mouse("left") + Key("c-c") + Function(navigation.clipboard_to_file, nexus=_NEXUS), rdescript="Highlight @ Mouse + Copy"), "drop [<nnavi500>]": R(Mouse("left") + Mouse("left") + Function(navigation.drop, nexus=_NEXUS), rdescript="Highlight @ Mouse + Paste"), "sure stoosh": R(Key("c-c"), rdescript="Simple Copy"), "sure cut": R(Key("c-x"), rdescript="Simple Cut"), "sure spark": R(Key("c-v"), rdescript="Simple Paste"), "undo [<n>]": R(Key("c-z"), rdescript="Undo") * Repeat(extra="n"), "redo [<n>]": R(Key("c-y"), rdescript="Redo") * Repeat(extra="n"), "refresh": R(Key("c-r"), rdescript="Refresh"), "maxiwin": R(Key("w-up"), rdescript="Maximize Window"), "move window": R(Key("a-space, r, a-space, m"), rdescript="Move Window"), "window (left | lease) [<n>]": R(Key("w-left"), rdescript="Window Left") * Repeat(extra="n"), "window (right | ross) [<n>]": R(Key("w-right"), rdescript="Window Right") * Repeat(extra="n"), "monitor (left | lease) [<n>]": R(Key("sw-left"), rdescript="Monitor Left") * Repeat(extra="n"), "monitor (right | ross) [<n>]": R(Key("sw-right"), rdescript="Monitor Right") * Repeat(extra="n"), "(next | prior) window": R(Key("ca-tab, enter"), rdescript="Next Window"), "switch (window | windows)": R(Key("ca-tab"), rdescript="Switch Window") * Repeat(extra="n"), "next tab [<n>]": R(Key("c-pgdown"), rdescript="Next Tab") * Repeat(extra="n"), "prior tab [<n>]": R(Key("c-pgup"), rdescript="Previous Tab") * Repeat(extra="n"), "close tab [<n>]": R(Key("c-w/20"), rdescript="Close Tab") * Repeat(extra="n"), "elite translation <text>": R(Function(alphanumeric.elite_text), rdescript="1337 Text"), } extras = [ Dictation("text"), Dictation("mim"), IntegerRefST("n", 1, 50), IntegerRefST("nnavi500", 1, 500), Choice( "time_in_seconds", { "super slow": 5, "slow": 2, "normal": 0.6, "fast": 0.1, "superfast": 0.05 }), navigation.get_direction_choice("direction"), navigation.get_direction_choice("direction2"), navigation.TARGET_CHOICE, Choice("dokick", { "kick": 1, "psychic": 2 }), Choice("wm", { "ex": 1, "tie": 2 }), ] defaults = { "n": 1, "mim": "", "nnavi500": 1, "direction2": "", "dokick": 0, "text": "", "wm": 2 }
def move_to_position(offset=(0, 0)): position = get_position() x = max(0, int(position[0]) + offset[0]) y = max(0, int(position[1]) + offset[1]) Mouse("[%d, %d]" % (x, y)).execute()
def master_short_mouse(short_mode, mouse_action): ''' <short_mode><mouse_action> short_mode: "shift" s, "troll" c, "alt" a, "wind" w, "trot" ca, "shoal" cs, "tron" wc, "shalt" sa, "walt" wa, "shin" ws, (default None) mouse_action: ''' if short_mode == "s": Key("shift:down").execute() Mouse(mouse_action).execute() Key("shift:up").execute() elif short_mode == "c": Key("control:down").execute() Mouse(mouse_action).execute() Key("control:up").execute() elif short_mode == "a": Key("alt:down").execute() Mouse(mouse_action).execute() Key("alt:up").execute() elif short_mode == "w": Key("win:down").execute() Mouse(mouse_action).execute() Key("win:up").execute() elif short_mode == "ca": Key("control:down").execute() Key("alt:down").execute() Mouse(mouse_action).execute() Key("control:up").execute() Key("alt:up").execute() elif short_mode == "cs": Key("control:down").execute() Key("shift:down").execute() Mouse(mouse_action).execute() Key("control:up").execute() Key("shift:up").execute() elif short_mode == "wc": Key("win:down").execute() Key("control:down").execute() Mouse(mouse_action).execute() Key("win:up").execute() Key("control:up").execute() elif short_mode == "sa": Key("shift:down").execute() Key("alt:down").execute() Mouse(mouse_action).execute() Key("shift:up").execute() Key("alt:up").execute() elif short_mode == "wa": Key("win:down").execute() Key("alt:down").execute() Mouse(mouse_action).execute() Key("win:up").execute() Key("alt:up").execute() elif short_mode == "ws": Key("win:down").execute() Key("shift:down").execute() Mouse(mouse_action).execute() Key("win:up").execute() Key("shift:up").execute() elif short_mode == "cas": Key("control:down").execute() Key("alt:down").execute() Key("shift:down").execute() Mouse(mouse_action).execute() Key("control:up").execute() Key("alt:up").execute() Key("shift:up").execute() time.sleep(settings.SETTINGS["miscellaneous"]["keypress_wait"] / 1000.)
def calculateSlotNumber(number): startingPoint = .20 increment = .058 calculation = (number * increment) slotNumber = (startingPoint + calculation) - increment Mouse("(0.1, {}), left".format(slotNumber)).execute()
class KeystrokeRule(MappingRule): release = Key("shift:up, ctrl:up") mapping = { "[<n>] up": Key("up/2:%(n)d"), "[<n>] down": Key("down/2:%(n)d"), "[<n>] left": Key("left/2:%(n)d"), "[<n>] right": Key("right/2:%(n)d"), "[<n>] pop": Key("pgup/2:%(n)d"), "[<n>] pen": Key("pgdown/2:%(n)d"), "<n> up (page | pages)": Key("pgup/2:%(n)d"), "<n> down (page | pages)": Key("pgdown/2:%(n)d"), "<n> left (word | words)": Key("c-left/2:%(n)d"), "<n> right (word | words)": Key("c-right/2:%(n)d"), "home": Key("home"), "end": Key("end"), "doc home": Key("c-home"), "doc end": Key("c-end"), "follow": Key("ctrl:down") + Mouse("left") + Key("ctrl:up"), # "soot": Key("escape"), # "[<n>] joot": release + Key("space/2:%(n)d"), "[<n>] slap": release + Key("enter/2:%(n)d"), "[<n>] tab": Key("tab/2:%(n)d"), "[<n>] dij": release + Key("del/2:%(n)d"), "ditch [<n> | this] (line|lines)": release + Key("home, s-down/2:%(n)d, del"), "[<n>] boot": release + Key("backspace/2:%(n)d"), "pop up": release + Key("apps"), "pinj": release + Key("c-v"), "duplicate <n>": release + Key("c-c, c-v:%(n)d"), "copy": release + Key("c-c"), "thatsy": release + Key("c-c"), "cut": release + Key("c-x"), "select all": release + Key("c-a"), # "[hold] appsj": Key("apps:down"), # "appsup": d Key("apps:up,"), "[hold] shi": Key("shift:down"), "shiffup": Key("shift:up"), "[hold] zoo": Key("ctrl:down"), "contup": Key("ctrl:up"), "[hold] az": Key("alt"), "altup": Key("alt:up"), "release [all]": release, "tux": Key("c-a"), "amplify": Key("c-plus"), # "say <text>": release + Text("%(text)s"), "mimic <text>": release + Mimic(extra="text"), "efyek": Key("f1"), "efdouce": Key("f2"), "efse": Key("f3"), "efchar": Key("f4"), "efpanj": Key("f5"), "efshish": Key("f6"), "efhaf": Key("f7"), "efhash": Key("f8"), "efnoh": Key("f9"), "efdah": Key("f10"), "efyazdah": Key("f11"), "efdavazdah": Key("f12"), "efsizdah": Key("f13"), "efcharda": Key("f14"), "efpoonza": Key("f15"), "inteli jey": Text("intellij") } extras = [ IntegerRef("n", 1, 100), Dictation("text"), Dictation("text2"), ] defaults = { "n": 1, }
def M(*args, **kws): return Mouse(*args, **kws)
def _execute(self, data=None): mouse_y = str(self.start_y + (data["n"] - 1) * 64) mouse_x = str(self.start_x + (data["n"] - 1) * 2) action = Mouse("[" + mouse_x + ", " + mouse_y + "]") action.execute()
def __init__(self, operation="stage"): super(StageDiscardHunkAction, self).__init__() self.operation = operation self.file_area = Mouse("[1240, 185], left")
"south": Key("c-end"), # Deletion "crash [<n>]": Key("backspace/5:%(n)d"), "crack [<n>]": Key("del/5:%(n)d"), "slay [<n>]": release + Key("c-backspace/5:%(n)d"), "kill [<n>]": release + Key("c-del/5:%(n)d"), # Copy/paste "copy": release + Key("c-c") + Mouse("left:up"), "paste": release + Key("c-v"), "chop [<n>]": release + Key("c-x/5:%(n)d"), # Selection "mark all": release + Key("c-a"), "mark line": release + Key("home/5, shift:down/5, end/5, shift:up"), "mark west": release + Key("shift:down/5, home/5, shift:up"), "mark east": release + Key("shift:down/5, end/5, shift:up"), "mark right [<n>]":