#!/usr/bin/env python # -*- coding: utf-8 -*- ######################################### # USAGE: # line up 3x3 carpentry shops in an array. # view : double F8 fully zoomed in, first carpentry shop right in # the top left corner # Start the macro and click the first window when mousepointer # turns to +. # You may change the relative cords of this macro to sute other # purposes aswell. ######################################### import time # Needed for delays import LtMacroAPI # Needed for Click to work. import sys import Ltxtew import pyosd ###########This code is needed for LtMacro Kill funktion.### import os # # pid = str(os.getpid()) # pidfile = open("./ltmacros/running.pid", 'w') # pidfile.write(pid) # pidfile.close() # # ( ( windowID, x, y ), (rootwindow,rootx,rooty) ) = LtMacroAPI.getwindowclick()# ######################################### # number of shops (size of array of menus) nx = 3 ny = 3 runstotal = 20 # Make the Macro below this line. # size of a kettle menu wx = 280 wy = 280 # offset for moving the mouse over the carp shop begx = 50 begy = 50 # correction to take window's border into account begx = begx+rootx-x begy = begy+rooty-y ########### macro ####################" FONT = "-*-helvetica-*-r-normal--20-*-*-*-*-*-*-*" p = pyosd.osd(FONT, colour="#4040ff", shadow=2) p.set_shadow_offset(1) p.set_vertical_offset(2) p.set_pos(pyosd.POS_TOP) p.set_align(pyosd.ALIGN_CENTER) str='Please switch now to atitd windows during this 2s delay' print(str) p.display(str) time.sleep(2) runscount = 0 while runscount < runstotal: iy =0 while iy < ny: ix = 0 while ix < nx: px=(ix*wx)+begx py=(iy*wy)+begy Ltxtew.mouse("move", px,py) time.sleep(0.2) Ltxtew.key("click", "p") time.sleep(0.5) ix=ix+1 iy=iy+1 runscount=runscount+1 str='Done run %d out of %d total.' % (runscount,runstotal) print(str) p.display(str) str = 'Finished. Exiting...' print(str) p.display(str)