Ejemplo n.º 1
0
def _unpackXY(x, y):
    """If x is a sequence and y is None, returns x[0], y[0]. Else, returns x, y.

    On functions that receive a pair of x,y coordinates, they can be passed as
    separate arguments, or as a single two-element sequence.
    """
    if isinstance(x, str):
        # x parameter is the string of an image filename to find and click on:
        x, y = center(locateOnScreen(x))

    elif isinstance(x, collectionsSequence):
        if len(x) == 2:
            if y is None:
                x, y = x
            else:
                raise ValueError(
                    'When passing a sequence at the x argument, the y argument must not be passed (received {0}).'
                    .format(repr(y)))
        else:
            raise ValueError(
                'The supplied sequence must have exactly 2 elements ({0} were received).'
                .format(len(x)))
    else:
        pass  # x and y are just number values

    return x, y
Ejemplo n.º 2
0
 def complete(self):
     if pyscreeze.locateOnScreen(
             "./images/markers/{name}/{name}_completion.png".format(
                 name=self.name),
             region=(518, 856, 1406 - 518, 978 - 856)):
         return True
     else:
         return False
Ejemplo n.º 3
0
 def active(self):
     activity = pyscreeze.locateOnScreen(
         "./images/markers/{name}/{name}.png".format(name=self.name),
         region=(754, 112, 1162 - 754, 306 - 112))
     if activity:
         return True
     else:
         return False
Ejemplo n.º 4
0
 def click_png(self, png):
     if self.found_image(png):
         location = pyscreeze.locateOnScreen(png)
         if location:
             self.log('Found image %s' % png)
             center_x, center_y = pyscreeze.center(location)
             self.click_position(center_x, center_y)
     else:
         self.log('Could not find the image: %s' % png)
         raise Exception('Locate image %s failed.' % png)
Ejemplo n.º 5
0
def click_png(png):
    # location = pyautogui.locateOnScreen(png)
    location = pyscreeze.locateOnScreen(png)
    if location:
        print(location)
        log('Found image%s' % png)
        # center_x, center_y = pyautogui.locateCenterOnScreen(png)
        center_x, center_y = pyscreeze.center(location)
        click_position(center_x, center_y)
    else:
        # log('Could not find the image: %s' % png)
        raise Exception('Locate image %s failed.' % png)
Ejemplo n.º 6
0
def main():
    with open(vf) as f:
        playlists = f.read().splitlines()
    webbrowser.open("www.swagbucks.com")
    time.sleep(3)
    pyautogui.press('f11')
    pyautogui.hotkey('ctrl','w')
    time.sleep(5)
    for U in playlists:
        tcnt = 0
        done = False
        webbrowser.open(U)
        time.sleep(5)
        while done != True:
            err = pyscreeze.locateOnScreen('data/error.png',grayscale=True)
            kll =pyscreeze.locateOnScreen('data/kill.png',grayscale=True)
            if (err!= None or kll != None):
                print "found error"
                pyautogui.press('f5')
                time.sleep(10)
                err = pyscreeze.locateOnScreen('data/error.png',grayscale=True)
                kll =pyscreeze.locateOnScreen('data/kill.png',grayscale=True)
                if (err!= None or kll != None):
                    print "playlist: " + U + " seems unavalible at this time"
                    done = True
            nne = pyscreeze.locateOnScreen("data/viewall.png",grayscale=True)
            if (nne!= None and done != True):
                print "playlist: " +U+ " seems to have been removed from swagbucks"
                done = True
            dne = pyscreeze.locateOnScreen('data/fullbar.png',grayscale=True)
            if (dne!= None and done != True):
                print "playlist finished"
                done = True
            else:
                time.sleep(sleeptime)
            tks = list(pyscreeze.locateAllOnScreen("data/tick.png"))
            if (len(tks) >tcnt and done != True and Adv):
                print "advancing video"
                tmp = tks[len(tks)-1]
                pyautogui.click(tmp[0]+stp,tmp[1])
                time.sleep(5)
                tcnt = len(list(pyscreeze.locateAllOnScreen("data/tick.png")))


        pyautogui.hotkey('ctrl','w')
        pause = randint(minDelay,maxDelay)
        print "sleep for: " + str(pause) + "seconds"
        time.sleep(pause)
Ejemplo n.º 7
0
def _unpackXY(x, y):
    """If x is a sequence and y is None, returns x[0], y[0]. Else, returns x, y.

    On functions that receive a pair of x,y coordinates, they can be passed as
    separate arguments, or as a single two-element sequence.
    """
    if isinstance(x, str):
        # x parameter is the string of an image filename to find and click on:
        x, y = center(locateOnScreen(x))

    elif isinstance(x, collectionsSequence):
        if len(x) == 2:
            if y is None:
                x, y = x
            else:
                raise ValueError('When passing a sequence at the x argument, the y argument must not be passed (received {0}).'.format(repr(y)))
        else:
            raise ValueError('The supplied sequence must have exactly 2 elements ({0} were received).'.format(len(x)))
    else:
        pass # x and y are just number values

    return x, y
Ejemplo n.º 8
0
print("     K     ")
print("     E     ")
print("     R     ")

input0 = input("Would you Like to hack (C)ookie Clicker or (D)oge Clicker")

if input0 == "C":

    input1 = input(
        "Would you Like to (I)nfinity Tap or Tap the cookie a (S)pecified amount of times"
    )

    if input1 == "I":

        screen = pyscreeze.screenshot()
        cookie = pyscreeze.locateOnScreen('cookie.png')
        cookiex, cookiey = pyscreeze.center(cookie)

        pyautogui.moveTo(cookiex, cookiey)

        i = 0
        while True:
            pyautogui.click()
            time.sleep(0.0005)
            i += 1
            print(i)
    elif input1 == "S":
        input3 = int(input("Enter number of times cookie will be clicked"))

        screen = pyscreeze.screenshot()
        cookie = pyscreeze.locateOnScreen('cookie.png')
Ejemplo n.º 9
0
import pyscreeze
import time
from PIL import Image
'''
raw_input()input("Press Enter to continue...")
'''
if __name__ == "__main__":
    while True:
        location = pyscreeze.locateOnScreen('locate_window.png')
        print location
        if location:
            print location
            break

    x = location[0]
    y = location[1]
    width = location[2]
    height = location[3]
    height_compensation = 90
    y -= height_compensation
    height += height_compensation
    location_region = (x, y, width, height)
    time.sleep(1)

    for i in range(100):
        # screenshot every 0.5 second
        time.sleep(0.045)
        t1 = time.time()
        im = pyscreeze.screenshot(region=location_region)
        im_resize = im.resize((84, 84), Image.ANTIALIAS)
        im_gray = im_resize.convert('L')