コード例 #1
0
ファイル: mouse_move.py プロジェクト: jszheng/PySnippet
def mouse_click(x=None, y=None):
    if not x is None and not y is None:
        mouse_move(x, y)
        time.sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
    time.sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
コード例 #2
0
ファイル: daohangtest.py プロジェクト: crazymanpj/python
    def dtest05_floor2_scrolltip(self):
        driver = self.driver
        driver.get(self.testurl)
        self.initcookie(driver)
        driver.get(self.testurl)

        # js = "var q=document.documentElement.scrollTop=10000"
        # driver.execute_script(js)
        # time.sleep(2)
        floor2_gj = driver.find_element_by_xpath("//a[@class='floor2_anchor']")
        print floor2_gj.is_displayed()
        while(not floor2_gj.is_displayed()):
            driver.refresh()
            floor2_gj = driver.find_element_by_xpath("//a[@class='floor2_anchor']")
        # ActionChains(driver).move_to_element(cool_textlink).

        # js = "var q=document.documentElement.scrollTop=-100"
        # driver.execute_script(js)
        time.sleep(2)
        win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL, 0 ,0 ,100)
        # win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL, 0, 0, 100)
        # win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL, 0, 0, 100)
        time.sleep(1)
        floor2_wave = driver.find_element_by_xpath("//div[@id='J_FloorWave']")
        assert floor2_wave.is_displayed() == True
        win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL, 0, 0, 1000)
コード例 #3
0
ファイル: common.py プロジェクト: YouZhang/PowerTestSuite
def mouseClick(x,y):
    if not x is None and not y is None:
        mouseMove(x,y)
        time.sleep(0.03)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0,0,0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0,0,0)
    time.sleep(0.01)
コード例 #4
0
ファイル: mouse.py プロジェクト: AchironOS/chromium-2
def MoveToLocation(pos, duration=0, tick=0.01):
  """Move the mouse cursor to a specified location, taking the specified time.

  Args:
    pos: position (in screen coordinates) to move to
    duration: amount of time the move should take
    tick: amount of time between successive moves of the mouse

  Returns:
    None
  """
  # calculate the number of moves to reach the destination
  num_steps = (duration/tick)+1

  # get the current and final mouse position in mouse coords
  current_location = ScreenToMouse(win32gui.GetCursorPos())
  end_location = ScreenToMouse(pos)

  # Calculate the step size
  step_size = ((end_location[0]-current_location[0])/num_steps,
               (end_location[1]-current_location[1])/num_steps)
  step = 0

  while step < num_steps:
    # Move the mouse one step
    current_location = (current_location[0]+step_size[0],
                        current_location[1]+step_size[1])

    # Coerce the coords to int to avoid a warning from pywin32
    win32api.mouse_event(
      win32con.MOUSEEVENTF_MOVE|win32con.MOUSEEVENTF_ABSOLUTE,
      int(current_location[0]), int(current_location[1]))

    step += 1
    time.sleep(tick)
コード例 #5
0
ファイル: legiongrid.py プロジェクト: RadixSeven/caster
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()
    grids.wait_for_death(settings.LEGION_TITLE)
    
    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"]
        
        win32api.SetCursorPos((x1, y))
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x1, y, 0, 0)
        time.sleep(0.5)
        win32api.SetCursorPos((x2, y))
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x2, y, 0, 0)
コード例 #6
0
ファイル: mouse.py プロジェクト: hanpeter/windows-macro
 def click(cls, x, y):
     win32api.SetCursorPos((x, y))
     time.sleep(cls.IN_BETWEEN_DELAY)
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
     time.sleep(cls.IN_BETWEEN_DELAY)
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
     time.sleep(cls.AFTER_DELAY)
コード例 #7
0
 def MouseDownMove(self,x,y):
     # 按下后拖住移动
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y)
     time.sleep(0.05)
     windll.user32.SetCursorPos(x,y)
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y)
     time.sleep(0.5)
コード例 #8
0
ファイル: evebot.py プロジェクト: avtarmoon/eve_bot
 def disablescanner(self):
     autopy.mouse.move(933,39)
     time.sleep(0.1)
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0) 
     time.sleep(0.1)
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
     time.sleep(0.1)
コード例 #9
0
ファイル: winguiauto.py プロジェクト: Fover23/PyAutoTrading
def clickWindow(hwnd, offset):
    left, top, right, bottom = win32gui.GetWindowRect(hwnd)
    win32api.SetCursorPos([left + offset, (bottom - top) // 2 + top])
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
    time.sleep(0.2)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
    time.sleep(0.2)
コード例 #10
0
ファイル: chrome_test.py プロジェクト: qiangyi1989/hello_git
def FX_MouseLClick(x, y):
    if platform.system() == 'Windows':
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, int(x), int(y), 0, 0)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, int(x), int(y), 0, 0)
    else:
        global g_m
        g_m.click(x, y, 1)
コード例 #11
0
 def click_CurrentPlace(self,lb_dx,lb_dy):
     
     tmp=(string.atoi(lb_dx),string.atoi(lb_dy))
     
     win32api.SetCursorPos(tmp)
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,tmp[0], tmp[1])
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,tmp[0], tmp[1])
コード例 #12
0
def clicker():
    """Checks for keyboard combinations and handles clicking."""

    global cps
    global speed

    while True:

        if win32api.GetAsyncKeyState(81) != 0 and win32api.GetAsyncKeyState(16) != 0: #Check if Shift + Q is pressed

            while True:

                (x,y) = win32api.GetCursorPos() #Get the current position of the cursor
                win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
                win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
                cps += 1
                time.sleep(speed)

                if win32api.GetAsyncKeyState(38) != 0 and win32api.GetAsyncKeyState(16) != 0 and speed > 0.005: #Check if Shift + Up is pressed
                    speed -= 0.005
                    cps = 0
                    time.sleep(0.1)

                if win32api.GetAsyncKeyState(40) != 0 and win32api.GetAsyncKeyState(16) != 0 and speed < 1: #Check if Shift + Down is pressed
                    speed += 0.005
                    cps = 0
                    time.sleep(0.1)

                if win32api.GetAsyncKeyState(87) != 0 and win32api.GetAsyncKeyState(16) != 0: #Check if Shift + W is pressed
                    break
                    cps = 0
コード例 #13
0
def enter_game_page():
  scrn_w = win32api.GetSystemMetrics(0)
  scrn_h = win32api.GetSystemMetrics(1)
  win32api.SetCursorPos([scrn_w*2/3, scrn_h/2])
  win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0,0,0)
  win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0,0,0)
  is_on_game_page = True
コード例 #14
0
ファイル: Code.py プロジェクト: ZAQ922/OFDP
def LC():
    #Left Down
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
    #Delay down signals, so it won't get ahead of itself
    time.sleep(.1)
    #Left Up
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
コード例 #15
0
ファイル: Code.py プロジェクト: ZAQ922/OFDP
def RC():
    #Right Down
    win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN,0,0)
    #Delay down signals so it won't get ahead of itself
    time.sleep(.1)
    #Right Up
    win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP,0,0)
コード例 #16
0
ファイル: winterface.py プロジェクト: j6k4m8/winterface
def drag(x0, y0, x1, y1, delay=0):
    """Click and drag x0 y0 to x1 y1"""
    click(x0, y0, click=False)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x0,y0,0,0)
    time.sleep(delay)
    click(x1, y1, click=False)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x1,y1,0,0)
コード例 #17
0
ファイル: app.py プロジェクト: nochi0105/myPython
def click(x,y):
    '''
    指定x,yでクリック操作をする
    '''
    win32api.SetCursorPos((x,y))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
コード例 #18
0
ファイル: copytjb.py プロジェクト: testlins/python_script
def chickmouse():
    time.sleep(5)
    win32api.SetCursorPos((150, 60))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0) 
    time.sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
    time.sleep(0.05)
コード例 #19
0
ファイル: mouse_click.py プロジェクト: smile921/Ciss921
def mouse_dclick(x=None,y=None):#鼠标点击
    if not x is None and not y is None:
        mouse_move(x,y)
        time.sleep(0.01)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)#按下左键
    time.sleep(0.01)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)#弹起左键
コード例 #20
0
def left_click(item_coordinates):
    win32api.SetCursorPos((x_pad + item_coordinates[0], y_pad + item_coordinates[1]))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
    time.sleep(.02)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
    # Gave the game a second to catch up
    time.sleep(.2)
コード例 #21
0
    def flick(self, _start, _end):

        logging.debug(" %.2f Flick from(%s,%s)to(%s,%s)" % (
            (time.time() - recoder.BEGGINTIME), _start.x, _start.y, _end.x,
            _end.y))
        start = self._transformPosition(_start)
        end = self._transformPosition(_end)
        list = self._getIntermediatePoints(start, end)
        startPoint = list[0]
        endPoint = list[-1]

        windll.user32.SetCursorPos(startPoint.x, startPoint.y)
        #send down event
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, startPoint.x,
                             startPoint.y)
        time.sleep(0.01)

        for p in list:
            windll.user32.SetCursorPos(p.x, p.y)
            time.sleep(0.01)
            endPoint = p
        if (endPoint != end):
            endPoint = end

        windll.user32.SetCursorPos(endPoint.x, endPoint.y)
        time.sleep(0.01)
        #send up event
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, endPoint.x,
                             endPoint.y)
コード例 #22
0
ファイル: keymouseinput.py プロジェクト: powergun/EHF
 def _run(self):
     # move mouse
     insertState = self._appAttr["AppInfo"].keyMouseInputState["INSERT"].state
     if insertState:
         self.isEnabled = not self.isEnabled
     if not self.isEnabled:
         return
     self.isFiring = self._appAttr["AppInfo"].keyMouseInputState["LMB"].state
     if self.isFiring:
         px, py = self.screenCenterX, self.screenCenterY
         fScreenWidth = windll.user32.GetSystemMetrics(0) - 1.0      # SM_CXSCREEN
         fScreenHeight = windll.user32.GetSystemMetrics(1) - 1.0     # SM_CYSCREEN
         rx = 65535.0 / fScreenWidth
         ry = 65535.0 / fScreenHeight
         
         py += 130
         
         #self.input.mi.dx = int( ceil(px * rx) )
         #self.input.mi.dy = int( ceil(py * ry) )
         
         #windll.User32.SendInput(1, byref(self.input), sizeof(self.input))
         
         c_px = int(ceil(px))
         c_py = int(ceil(py))
         
         
         win32api.mouse_event(self.mouseMoveFlag, c_px, c_py)
         
         self.frame += 1
     
     else:
         self.frame = 0
コード例 #23
0
ファイル: LaserBoard_V8.py プロジェクト: kkawabat/LaserBoard
    def mouse_fun(self):
        mouse_click_delay = 1
        anchor_pos = np.array((0, 0))
        start_time = time.clock()
        while 1:
            ret, view = self.vid.read()

            if not self.q_key.empty():
                keypress = self.q_key.get_nowait()
                if keypress == ord('q'):
                    self.q_frame.put(np.zeros([self.board_h, self.board_w], dtype=np.uint8))
                    return
                elif keypress == ord('r'):
                    self.canvas = np.zeros([self.board_h, self.board_w], dtype=np.uint8)
                    print('canvas cleared')

            board = cv2.warpPerspective(view, self.H, (self.board_w, self.board_h))
            dt_view = self.find_dots(board)

            key_points = self.detector(dt_view)
            if len(key_points) > 0:
                pos = np.array((int(key_points[0][0]) + win32api.GetSystemMetrics(0), int(key_points[0][1]) + 30))
                win32api.SetCursorPos(pos)
                if np.linalg.norm(pos - anchor_pos) > 30:
                    anchor_pos = pos
                    start_time = time.clock()
                else:
                    if time.clock() - start_time > mouse_click_delay:
                        win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, pos[0], pos[1], 0, 0)
                        win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, pos[0], pos[1], 0, 0)
                        start_time = time.clock()
            else:
                start_time = time.clock()
コード例 #24
0
 def MouseMoveAndClick(self,x,y):
     # 移动到坐标位置并点击
     windll.user32.SetCursorPos(x,y)
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y)
     time.sleep(0.05)
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y)
     time.sleep(0.5)
コード例 #25
0
ファイル: Choopi.py プロジェクト: traceformula/choopi
def ClickPosition(ie, x, y):
    win32api.SetCursorPos((x,y))
    #sleep(2)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
    #sleep(2)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
    sleep(1)
コード例 #26
0
ファイル: 0hh1v.py プロジェクト: andrew-zhao/0hh1-solver
	def click(x, y):
		x = x_off + x * tile_dim
		y = y_off + y * tile_dim
		win32api.SetCursorPos((x, y))
		win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x, y, 0, 0)
		win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
		time.sleep(speed)
コード例 #27
0
ファイル: wxu.py プロジェクト: WDavidX/pyutil
def click(x, y):
    """ click(x, y): click at (x,y) """
    xx, yy = win32api.GetCursorPos()
    win32api.SetCursorPos((x, y))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
    l.info("(%4d, %4d) --> (%4d, %4d) clicked" % (xx, yy, x, y))
コード例 #28
0
ファイル: zen_mouse.py プロジェクト: ChengliangDong/KinServer
def printing_handler(addr, tags, data, source):
    left_hand_id = 7
    right_hand_id = 11
    #print "---"
    print "received new osc msg from %s" % getUrlStr(source)
#    print "with addr : %s" % addr
#    print "typetags : %s" % tags
#    print "---"
    #print data
    
    left_hand = data[1+left_hand_id].split(',')
    
    right_hand = data[1+right_hand_id].split(',')
    
    x = float(right_hand[0])
    y = float(right_hand[1])
    # x = (x-0.5)*1.2+0.5;
    # y = (y-0.5)*1.2+0.5;
    
    cx = int(x*65536)#win32api.GetSystemMetrics(0))
    cy = int(y*65536)#win32api.GetSystemMetrics(1))
    #print cx,cy
	
    if start == True:
        #win32api.SetCursorPos((cx,cy))
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN|win32con.MOUSEEVENTF_MOVE|win32con.MOUSEEVENTF_ABSOLUTE,cx,cy)
コード例 #29
0
ファイル: nmrdb.py プロジェクト: miyalu/python_tool
 def close_alter_window(self, elapsed_seconds=1):
     '''点击安全警告窗口中的“运行”按钮, 尝试3次失败后关闭该窗口
     '''
     try_num = 0
     start = time.time()
     while True:
         hwnd = winGuiAuto.findTopWindows(u"安全警告".encode('gbk'))
         if hwnd:
             try:
                 (left, top, right, bottom) = win32gui.GetWindowRect(hwnd[0])     
                 x = left + 460
                 y = top + 255
                 win32api.SetCursorPos((x, y))
                 win32api.ClipCursor((x, y, x, y))
                 win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
                 win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
                 win32api.ClipCursor((0, 0, 0, 0))
             except Exception, e:
                 print e
                 win32api.ClipCursor((0, 0, 0, 0))
                 try_num += 1
                 if try_num > 3:
                     win32api.SendMessage(hwnd[0], win32con.WM_CLOSE, 0, 0)
                     break
                 time.sleep(3)
                 continue
         if elapsed_seconds == 0:
             break
         if self.elapsed(start) > 10:
             break
         time.sleep(1)   
コード例 #30
0
def clickLeftCur():
    win32api.mouse_event(
        win32con.MOUSEEVENTF_LEFTDOWN | win32con.MOUSEEVENTF_LEFTUP, 0, 0)
コード例 #31
0
ファイル: main.py プロジェクト: sakuradied/Twitter-BOT
def zj():
    win32api.mouse_event(
        win32con.MOUSEEVENTF_LEFTDOWN | win32con.MOUSEEVENTF_LEFTUP, 0, 0)
コード例 #32
0
password.send_keys(passwOfLogin)

submit = chrome.find_element_by_id("SubmitCreds")
submit.click()

time.sleep(60)
win32api.keybd_event(win32con.VK_SPACE, 0, 0, 0)
time.sleep(5)
win32api.keybd_event(win32con.VK_TAB, 0, 0, 0)
time.sleep(5)
for num in range(count):
    win32api.keybd_event(win32con.VK_RETURN, 0, 0, 0)
    time.sleep(20)
    win32api.SetCursorPos((609, 215))
    time.sleep(1)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 609, 215, 0, 0)
    time.sleep(1)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 609, 215, 0, 0)
    time.sleep(25)
    for number in range(9):
        win32api.keybd_event(win32con.VK_TAB, 0, 0, 0)
        time.sleep(1)

    press('3', '0')
    time.sleep(1)
    win32api.keybd_event(win32con.VK_RETURN, 0, 0, 0)

    time.sleep(2)
    # win32api.keybd_event(win32con.VK_RETURN, 0, 0, 0)
    time.sleep(2)
    for number in range(4):
コード例 #33
0
 def click(self, pos):
     startPos = win32api.GetCursorPos()
     win32api.SetCursorPos(pos)
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
     win32api.SetCursorPos(startPos)
コード例 #34
0
import win32api
import win32con
import time
import win32gui
#x, y = win32api.GetCursorPos()
#print(x, "  ", y)
#zhujubing = win32gui.FindWindow(None, u'yd3')
#win32gui.SetActiveWindow()
while(1):
    win32api.SetCursorPos((1119, 452))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 200, 200, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 200, 200, 0, 0)
    time.sleep(200)
    win32api.SetCursorPos((1121, 500))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 200, 200, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 200, 200, 0, 0)
    time.sleep(900)
コード例 #35
0

def PressKey(hexKeyCode):
    extra = ctypes.c_ulong(0)
    ii_ = Input_I()
    ii_.ki = KeyBdInput(0, hexKeyCode, 0x0008, 0, ctypes.pointer(extra))
    x = Input(ctypes.c_ulong(1), ii_)
    ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))


def ReleaseKey(hexKeyCode):
    extra = ctypes.c_ulong(0)
    ii_ = Input_I()
    ii_.ki = KeyBdInput(0, hexKeyCode, 0x0008 | 0x0002, 0, ctypes.pointer(extra))
    x = Input(ctypes.c_ulong(1), ii_)
    ctypes.windll.user32.SendInput(1, ctypes.pointer(x), ctypes.sizeof(x))


while True:
    print(pointToClick)


    print("test")
    color = [getPixel(p1), getPixel(p2), getPixel(p3), getPixel(p4)]
    if color[0] == Colors and color[1] == Colors and color[2] == Colors and color[3] == Colors:
        win32api.SetCursorPos(pointToClick)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, pointToClick[0], pointToClick[1], 0, 0)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, pointToClick[0], pointToClick[1], 0, 0)
    if keyboard.is_pressed('q'):
        exit(1)
コード例 #36
0
 def right_click(cls, x, y):
     original_position = win32api.GetCursorPos()
     win32api.SetCursorPos((x, y))
     win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
     win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
     win32api.SetCursorPos(original_position)
コード例 #37
0
ファイル: main.py プロジェクト: sakuradied/Twitter-BOT
def fj():
    win32api.mouse_event(
        win32con.MOUSEEVENTF_RIGHTUP | win32con.MOUSEEVENTF_RIGHTDOWN, 0, 0, 0,
        0)
コード例 #38
0
def right(x, y):
    win32api.SetCursorPos((x, y))
    time.sleep(.5)
    win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, x, y, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, x, y, 0, 0)
コード例 #39
0
 def leftClick(self):
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
     time.sleep(.1)
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
コード例 #40
0
def mouseDown(x, y):
    global isMouseDown
    isMouseDown = True
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
コード例 #41
0
def mouseUp(x, y):
    global isMouseDown
    isMouseDown = False
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
コード例 #42
0
def Click(x=None, y=None, sleepTime=0.5):
    if not x is None and not y is None:
        mouse_move(x, y)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
    time.sleep(sleepTime)
コード例 #43
0
def ClickPos(pos, sleepTime=0.5):
    if not pos[0] is None and not pos[1] is None:
        mouse_move(pos[0], pos[1])
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
    time.sleep(sleepTime)
コード例 #44
0
def mouse_down(x, y, btn="left"):
    win.mouse_event(get_mouse_event(btn, "down"), x, y, 0, 0)
コード例 #45
0
def mouse_up(x, y, btn="left"):
    win.mouse_event(get_mouse_event(btn, "up"), x, y, 0, 0)
コード例 #46
0
ファイル: wiggler.py プロジェクト: jrightnow/wiggler
        else:
            motionless = False
        # when the cursor has been motionless long enough, wiggle it.
        if et > motionthreshold:
            if debug:
                print("~wiggle~"*3)
            # wiggle
            dt = 0
            while dt < wiggletime:
                dt = time.time() - currenttime
                # movement values in pixels
                xmove = int(wiggleintensity*(random.random() - 0.5))
                ymove = int(wiggleintensity*(random.random() - 0.5))
                currentposition[0] += xmove
                currentposition[1] += ymove
                # move cursor location
                win32api.SetCursorPos(currentposition)
                # trigger mouse event with zero relative offset
                win32api.mouse_event(mouseeventflags,0,0)
                time.sleep(wiggleperiod)
            motionless = False
    # if not in the 'motionless' state yet, check for motion and set starttime
    else:
        if currentposition == previousposition:
            motionless = True
            starttime = currenttime
            et = 0
    # update latest position and sample once per second
    previousposition = currentposition
    time.sleep(1)
コード例 #47
0
ファイル: gundongengine.py プロジェクト: SolaKami/yys3
def slide_up(x, y, h):
    m = PyMouse()
    m.move(x, y)
    win32api.mouse_event(win32con.MOUSEEVENTF_WHEEL, 0, 0, -h)
    return
コード例 #48
0
def click(x, y):
    win32api.SetCursorPos((x, y))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
    time.sleep(0.1)  #This pauses the script for 0.01 seconds
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
コード例 #49
0
ファイル: BOT.py プロジェクト: batman1724/bots
def click(x, y):
    win32api.SetCursorPos((x, y))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
    time.sleep(0.02)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
コード例 #50
0
ファイル: windows.py プロジェクト: Nivasb1/Smart-Camera
 def press(self, x, y, button=1):
     buttonAction = 2 ** ((2 * button) - 1)
     self.move(x, y)
     win32api.mouse_event(buttonAction, x, y)
コード例 #51
0
ファイル: windows.py プロジェクト: Nivasb1/Smart-Camera
 def release(self, x, y, button=1):
     buttonAction = 2 ** ((2 * button))
     self.move(x, y)
     win32api.mouse_event(buttonAction, x, y)
コード例 #52
0
def mouse_click(x=None, y=None):
    if not x is None and not y is None:
        mouse_move(x, y)
        time.sleep(random.random())
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
コード例 #53
0
ファイル: work.py プロジェクト: esjastad/temp
def tclick(loc):
    win32api.SetCursorPos(loc)  #move mouse to loc
    sleep(0.1)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, loc[0], loc[1], 0,
                         0)  #click left mouse button
    sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, loc[0], loc[1], 0,
                         0)  #release left mouse button
    sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, loc[0], loc[1], 0,
                         0)  #click left mouse button
    sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, loc[0], loc[1], 0,
                         0)  #release left mouse button
    sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, loc[0], loc[1], 0,
                         0)  #click left mouse button
    sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, loc[0], loc[1], 0,
                         0)  #release left mouse button
    sleep(0.05)
    user32.keybd_event(0x08, 0, 0, 0)  #Backspace press
    sleep(0.05)
    user32.keybd_event(0x08, 0, 2, 0)  #Backspace press
コード例 #54
0
ファイル: mouse_cont.py プロジェクト: dktobeno1/Spider_tips
def mouse_rclick(x=None, y=None):
    if not x is None and not y is None:
        mouse_move(x, y)
        time.sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
コード例 #55
0
def click(tup):
    x = tup[0]
    y = tup[1]
    SetCursorPos((x, y))
    mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
    mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0)
コード例 #56
0
 def click(self, x, y):
     x += self.BOX_LEFT
     y += self.BOX_TOP
     win32api.SetCursorPos((x,y))
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
コード例 #57
0
def click(x, y):
    win32api.SetCursorPos((x, y))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y, 0, 0)
コード例 #58
0
def hold_click(x,y,mouse_button):
    win32api.SetCursorPos((x,y))
    if mouse_button == 'left':
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
        time.sleep(10)
        win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
コード例 #59
0
def mouse_right_click(x=None, y=None):
    if not x is None and not y is None:
        mouse_move(x, y)
    win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
    win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
コード例 #60
-8
 def move_mouse(self, x,y, click):
     win32api.SetCursorPos((int(float(x)),int(float(y))))
     print(click)
     if (click == "1"):
         win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,int(float(x)),int(float(y)),0,0)
         win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,int(float(x)),int(float(y)),0,0)
         print("arman")