#!/usr/bin/env python # -*- coding: utf-8 -*- ######################################### # USAGE: # line up 5 Kettle Windows just next to each other. # Start the macro and click the first window when mousepointer # turns to +. # It will then click the other windows aswell at the same location. # # You may change the relative cords of this macro to sute other # purposes aswell. ######################################### #################### Template ############### # This is a Template, with funktions that all LtMacros should have! | #________________________________________________________________| import time # Needed for delays import LtMacroAPI # Needed for Click to work. ###########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 ), junk ) = LtMacroAPI.getwindowclick()# ######################################### # number of kettles (size of array of menus) nx = 5 ny = 3 # Make the Macro below this line. # size of a kettle menu wx = 170 wy = 275 # position of "flower fertiliser" button ffx = 45 ffy = 180 # For reference : position of other buttons # [X / Y] 45 125 # 155 Potash Weed Killer # 180 Flower fert Grain fert. # 205 == == # 230 Arsenic Salt # 255 Sulfur Acid # # position of begin button begx = 45 begy = 230 ########### macro ####################" iy =0 while iy < ny: ix = 0 while ix < nx: print 'starting kettle (',ix+1,',',iy+1,')' LtMacroAPI.clickwindow( (windowID, (ix*wx)+ffx,(iy*wy)+ffy)) time.sleep(0.2) LtMacroAPI.clickwindow( (windowID, (ix*wx)+begx,(iy*wy)+begy)) time.sleep(0.2) ix=ix+1 iy=iy+1 print 'Done. Now waiting for the process to end...' lx = ((nx-1)*wx)+begx ly = ((ny-1)*wy)+begy i1 = LtMacroAPI.getimage(windowID, lx,ly, 10, 10) same = True while same: # check the 10x10 image patch we selected above imgok=True try: i2 = LtMacroAPI.getimage(windowID, lx, ly, 10, 10) except LtMacroAPI.GetImageFailed: imgok=False print "window went out of view.. will try again later..." time.sleep(0.6) if ((not(LtMacroAPI.compare_raw_images(i1, i2))) and (imgok==True)): same=False time.sleep(0.6) iy =0 while iy < ny: ix = 0 while ix < nx: print 'grabbing stuff from kettle (',ix+1,',',iy+1,')' LtMacroAPI.clickwindow( (windowID, (ix*wx)+begx,(iy*wy)+begy)) time.sleep(0.5) ix=ix+1 iy=iy+1