示例#1
0
 def tour_date(self):
     x, y = m2['title']
     month = cf.take_screenshot(x + 327, y + 63 + self.index * 13, 13, 10)
     day = cf.take_screenshot(x + 342, y + 63 + self.index * 13, 15, 10)
     year = cf.take_screenshot(x + 358, y + 63 + self.index * 13, 27, 10)
     date_str = cf.turn_screenshots_into_date(month, day, year)
     if date_str != 'Nothing':
         return pd.to_datetime(date_str)
     else:
         return pd.to_datetime('1/1/2000')
示例#2
0
def confirm_tour_status(status):
    """Checks that the tour status is correct"""
    global errors
    pyautogui.click(m3['tour'])
    pyautogui.click(m3['accommodations'])
    x, y = m3['title']
    tour_status = sc.m3_tour_status[cf.take_screenshot(x + 37, y + 170, 94,
                                                       11)]
    if status == 'c' and tour_status not in [
            'Confirmed', 'Showed', 'On_Tour', 'No_Show'
    ]:
        print(u"\u001b[33;1m" + 'TOUR STATUS MIGHT BE INCORRECT' +
              u"\u001b[0m")
        errors += 1
    elif status == 'r' and tour_status not in ['Rescheduled', 'No_Tour']:
        print(u"\u001b[33;1m" + 'TOUR STATUS MIGHT BE INCORRECT' +
              u"\u001b[0m")
        errors += 1
    elif status == 'x' and tour_status not in ['Canceled']:
        print(u"\u001b[33;1m" + 'TOUR STATUS MIGHT BE INCORRECT' +
              u"\u001b[0m")
        errors += 1
    elif status in ['c', 'r', 'x']:
        print(u"\u001b[32m" + 'Tour Status - ' + tour_status + u"\u001b[0m")
    return tour_status
示例#3
0
def count_accommodations():
    sc.get_m3_coordinates()
    number_of_accommodations = 0
    number_of_canceled_accommodations = 0
    x, y = m3['title']
    while True:
        screenshot = cf.take_screenshot(x + 330, y + 64, 97, 7)
        if screenshot == sc.no_accommodations:
            return number_of_accommodations, number_of_canceled_accommodations
        else:
            screenshot_2 = cf.take_screenshot(x + 211, y + 66, 52, 5)
            if screenshot_2 == sc.canceled_accommodation:
                number_of_canceled_accommodations += 1
                y += 13
            else:
                number_of_accommodations += 1
                y += 13
示例#4
0
 def tour_type(self):
     x, y = m2['title']
     tour_type = cf.take_screenshot(x + 402, y + 63 + self.index * 13, 14, 10)
     try:
         tour_type = sc.m2_tour_types[tour_type]
     except KeyError:
         print('Unrecognized tour type')
         print(tour_type)
         tour_type = None
     return tour_type
示例#5
0
 def tour_status(self):
     x, y = m2['title']
     tour_status = cf.take_screenshot(x + 484, y + 63 + self.index * 13, 14, 10)
     try:
         tour_status_dict = cf.read_pickle_file('m2_tour_status.p')
         tour_status = tour_status_dict[tour_status]
     except KeyError:
         print('Unrecognized tour status')
         print(tour_status)
         tour_status = None
     return tour_status
示例#6
0
def count_items_in_deposit():
    sc.get_m6_coordinates()
    number_of_deposit_items = 0
    x, y = m6['title']
    while True:
        screenshot = cf.take_screenshot(x + 339, y + 189, 10, 8)
        if screenshot == sc.no_deposit_items:
            return number_of_deposit_items
        else:
            number_of_deposit_items += 1
            y += 13
示例#7
0
def add_premium_to_dictionary():
    global premium_dict
    sc.get_m3_coordinates()
    number_of_premiums = 0
    screenshot_number = 0
    pyautogui.click(m3['premiums'])
    x, y = m3['premium_1']
    image = pyautogui.locateCenterOnScreen(
        'C:\\Users\\Jared.Abrahams\\Screenshots\\issued.png',
        region=(514, 245, 889, 566))
    while image is None:
        image = pyautogui.locateCenterOnScreen(
            'C:\\Users\\Jared.Abrahams\\Screenshots\\issued.png',
            region=(514, 245, 889, 566))
    while True:
        screenshot = cf.take_screenshot(x - 223, y - 4, 90, 9)
        screenshot_number += 1
        try:
            screenshot = premium_dict[screenshot]
        except KeyError:
            pyautogui.click(x - 223, y - 4)
            pyautogui.click(m3['change_premium'])
            sc.get_m10_coordinates()
            time.sleep(1)
            pyautogui.doubleClick(m10['name'])
            keyboard.send('ctrl + z')
            keyboard.send('ctrl + c')
            # pyautogui.click(m3['change_premium'])
            copied_text = str(clipboard.paste())
            premium_dict[str(screenshot)] = copied_text
            f = open('text_files\\premiums.p', 'wb')
            pickle.dump(premium_dict, f)
            f.close()
            f = open('text_files\\premiums.p', 'rb')
            premium_dict = pickle.load(f)
            f.close()
            f = open('text_files\\premiums_backup.p', 'ab')
            pickle.dump(premium_dict, f)
            f.close()
            pyautogui.click(m10['ok'])
            image = pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\Titles\\changingpremium.png',
                region=(514, 245, 889, 566))
            while image is None:
                image = pyautogui.locateCenterOnScreen(
                    'C:\\Users\\Jared.Abrahams\\Screenshots\\issued.png',
                    region=(514, 245, 889, 566))
            time.sleep(0.5)
        if screenshot == 'Nothing':
            return number_of_premiums
        else:
            number_of_premiums += 1
            y += 13
示例#8
0
def add_note():
    sc.get_m3_coordinates()
    x, y = m3['title']
    pyautogui.click(x, y + 435)
    sc.get_m14_coordinates()
    sites_dictionary = read_pickle_file('sites.p')
    site = cf.take_screenshot(1517, 1036, 146, 17)
    if sites_dictionary[site] == 'Northstar':
        keyboard.write(' Blank')
    else:
        keyboard.write('Blank')
    pyautogui.click(m14['note'])
    keyboard.write(
        'Please refund by cash the charge is over 120 days and cannot be refunded back to CC.'
    )
    pyautogui.click(m14['ok'])
示例#9
0
def count_deposits():
    number_of_deposits = 0
    pyautogui.click(m3['tour_packages'])
    x, y = m3['title']
    image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\balance.png',
                                           region=(700, 245, 850, 566))
    while image is None:
        image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\balance.png',
                                               region=(700, 245, 850, 566))
    while True:
        # Counts number of deposits.
        # Breaks 'while' loop once a returned screenshot is blank
        deposit_screenshot = cf.take_screenshot(x + 255, y + 69, 6, 9)
        if deposit_screenshot == sc.no_deposits:
            return number_of_deposits
        else:
            number_of_deposits += 1
            y += 13
示例#10
0
def gather_m3_data():
    sc.get_m3_coordinates()
    x, y = m3['title']
    tour_types_dict = cf.read_pickle_file('m3_tour_type.p')
    m3_tour_type = tour_types_dict[cf.take_screenshot(x + 36, y + 143, 89, 12)]
    m3_tour_status = sc.m3_tour_status[cf.take_screenshot(
        x + 37, y + 170, 94, 11)]
    month = cf.take_screenshot(x + 37, y + 196, 13, 10)
    day = cf.take_screenshot(x + 52, y + 196, 15, 10)
    year = cf.take_screenshot(x + 68, y + 196, 27, 10)
    m3_date = cf.turn_screenshots_into_date(month, day, year)
    try:
        m3_date = datetime.datetime.strptime(m3_date, "%m/%d/%Y")
    except ValueError:
        month = cf.take_screenshot(x + 40, y + 196, 13, 10)
        day = cf.take_screenshot(x + 55, y + 196, 15, 10)
        year = cf.take_screenshot(x + 71, y + 196, 27, 10)
        m3_date = cf.turn_screenshots_into_date(month, day, year)
        m3_date = datetime.datetime.strptime(m3_date, "%m/%d/%Y")
    return m3_tour_type, m3_tour_status, m3_date
示例#11
0
def check_tour_type(number_of_tours, status):
    global errors
    sc.get_m3_coordinates()
    x, y = m3['title']
    tour_types_dict = cf.read_pickle_file('m3_tour_type.p')
    tour_type = tour_types_dict[cf.take_screenshot(x + 36, y + 143, 89, 12)]
    if 'u' in status and tour_type != 'Minivac':
        cf.print_colored_text('Can\'t upgrade day drive', 'red')
        errors += 1
    if 't' in status and tour_type != 'Day_Drive':
        cf.print_colored_text('TAVS are only for Day Drives.', 'red')
        errors += 1
    if (tour_type == 'Day_Drive' or tour_type == 'Canceled'
            or tour_type == 'Open_Reservation') and number_of_tours > 0:
        cf.print_colored_text(tour_type + ' - ' + str(number_of_tours), 'red')
        errors += 1
    elif tour_type == 'Minivac' and 'x' not in status and number_of_tours < 1:
        cf.print_colored_text(tour_type + ' - ' + str(number_of_tours), 'red')
        errors += 1
    else:
        log.info(tour_type + ' - ' + str(number_of_tours))
        cf.print_colored_text(tour_type + ' - ' + str(number_of_tours),
                              'green')
    return tour_type
示例#12
0
def notes(status):
    global errors
    sc.get_m3_coordinates()
    pyautogui.click(m3['notes'])
    x, y = m3['title']
    number_of_notes = 0
    image = pyautogui.locateCenterOnScreen(
        'C:\\Users\\Jared.Abrahams\\Screenshots\\note.png',
        region=(1045, 515, 50, 30))
    while image is None:
        image = pyautogui.locateCenterOnScreen(
            'C:\\Users\\Jared.Abrahams\\Screenshots\\note'
            '.png',
            region=(1045, 515, 50, 30))
    while cf.take_screenshot(x - 54, y + 58, 25, 10) != sc.note_nothing:
        number_of_notes += 1
        y += 13
    x, y = m3['notes']
    if number_of_notes == 0:
        print(u"\u001b[31m" + 'NO NOTES' + u"\u001b[0m")
        errors += 1
        return
    for note in range(number_of_notes):
        copied = []
        pyautogui.click(x, y + 40)
        pyautogui.click(m3['notes_change'])
        sc.get_m11_coordinates()
        x_2, y_2 = m11['title']
        # Take screenshot of note title
        screenshot = cf.take_screenshot_change_color(x_2 + 25, y_2 + 47, 28,
                                                     13)
        # Drag mouse cursor to select text in note.
        pyautogui.click(x_2 + 25, y_2 + 75)
        pyautogui.dragTo(x_2 + 250, y_2 + 150, button='left')
        # Copy Note
        keyboard.send('ctrl + c')
        r = Tk()
        result = r.selection_get(selection="CLIPBOARD")
        if result in copied:
            print(u"\u001b[31m" + 'COULDN\'T FIND CORRECT NOTE' + u"\u001b[0m")
            errors += 1
            pyautogui.click(x_2 + 200, y_2 + 250)
            return
        # for key, value in sol_numbers.items():
        #     words = re.findall(r'\w+', key)
        #     if words[1].lower() in result.lower() and words[1].lower() != 'major':
        #         print(u"\u001b[31m" + 'IMPORTANT NOTE' + u"\u001b[0m")
        if status == 'c' and 'conf' in result.lower():
            print(u"\u001b[32m" + 'Confirm note is present' + u"\u001b[0m")
            pyautogui.click(x_2 + 200, y_2 + 250)
            return
        elif status == 'x' and screenshot == sc.note_canc:
            print(u"\u001b[32m" + 'Cancel note is present' + u"\u001b[0m")
            pyautogui.click(x_2 + 200, y_2 + 250)
            if 'nq' in result.lower():
                pyautogui.click(m3['tour'])
                if pyautogui.locateCenterOnScreen(
                        'C:\\Users\\Jared.Abrahams\\Screenshots\\tour_result.png',
                        region=(514, 400, 889, 500)) is None:
                    print(u"\u001b[32m" + 'Tour Result is correct' +
                          u"\u001b[0m")
                else:
                    print(u"\u001b[31m" + 'NO TOUR RESULT' + u"\u001b[0m")
                    errors += 1
            return
        elif status == 'r' and any(
                i in result.lower()
                for i in ['rxl', 'reschedule', 'od', 'open', 'new date']):
            print(u"\u001b[32m" + 'Reschedule note is present' + u"\u001b[0m")
            pyautogui.click(x_2 + 200, y_2 + 250)
            return
        else:
            pyautogui.click(x_2 + 200, y_2 + 250)
            y += 13
    # If the for loop ends that means none of the notes fit the criteria above. An error message is then printed.
    print(u"\u001b[31m" + 'COULDN\'T FIND CORRECT NOTE' + u"\u001b[0m")
    errors += 1
    return