Monday, January 20, 2014

Simple mouse event simulator with python

This is a simple python script that simulates mouse clicks. This script can do click,double click and multi-click operations of both right and left mouse buttons. I used python win32api (which can download from here) for develop this script.

import win32api, win32con, time 

def left_click(x,y):
 win32api.SetCursorPos((x,y))#set position to given 
 win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)#push the left mouse button
 win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)#relese the left mouse button

def right_click(x,y):
 win32api.SetCursorPos((x,y))#set position
 win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN,x,y,0,0)#push the right mouse button
 win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP,x,y,0,0)#relese the right mouse button

def multiple_click(x,y,times,left):#run the clicks
 if(left):#if left mouse button need to be clicked
  for _ in range(times):#clicke n timese where n =times
   left_click(x,y)#call function left_click
   time.sleep(0.1)#delay between each click
 elif(not left):#if right mouse button need to be clicked
  for _ in range(times):#click n times where n =times
   right_click(x,y)#call right_click event
   time.sleep(0.1)#delay between each click

#call functions for double click left mouse button where x= 10 and y = 10
#call function for right click where x = 10 and y = 10

Sunday, January 5, 2014

Python 2.7 module Triangle appraiser version 1.0

“Triangle Appraiser”  module helps programmers to  manipulate triangles  by  illustrate  the  mathematical values with minimum effort meanwhile enhance those  values  with approximations and assumptions generating using fuzzy logic.

Since this is a big project i suppose to publish this project as several parts. This is the first part of it . You can download the relevant module (1st part) from the following link.


Download Triangle appraiser version 1.0 (Part 01- calculation helper)

Documentation related to above part is shown bellow 

Download PDF