コード例 #1
0
ファイル: game_input.py プロジェクト: pgarneau/bdo_slack_bot
def close_menu():
    title = window.focus_bdo()
    for _ in xrange(6):
        autoit.control_send(title, "", "{ESC}")
        time.sleep(1)

    left_click(COORDINATES.get("close_menu_button"))
コード例 #2
0
def upload(username, password, path, desc):
    #setup
    setup_phone(username, password)

    #upload the image
    print('UPLOAD')
    driver.find_element_by_xpath('//*[@id="react-root"]/section/nav[2]/div/div/div[2]/div/div/div[3]').click()
    time.sleep(2)

    #select image from the pc
    autoit.win_active("Apri") #open can change by your os language if not open change that
    time.sleep(2)
    autoit.control_send("Apri", "Edit1", path)
    time.sleep(1.5)
    autoit.control_send("Apri", "Edit1", "{ENTER}")
    time.sleep(3)
    print('Posting...')

    #adjust image
    driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
    driver.find_element_by_xpath('//*[@id="react-root"]/section/div[2]/div[2]/div/div/div/button[1]').click()
    time.sleep(1)
    driver.find_element_by_xpath('//*[@id="react-root"]/section/div[1]/header/div/div[2]/button').click()
    time.sleep(0.5)

    #set description
    driver.find_element_by_xpath('//*[@id="react-root"]/section/div[2]/section[1]/div[1]/textarea').send_keys(desc)

    #publish
    driver.find_element_by_xpath('//*[@id="react-root"]/section/div[1]/header/div/div[2]/button').click()
    driver.close()
コード例 #3
0
    def upload_image(self, file_path, description=''):
        # 1. Click upload image button
        print('Clicking `upload` button...')
        self.driver.find_element_by_xpath("//div[@role='menuitem']").click()
        time.sleep(2)

        # 2. Get the windows file explorer window that opened
        # Add the image path and click enter
        print('Uploading image to file explorer...')
        autoit.win_active("Open")
        autoit.control_send("Open", "Edit1", file_path)
        autoit.control_send("Open", "Edit1", "{ENTER}")
        time.sleep(2)

        # 3. Image should import and click Next button
        print('Image importing and processed to description...')
        self.driver.find_element_by_xpath('//*[@id="react-root"]/section/div[1]/header/div/div[2]/button').click()
        time.sleep(2)

        # 4. Add description
        print('Adding description...')
        self.driver.find_element_by_xpath('//*[@id="react-root"]/section/div[2]/section[1]/div[1]/textarea').click()
        self.driver.find_element_by_xpath('//*[@id="react-root"]/section/div[2]/section[1]/div[1]/textarea').send_keys(description)
        time.sleep(2)

        # 5. CLick Share
        print('Clicking `Share`!')
        if self.dry_run:
            print('DRY RUN IS ENABLED! - Therefore, not actually posting to IG.')
        else:
            self.driver.find_element_by_xpath('//*[@id="react-root"]/section/div[1]/header/div/div[2]/button').click()
        time.sleep(4)
        print('Upload completed.')
コード例 #4
0
def upload(driver,phototext, photopath):

    driver.find_element_by_xpath("//div[@role='menuitem']").click()
    time.sleep(1.5)
    
    autoit.win_active("Open") #open can change by your os language if not open change that
    time.sleep(2)
    autoit.control_send("Open", "Edit1", photopath)
    time.sleep(1.5)
    autoit.control_send("Open", "Edit1", "{ENTER}")
    time.sleep(2)
    driver.find_element_by_xpath("//*[@id='react-root']/section/div[1]/header/div/div[2]/button").click()
    time.sleep(1)
    
    ta= driver.find_elements(By.XPATH, '//textarea')
    
    for part in phototext.split('\n'):
        pp (part)
        if part:
            ta[0].send_keys(part)
            ActionChains(driver).key_down(Keys.SHIFT).key_down(Keys.ENTER).key_up(Keys.SHIFT).key_up(Keys.ENTER).perform()
        else:
            pass
    time.sleep(1)
        
    driver.find_element_by_xpath("//*[@id='react-root']/section/div[1]/header/div/div[2]/button").click()
コード例 #5
0
def Cliente(Tipo, Cod):
    log.EscreverLog('Função Cliente ')
    #Tempo.TempoL()
    #if(autoit.win_wait("[CLASS:TFRM_FINALVENDA]"))==1:
    Variaveis.Retorno = 0
    while Variaveis.Retorno == 0:
        Variaveis.Retorno = autoit.control_focus("[CLASS:TFRM_FINALVENDA]",
                                                 "TRzDBButtonEdit6")
        Tempo.Loop()
    #else:
    #    Tempo.TempoL()
    try:
        #Tempo.TempoL()
        autoit.control_send("[CLASS:TFRM_FINALVENDA]", "TRzDBButtonEdit6",
                            str(Cod))
        Tempo.Dig()
        log.EscreverLog('Passamdo codigo do Cliente:' + str(Cod))
        for x in range(0, 2):
            Tecla.Enter()
        if Tipo == "TP" or Tipo == "TC":
            if Tipo == "P":
                SENHACLIBLOQ.SENHACLIBLOQ()
            if Tipo == "C":
                time.sleep(Variaveis.TConvenio)
                SENHAEMPBLOQ.SENHAEMPBLOQ()
                SENHACLIBLOQ.SENHACLIBLOQ()
                SENHALIMITECREDITO.SENHALIMITECREDITO()
    except:
        log.EscreverLog('Erro Função Cliente')

    log.EscreverLog('Sai Função Cliente')
コード例 #6
0
def mail():
    try:
        time.sleep(soft_wait)
        driver.find_element(By.XPATH, "//*[contains(text(), 'Email')]").click()
        time.sleep(long_wait)
        driver.find_element(By.XPATH,
                            '//*[@class="ql-editor ql-blank"]').click()
        time.sleep(soft_wait)
        keyboard.write(message)
        time.sleep(soft_wait)

        # click on Add photo
        time.sleep(soft_wait)
        driver.find_element(By.XPATH,
                            "//*[contains(text(), 'Add Photo')]").click()
        time.sleep(soft_wait)

        # enter the location of the image file you want send in next line
        autoit.control_set_text("Open", "Edit1",
                                r"D:\ME\c dfrive\New folder\557421.jpg")
        autoit.control_send("Open", "Edit1", "{ENTER}")
        time.sleep(soft_wait)

        driver.find_element(By.XPATH, "//*[contains(text(), 'Send')]").click()
        time.sleep(long_wait)
    except:
        pass
コード例 #7
0
 def file_upload_india(self):
     autoit.win_active("Open")
     autoit.control_set_text(
         "Open", "Edit1",
         r"C:\selenium_scripts\upload\AppointmentUpload_IND.xlsx")
     autoit.control_send("Open", "Edit1", "{ENTER}")
     time.sleep(2)
コード例 #8
0
ファイル: Estorno.py プロジェクト: bopopescu/DevsON
def Estorno(Num):
    autoit.send('Entra Função Estorno')
    FuncoesBD.LocalizaCupom(Num)
    if Variaveis.Retorna == 'S':
        autoit.send("{ALTDOWN}x{ALTUP}")
        SENHAFUNC.SENHAFUNC()
        try:
            log.EscreverLog('Estorno de Venda')
            autoit.win_wait_active("[Class:TFRM_ESTORNO]", Variaveis.TTela)
            autoit.control_send("[CLASS:TFRM_ESTORNO]", "TRzNumericEdit1",
                                str(Variaveis.LocCupom))
            time.sleep(Variaveis.TDig)
            autoit.control_click("[CLASS:TFRM_ESTORNO]", "TRzBitBtn2")
            time.sleep(Variaveis.TDig)
            autoit.control_click("[CLASS:TFRM_ESTORNO]", "TVSMDBGrid1")
            time.sleep(Variaveis.TDig)
            autoit.send("{SPACE}")
            time.sleep(Variaveis.TDig)
            autoit.control_click("[CLASS:TFRM_ESTORNO]", "TRzBitBtn1")
            time.sleep(Variaveis.TAlertaB)
            autoit.send("{ENTER}")
            time.sleep(Variaveis.TAlertaB)
            autoit.send("{ENTER}")
        except:
            log.EscreverLog('Erro')
    else:
        log.EscreverLog('Cupom não encontrado')
    log.EscreverLog('Sai Função Estorno')
コード例 #9
0
ファイル: instagram_bot.py プロジェクト: Anstroy/instabot
def uploadLocalPhotoWithCaption(path_to_photo, caption):
    # example: path_to_photo = r"C:\images\something.png"
    print('⬆️ ⬆️ Uploading Local Photo ⬆️ ⬆️ ⬆️')
    goToMainPage()
    dismissPopup()

    print('Clicking add button')
    driver.find_element_by_xpath(
        '//*[@id="react-root"]/section/nav[2]/div/div/div[2]/div/div/div[3]'
    ).click()

    sleep(1.5)
    print('Openning File browser')
    autoit.win_active("Open")
    sleep(2)
    print('Typing image path')
    autoit.control_send("Open", "Edit1", path_to_photo)
    sleep(1.5)
    print('Submitting image')
    autoit.control_send("Open", "Edit1", "{ENTER}")
    sleep(2)

    print('Going for next step')
    next_btn = driver.find_element_by_xpath(
        "//button[contains(text(),'Next')]").click()

    sleep(1.5)
    print('Adding caption')
    caption_field = driver.find_element_by_xpath(
        "//textarea[@aria-label='Write a caption…']")
    caption_field.send_keys(caption)

    print('Sharing image')
    share_btn = driver.find_element_by_xpath(
        "//button[contains(text(),'Share')]").click()
コード例 #10
0
    def test_CDR(self):
        homepage = Homepage(self.driver)
        homepage.navigate()
        signup_form = homepage.getSignupForm()
        signup_form.setName("admin", "brijesh84")

        autoit.run("C:\Program Files (x86)\Zoiper\Zoiper.exe")
        autoit.win_wait_active("Zoiper", 5)
        autoit.control_send("Zoiper", "Edit1", "121919898222221")
        time.sleep(5)
        autoit.send("{ENTER}")

        time.sleep(60)

        time.sleep(5)
        self.driver.find_element_by_css_selector(
            "li.monitoring > a > div.menu_name").click()
        time.sleep(5)
        self.driver.find_element_by_link_text("CDR Trace").click()
        time.sleep(3)
        self.driver.find_element_by_id("rdoCdrSearchType-1").click()
        self.driver.find_element_by_id("txtCustomerIPAddress").send_keys(
            "192.168.20.155")
        self.driver.find_element_by_id("cdrtracesearch").click()
        time.sleep(5)
        temp = "CDR_Print"
        self.driver.save_screenshot("%s.png" % (temp))
コード例 #11
0
ファイル: postImage.py プロジェクト: index-zer0/insta-lib
def post(user, password, image, caption):
    if os.name != 'nt':
        keyboard = Controller()
    driver = login(user, password)
    driver.find_element_by_xpath("//div[@role='menuitem']").click()
    passed = False
    while passed == False:
        passed = True
        try:
            if os.name == 'nt':
                autoit.win_active("Open")
                sleep(1)
                autoit.control_send("Open","Edit1",image)
                sleep(1)
                autoit.control_send("Open","Edit1","{ENTER}")
                sleep(0.5)
            else:
                keyboard.type(image)
                sleep(1)
                keyboard.press(Key.enter)
                keyboard.release(Key.enter)
                sleep(0.5)
        except:
            passed = False
            sleep(0.5) 
    passed = False
    while passed == False:
        passed = True
        try:
            driver.find_element_by_xpath("//button[@class='pHnkA']").click()
            sleep(0.5)
        except:
            passed = False
            sleep(0.5)
    passed = False
    while passed == False:
        passed = True
        try:
            driver.find_element_by_xpath("//button[contains(text(),'Next')]").click()
            sleep(0.5)
        except:
            passed = False
            sleep(0.5)
    passed = False
    while passed == False:
        passed = True
        try:
            write_a_caption = driver.find_element_by_xpath("//textarea[@aria-label='Write a caption…']")
        except:
            passed = False
            sleep(0.5)
    sleep(0.5)
    write_a_caption.send_keys(caption)
    sleep(0.5)
    exit()
    driver.find_element_by_xpath("//button[contains(text(),'Share')]").click()
    sleep(10)
    driver.close()
コード例 #12
0
 def download_image(self):
     self.button_choose = self.find.element_by_xpath(lk_conf.button_choose_xpath).click()
     sleep(1)
     autoit.win_wait(lk_conf.autoit_title, lk_conf.autoit_wait)
     autoit.control_focus(lk_conf.autoit_title, lk_conf.autoit_control_edit)
     autoit.control_send(lk_conf.autoit_title, lk_conf.autoit_control_edit, lk_conf.autoit_image_path)
     autoit.control_click(lk_conf.autoit_title, lk_conf.autoit_control_button)
     self.find.element_by_xpath(lk_conf.button_download_xpath).click()
     sleep(3)
コード例 #13
0
def handle_dialog(picName):
    attempts = 0
    while attempts <= 5:
        try:
            autoit.control_focus("Open", "Edit1")
            autoit.control_set_text("Open","Edit1",picName)
            autoit.control_send("Open","Edit1","{ENTER}")
            break
        except:
            sleep(.3)
コード例 #14
0
 def send_text(self, locator, text):
     """
     Enters text in an input element identified by locator
     :param locator: user defined name from map files
     :param text: text which you want to enter
     Ex: send_text("locator_name", "hello")
     """
     locator = self.__get_locator_for_tool(locator)
     window_identifier, control_identifier = mapMgr.__getitem__(
         locator)["IDENTIFIERS"].strip("'").split(",")
     autoit.control_send(window_identifier, control_identifier.strip('"'),
                         text)
コード例 #15
0
def run():
    window = bring_bdo_top(refresh_wins())
    print(window)
    some_var = autoit.win_active(window)
    print(some_var)
    some_var_2 = autoit.win_activate(window)
    print(some_var_2)
    some_var = autoit.win_active(window)
    print(some_var)
    some_var = autoit.win_get_handle(window)
    time.sleep(2)
    autoit.control_send(window, "", "r")
コード例 #16
0
ファイル: main.py プロジェクト: lescpsn/AutoRobot
def main():
    print("Enter main:")

    print("*************** t101:")

    autoit.run("notepad.exe")
    autoit.win_wait_active("[CLASS:Notepad]", 3)
    autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}")
    autoit.win_close("[CLASS:Notepad]")
    autoit.control_click("[Class:#32770]", "Button2")

    print("Level main:")
コード例 #17
0
ファイル: Bot.py プロジェクト: segadevelop/l2bot
    def findTarget(self):
        img = self.getScreen(self.leftCornerx,self.leftCornery,self.x2,self.y2)
        cv2.rectangle(img, (582, 407), (1100, 750), [0, 0, 0], -1)
        cv2.rectangle(img, (0, 0), (520, 77), [0, 0, 0], -1)
        # cv2.imshow("images", img)
        # cv2.waitKey(0)
        # bla()
        colorMin = [255, 131, 86]
        colorMax = [255, 167, 108]
        mask = cv2.inRange(img, array(colorMin, dtype='uint8'), array(colorMax, dtype='uint8'))
        mask = cv2.filter2D(mask,-1, ones((5,5), float32))
        (cnts, hierarchy) = cv2.findContours(mask,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
        colorMin = [166, 228, 154]
        colorMax = [169, 232, 156]
        mask = cv2.inRange(img, array(colorMin, dtype='uint8'), array(colorMax, dtype='uint8'))
        mask = cv2.filter2D(mask,-1, ones((15,15), float32))
        (cnts, hierarchy) = cv2.findContours(mask,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
        cnts = sorted(cnts, key=lambda cnt: self.contourHeight(cnt), reverse=True);        
        # cv2.drawContours(img, cnts, -1, (255,0,0), 3)
        # cv2.imshow("images", img)
        # cv2.waitKey(0)
        # bla()
        for cnt in cnts:
            x,y,w,h = cv2.boundingRect(cnt)
            left = list(cnt[cnt[:,:,0].argmin()][0])        
            right = list(cnt[cnt[:,:,0].argmax()][0])
            print 'left x' + str(left[0])+ 'y '+ str(left[1])
            print 'right x' + str(right[0])+ 'y '+ str(right[1])
            if right[0] - left[0] < 20:
                print 'Small diff ' + str(right[0] - left[0])
                continue
            x,y,w,h = cv2.boundingRect(cnt)
            test = self.getScreen(x,y+h,x+w,y+200)
            cv2.imwrite('tgt/' + str(int(time.time())) + '_not_chmp.png',test)

            center = round((right[0]+left[0]+3)/2)
            center = int(center)
            self.moveMouse(center,left[1]+90)
            self.sleep(0.3,0.5)
            autoit.control_send(self.title, '', '{F3}', 0)
            res = self.findHP();
            if res > 0:
                autoit.control_send(self.title, '', '{F1}', 0)
                self.sleep(0.1,0.4)
                return

            if (self.findFromTargeted(left, right)):
                autoit.mouse_click('left', center, left[1]+90)
                self.sleep(0.1,0.3)
                autoit.mouse_click('left', center, left[1]+90)
                return True
        self.mouseRotate()
コード例 #18
0
 def send_key(self, locator, key):
     """
     Press any key on an element identified by locator
     :param locator: user defined name from map files
     :param key: key which you want to press
     Ex: send_key("locator_name", "ENTER")
     """
     locator = self.__get_locator_for_tool(locator)
     window_identifier, control_identifier = mapMgr.__getitem__(
         locator)["IDENTIFIERS"].strip("'").split(",")
     key = "{%s}" % key
     autoit.control_send(window_identifier, control_identifier.strip('"'),
                         key)
コード例 #19
0
def upload(filename, old_uploader_url, file_window_title, file_folder):
    driver.get(old_uploader_url)
    time.sleep(10)
    upload_btn = driver.find_element_by_id('start-upload-button-single')
    hover = ActionChains(driver).move_to_element(upload_btn)
    time.sleep(3)
    hover.click().perform()
    time.sleep(3)
    autoit.win_active(file_window_title)
    filename = file_folder + filename
    autoit.control_send(file_window_title, "Edit1", filename)
    autoit.control_send(file_window_title, "Edit1", "{ENTER}")
    time.sleep(10)
    driver.find_elements_by_class_name('save-changes-button')[0].click()
コード例 #20
0
def post():
    print("Adding post")

    # Readies the content for instagram
    with open('filesDict.json', encoding="utf8") as json_file:

        # loads the data from the queue (filesDict.json)
        data = json.load(json_file)

        # if not empty
        if bool(data):

            # gets first item in filesDict.json and sets it as the next instagram upload
            # also sets the image path and caption
            image_path = os.getcwd(
            ) + "\\images\\" + data['dict'][0]['id'] + ".jpg"
            caption = data['dict'][0]['title']

            # Loops and removes the first item since it has just been uploaded
            for i in range(len(data)):
                if data['dict'][i]["id"] == data['dict'][0]['id']:
                    del data['dict'][i]
                    break

            # saves file without first item
            with open('filesDict.json', 'w', encoding="utf8") as outfile:
                json.dump(data, outfile)

    # Opens File Explore window
    print("Opening file explorer")
    autoit.win_active("Open")
    autoit.control_set_text("Open", "Edit1", image_path)
    autoit.control_send("Open", "Edit1", "{ENTER}")
    sleep(settings.wait_time)

    # depending on aspect ratio, sometimes this button does not exist
    try:
        driver.find_element_by_xpath(
            "//span[contains(text(),'Expand')]").click()
    except:
        pass
    sleep(settings.wait_time)

    # clicks through options and adds caption after file is added
    driver.find_element_by_xpath("//button[contains(text(),'Next')]").click()
    sleep(settings.wait_time)
    caption_field = driver.find_element_by_xpath(
        "//textarea[@aria-label='Write a caption…']")
    caption_field.send_keys(caption)
    driver.find_element_by_xpath("//button[contains(text(),'Share')]").click()
コード例 #21
0
def SENHACLIBLOQ():
    try:
        log.EscreverLog('Valida se cliente esta bloqueado')
        Variaveis.Tempo = 0.50
        log.EscreverLog('Timer ' + str( Variaveis.Tempo))
        autoit.win_wait_active("[Class:TFRM_SENHACLIBLOQ]", Variaveis.Tempo)
        log.EscreverLog('Pede Senha')
        Tempo.Dig()
        autoit.control_send("[Class:TFRM_SENHACLIBLOQ]", "TRzButtonEdit1", Variaveis.SenhaAdmin)
        log.EscreverLog('Passa Senha')
        Tecla.Enter()
        log.EscreverLog('Senha Ok')
    except:
        log.EscreverLog('Não esta bloqueado')
コード例 #22
0
def Upload_Test():
    driver.get("file:///C:/Users/Administrator/Desktop/web_test/index.html")
    driver.implicitly_wait(3)
    driver.find_element_by_id("file").click()
    sleep(3)
    autoit.control_send(
        u"文件上传", "Edit1",
        "C:\\Users\\Administrator\\Desktop\\upload\\upload.png")
    sleep(1)
    autoit.control_click(u"文件上传", "Button1")  # 确定
    sleep(1)
    driver.find_element_by_xpath("//input[@id='file']").send_keys(
        "C:\\Users\\Administrator\\Desktop\\upload\\upload1.png")
    sleep(1)
    driver.quit()
コード例 #23
0
def SENHALIMITECREDITO():
    try:
        log.EscreverLog('Valida se o cliente tem limite')
        log.EscreverLog('Tempo. : ' + str(Variaveis.TAlertaM) + 'segundos')
        autoit.win_wait_active("[Class:TFRM_SENHALIMITECREDITO]",
                               Variaveis.TTela)
        Tecla.TempoR()
        log.EscreverLog('Pede Senha')
        autoit.control_send("[Class:TFRM_SENHALIMITECREDITO]",
                            "TRzButtonEdit1", Variaveis.SenhaAdmin)
        log.EscreverLog('Passa Senha')
        Tecla.Enter()
        log.EscreverLog('Senha Ok')
    except:
        log.EscreverLog('Cliente com limite disponivel')
コード例 #24
0
ファイル: autoit_kubios.py プロジェクト: skjerns/NT1-HRV
def extract_rr(filename):
    pid = autoit.run("C:/Program Files/Kubios/Kubios HRV Standard/kubioshrv.exe")
    
    # wait until screen is loaded
    assert autoit.win_wait_active(f"[TITLE:{kubios_title}]", 30)
    time.sleep(0.25)
    
    # get position and click menu->open
    x, y, _, _ = autoit.win_get_pos(f"[TITLE:{kubios_title}]")
    assert autoit.mouse_click(x=x+20, y=y+50, speed=10)
    time.sleep(0.5)
    assert autoit.mouse_click(x=x+20, y=y+70, speed=10)
    
    # wait for loading of file input screen
    assert autoit.win_wait_active(f"[TITLE:{title_open}]", 30)
    time.sleep(0.25)
    assert autoit.control_send(f"[TITLE:{title_open}]", "[CLASS:Edit]", filename)
    time.sleep(0.25)
    assert autoit.control_click(f"[TITLE:{title_open}]", "[CLASS:Button; INSTANCE:1]")
    time.sleep(1)
    
    # check if there was an error (if Open Data File is still there)
    assert not autoit.win_active(f"[TITLE:{title_open}]"), 'Failed to load!'
    
    assert os.system(f"taskkill /PID {pid} /F")==0
コード例 #25
0
ファイル: f1.py プロジェクト: segadevelop/l2bot
def main():
    bot = Bot()
    wincount = sys.argv[1]
    autoit.win_wait(bot.title, 5)
    counter = 0
    cycle = True
    while cycle:
        print 'send'
        for count in range(1, int(wincount) + 1):
            title = "[TITLE:Lineage II; INSTANCE:" + str(count) + "]"
            autoit.control_send(title, '', '{F1}', 0)
            bot.sleep(0.1, 0.3)
            autoit.control_send(title, '', '{F1}', 0)
            bot.sleep(0.7, 1.3)
            print 'title ', title
        bot.sleep(0.3, 0.8)
コード例 #26
0
ファイル: f1.py プロジェクト: oyajiro/l2bot
def main():
    bot = Bot()
    wincount = sys.argv[1]
    autoit.win_wait(bot.title, 5)
    counter = 0
    cycle = True
    while cycle:
        print 'send'
        for count in range(1, int(wincount)+1):
            title = "[TITLE:Lineage II; INSTANCE:" + str(count) + "]"
            autoit.control_send(title, '', '{F1}', 0)
            bot.sleep(0.1,0.3)
            autoit.control_send(title, '', '{F1}', 0)
            bot.sleep(0.7,1.3)
            print 'title ', title
        bot.sleep(0.3,0.8)
コード例 #27
0
def Vendedor(Doc,Tipo) :
    #if(autoit.win_wait("[CLASS:TFRM_FINALVENDA]"))==1:
    Variaveis.Retorno = 0
    while Variaveis.Retorno  == 0:
        Variaveis.Retorno = autoit.control_focus("[CLASS:TFRM_FINALVENDA]", "TRzDBButtonEdit1")
        Tempo.Loop()
        Tecla.LimpaTexto()

    #Tempo.Dig()
    log.EscreverLog('Função Vendedor')
    if Variaveis.CodVendedor == '0':
        sSql =  'SELECT  ' \
                'V.CODVEND ' \
                'FROM myouro.VENDEDORES V ' \
                'WHERE V.SITUACAO ="A" AND ' \
                '( V.BLOQUEARVENDA_EMOUTRALOJA = "N" ' \
                'OR V.CODLOJA =' + str(Variaveis.CodLoja) + ')' \
                'ORDER BY RAND() LIMIT 0,1'

        log.EscreverLog('Executando Sql:' + str(sSql))

        Resultado = FuncoesBD.ComDBSlave.Select(sSql)
        if Resultado.__len__() > 0:
            Result = Resultado[0]
            Variaveis.CodVendedor = str(Result[0])
    Tempo.ClickFinalVenda()

    autoit.control_click("[CLASS:TFRM_FINALVENDA]", "TRzDBButtonEdit1")

    Tecla.LimpaTexto()
    Tempo.TeclaAcao()
    log.EscreverLog('Vendedor :' + str(Variaveis.CodVendedor))
    autoit.send(str(Variaveis.CodVendedor))
    Tecla.Enter()


    if Doc == "ORC":
        Tempo.TelaAcao()
        autoit.win_wait_active("[Class:TFRM_SENHAFUNC]", Variaveis.Tempo)

        log.EscreverLog('Senha Libera Orcamento')
        autoit.control_send("[CLASS:TFRM_SENHAFUNC]", "TRzButtonEdit1", Variaveis.SenhaAdmin)
        Tempo.Dig()
        Tecla.Enter()
    Tempo.TempoR()
    log.EscreverLog('Sai Função Vendedor')
コード例 #28
0
def MarcarPosVenda():
    time.sleep(Variaveis.TEnter)
    log.EscreverLog('Pos Venda')
    autoit.send("{CTRLDOWN}p{CTRLUP}")
    time.sleep(Variaveis.TDig)
    autoit.win_wait_active("[Class:TFRM_DADOSPOSVENDA]", Variaveis.TTelaL)
    time.sleep(Variaveis.TEnter)
    autoit.control_send("[Class:TFRM_DADOSPOSVENDA]", "TRzDBSpinEdit1", "30")
    time.sleep(Variaveis.TDig)
    time.sleep(Variaveis.TEnter)
    autoit.control_send("[Class:TFRM_DADOSPOSVENDA]", "TRzDBSpinEdit2", "1")
    time.sleep(Variaveis.TDig)
    time.sleep(Variaveis.TEnter)
    autoit.control_click("[Class:TFRM_DADOSPOSVENDA]", "TRzBitBtn2")
    time.sleep(Variaveis.TEnter)
    autoit.send("{ENTER}")
    time.sleep(Variaveis.TEnter)
コード例 #29
0
ファイル: necr.py プロジェクト: segadevelop/l2bot
def main():
    autoit.win_wait(title, 5)
    counter = 0
    cycle = True
    while cycle:
        hpstatus = checkOwnHp()
        mpstatus = checkOwnMp()
        print 'hps ' + str(hpstatus)
        print 'mps ' + str(mpstatus)
        if mpstatus == 1:
            autoit.control_send(title, '', '{F11}', 0)

        if hpstatus == -1:
            print 'CPDamage'
            cv2.imwrite('CPDamage' + str(int(time.time())) + '.png',
                        getScreen(leftCornerx, leftCornery, x2, fullY2))
            # autoit.win_kill(title)
            cycle = False
        if hpstatus == 0:
            print 'Dead'
            cv2.imwrite('Dead' + str(int(time.time())) + '.png',
                        getScreen(leftCornerx, leftCornery, x2, fullY2))
            cycle = False
        if hpstatus == 1:
            autoit.control_send(title, '', '{F5}', 0)

        img = getScreen(leftCornerx, leftCornery, x2, y2)
        res = findHP(img)
        print 'tgs ' + str(res)

        if res > 0:
            autoit.control_send(title, '', '{F1}', 0)
            counter = 0
        else:
            if counter == 0:
                autoit.control_send(title, '', '{F3}', 0)
                sleep(0.1, 0.3)
                autoit.control_send(title, '', '{F1}', 0)

            counter += 1
            if counter >= 1:
                findTarget()
                # autoit.control_send(title, '', '{F11}', 0)
                counter = 0
        print 'cnt ' + str(counter)
    pass
コード例 #30
0
def post(jpg_to_post):
    print("enter post()")

    mobile_emulation = {"deviceName": "Nexus 5"}
    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
    driver = webdriver.Chrome(
        ChromeDriverManager().install(),
        desired_capabilities=chrome_options.to_capabilities())
    driver.get('https://www.instagram.com/accounts/login/')
    time.sleep(2)
    user_name = driver.find_element_by_xpath("//input[@name='username']")
    user_name.send_keys('Here Put your username or email')
    password = driver.find_element_by_xpath("//input[@name='password']")
    password.send_keys('Here put your Password')
    password.submit()
    #driver.find_element_by_xpath("//*[@class='sqdOP  L3NKy   y3zKF']").click()
    time.sleep(5)
    driver.find_element_by_xpath("//button[text()='Not Now']").click()
    time.sleep(5)
    driver.find_element_by_xpath("//button[text()='Cancel']").click()
    time.sleep(2)
    driver.find_element_by_xpath("//div[@role='menuitem']").click()
    time.sleep(2)
    autoit.win_active("Open")
    autoit.control_set_text("Open", "Edit1", jpg_to_post)
    autoit.control_send("Open", "Edit1", "{ENTER}")
    time.sleep(2)
    try:
        driver.find_element_by_xpath("//button[@class='_j7nl9']").click()
    except Exception:
        pass
    time.sleep(2)
    driver.find_element_by_xpath("//button[contains(text(),'Next')]").click()
    time.sleep(2)
    caption_field = driver.find_element_by_xpath(
        "//textarea[@aria-label='Write a caption…']")
    caption_field.send_keys(caption)
    time.sleep(2)
    #driver.find_element_by_xpath("//*[@class='_qlp0q']").send_keys(Keys.CONTROL, 'v')
    #time.sleep(2)
    driver.find_element_by_xpath("//button[contains(text(),'Share')]").click()
    time.sleep(5)

    driver.quit()
コード例 #31
0
ファイル: cp.py プロジェクト: oyajiro/l2bot
def main():
    autoit.win_wait(title, 5)
    cycle = True
    while cycle:
        cpstatus = checkOwnCp()
        hpstatus = checkOwnHp()
        print 'cp ' + str(cpstatus)
        print 'hp ' + str(hpstatus)
        if cpstatus == 0:
            if hpstatus == 0:
                print 'Dead'
                cv2.imwrite('Dead' + str(int(time.time())) + '.png',getScreen(leftCornerx,leftCornery,x2,fullY2))
                cycle = False
        if cpstatus < 2:
            if hpstatus > 0:
                autoit.control_send(title, '', '{F8}', 0)
                sleep(0.8,1.5)
    pass
コード例 #32
0
ファイル: necr.py プロジェクト: oyajiro/l2bot
def main():
    autoit.win_wait(title, 5)
    counter = 0
    cycle = True
    while cycle:
        hpstatus = checkOwnHp()
        mpstatus = checkOwnMp()
        print 'hps ' + str(hpstatus)
        print 'mps ' + str(mpstatus)
        if mpstatus == 1:
            autoit.control_send(title, '', '{F11}', 0)

        if hpstatus == -1:
            print 'CPDamage'
            cv2.imwrite('CPDamage' + str(int(time.time())) + '.png',getScreen(leftCornerx,leftCornery,x2,fullY2))
            # autoit.win_kill(title)
            cycle = False
        if hpstatus == 0:
            print 'Dead'
            cv2.imwrite('Dead' + str(int(time.time())) + '.png',getScreen(leftCornerx,leftCornery,x2,fullY2))
            cycle = False
        if hpstatus == 1:
            autoit.control_send(title, '', '{F5}', 0)

        img = getScreen(leftCornerx,leftCornery,x2,y2)
        res = findHP(img);
        print 'tgs ' + str(res)

        if res > 0:
            autoit.control_send(title, '', '{F1}', 0)
            counter = 0
        else:
            if counter == 0:
                autoit.control_send(title, '', '{F3}', 0)
                sleep(0.1,0.3)
                autoit.control_send(title, '', '{F1}', 0)

            counter += 1
            if counter >= 1:
                findTarget()
                # autoit.control_send(title, '', '{F11}', 0)
                counter = 0
        print 'cnt ' + str(counter)
    pass
コード例 #33
0
ファイル: q_prores.py プロジェクト: afrocircus/q_prores
 def openOutputMovie(self, outputFile):
     '''
     Opens the output movie file with the installed player using autoit
     :param outputFile: Output movie file
     '''
     videoPlayerDir = self.getVideoPlayer()
     if videoPlayerDir == '':
         return
     self.pLabel.setText('Opening Movie %s' % outputFile.split('/')[-1])
     title = outputFile.split('/')[-1].split('.')[0]
     outputFile = outputFile.replace('/','\\')
     autoit.run('%s %s' % (videoPlayerDir, outputFile))
     if 'QuickTime' in videoPlayerDir:
         autoit.win_wait(title, 100)
         import time
         # This is a hack. We wait 3 sec for the movie to load completely before sending the next signal.
         # Otherwise the signal is not registered.
         time.sleep(1)
         autoit.control_send(title, '', '{CTRLDOWN}0{CTRLUP}')
コード例 #34
0
def rescale_upload():
    user = "******"
    pwd = "1055088S!dhu"

    # For Chrome
    opts = ChromeOptions()
    opts.add_experimental_option("detach", True)

    driver = webdriver.Chrome(
        "C:/Users/siddardha.teegela/Downloads/Softwares/chromedriver.exe",
        options=opts)
    driver.get("https://platform.rescale.com/")

    #Find login
    element = driver.find_element_by_id("id_username")
    element.send_keys(user)

    element = driver.find_element_by_id("id_password")
    element.send_keys(pwd)

    element.send_keys(Keys.RETURN)

    time.sleep(3)
    #file_click = driver.find_element_by_id("menuFiles")
    file_click = driver.find_element_by_xpath("//*[@id='menuFiles']/a")
    file_click.click()

    time.sleep(10)

    try:
        upload_file = driver.find_element_by_xpath(
            "//*[@id='filesPageDropZone']")
        upload_file.click()
        time.sleep(5)
        autoit.win_active("Open")
        autoit.control_send(
            "Open", "Edit1",
            r"C:\Users\siddardha.teegela\Downloads\testdoc1.txt")
        autoit.control_send("Open", "Edit1", "{ENTER}")
    except Exception as e:
        print(e, 'Could not upload file')

    time.sleep(50)
コード例 #35
0
ファイル: login.py プロジェクト: oyajiro/l2bot
def main():
    bot = Bot()
    print bot.title
    autoit.win_wait(bot.title, 5)
    bot.sleep(5,10)
    autoit.control_send(bot.title, '', 'oyajirospoil', 30)
    bot.sleep(7,10)
    autoit.control_send(bot.title, '', '8w141qtf', 30)
    bot.sleep(7,10)
    autoit.control_send(bot.title, '', '{NUMPADENTER}', 30)
    bot.sleep(7,10)
    autoit.control_send(bot.title, '', '{NUMPADENTER}', 30)
    pass
コード例 #36
0
ファイル: ocr.py プロジェクト: oyajiro/l2bot
def main():
    title = "[CLASS:l2UnrealWWindowsViewportWindow]"
    autoit.win_wait(title, 5)
    counter = 0
    while True:
        img = getScreen(leftCornerx,leftCornery,x2,y2)
        res = findHP(img);
        print res
        if res > 0:
            autoit.control_send(title, '', '{F1}', 0)
            time.sleep(2)
        else:
            if counter == 1:
                autoit.control_send(title, '', '{F3}', 0)

            if counter > 2:
                findTarget(img)
                counter = 0
            counter += 1
        print 'counter ' + str(counter)
    pass
コード例 #37
0
ファイル: dagger.py プロジェクト: oyajiro/l2bot
def main():
    autoit.win_wait(title, 5)
    counter = 0
    poitonUse = 0
    cycle = True
    while cycle:
        hpstatus = checkOwnHp()
        print 'hp ' + str(hpstatus)
        if hpstatus == -1:
            print 'CPDamage'
            cv2.imwrite('CPDamage' + str(int(time.time())) + '.png',getScreen(leftCornerx,leftCornery,x2,fullY2))
            cycle = False
            # autoit.win_kill(title)
        if hpstatus == 0:
            print 'Dead'
            cv2.imwrite('Dead' + str(int(time.time())) + '.png',getScreen(leftCornerx,leftCornery,x2,fullY2))
            cycle = False
        if hpstatus == 1:
            if poitonUse == 0:
                autoit.control_send(title, '', '{F10}', 0)
            poitonUse += 1
            if poitonUse > 5:
                poitonUse = 0
        else:
            poitonUse = 0
        img = getScreen(leftCornerx,leftCornery,x2,y2)
        res = findHP(img);
        print 'tgs ' + str(res)

        if res > 0:
            autoit.control_send(title, '', '{F1}', 0)
            counter = 0

            if res == 1:
                sleep(0.3,0.6)
            if res > 1:
                sleep(2,4)
        else:
            if counter < 2:
                autoit.control_send(title, '', '{F3}', 0)
                sleep(0.1,0.2)
                autoit.control_send(title, '', '{F1}', 0)

            if counter > 1:
                findTarget()
                # autoit.control_send(title, '', '{F11}', 0)
                counter = 0
            counter += 1
        print 'cnt ' + str(counter)
    pass
コード例 #38
0
ファイル: functions.py プロジェクト: oyajiro/l2bot
def findTarget():
    img = getScreen(leftCornerx,leftCornery,x2,y2)    
    cnts = getTargetCntrs(img)
    approxes = []
    hulls = []
    for cnt in cnts:
        approxes.append(cv2.approxPolyDP(cnt,0.01*cv2.arcLength(cnt,True),True))
        hulls.append(cv2.convexHull(cnt))
        left = list(cnt[cnt[:,:,0].argmin()][0])        
        right = list(cnt[cnt[:,:,0].argmax()][0])
        print 'left x' + str(left[0])+ 'y '+ str(left[1])
        print 'right x' + str(right[0])+ 'y '+ str(right[1])
        if right[0] - left[0] < 20:
            print 'Small diff ' + str(right[0] - left[0])
            continue
        center = round((right[0]+left[0])/2)
        center = int(center)
        moveMouse(center,left[1]+90)
        sleep(0.2,0.4)
        res = findHP(img);
        if res > 0:
            autoit.control_send(title, '', '{F1}', 0)
            sleep(0.1,0.4)
            return

        if (findFromTargeted(left, right)):
            autoit.mouse_click('left', center, left[1]+90)
            sleep(0.1,0.3)
            autoit.mouse_click('left', center, left[1]+90)
            return True
        # moveMouse(center,left[1]+70)
        # res = findHP(img);
        # if res > 0:
        #     autoit.control_send(title, '', '{F2}', 0)
        #     return
        # if (findFromTargeted(left, right)):
        #     autoit.mouse_click('left', center+10, left[1]+70)
        #     return True
    mouseRotate()
コード例 #39
0
ファイル: assist.py プロジェクト: oyajiro/l2bot
def main():
    autoit.win_wait(title, 5)
    counter = 0
    splcnt = 0
    poitonUse = 0
    cycle = True
    while cycle:
        hpstatus = checkOwnHp()
        print 'hp ' + str(hpstatus)
        if hpstatus == -1:
            print 'CPDamage'
            cv2.imwrite('CPDamage' + str(int(time.time())) + '.png',getScreen(leftCornerx,leftCornery,x2,fullY2))
            cycle = False
            # autoit.win_kill(title)
        if hpstatus == 0:
            print 'Dead'
            cv2.imwrite('Dead' + str(int(time.time())) + '.png',getScreen(leftCornerx,leftCornery,x2,fullY2))
            cycle = False
        if hpstatus == 1:
            if poitonUse == 0:
                autoit.control_send(title, '', '{F10}', 0)
            poitonUse += 1
            if poitonUse > 5:
                poitonUse = 0
        else:
            poitonUse = 0

        img = getScreen(leftCornerx,leftCornery,x2,y2)
        res = findHP(img);
        print 'tgs ' + str(res)

        if res > 0:
            autoit.control_send(title, '', '{F1}', 0)
            counter = 0
            sleep(2,4)
        else:
            if counter < 1:
                autoit.control_send(title, '', '{F3}', 0)
                counter += 1
            else:
                autoit.mouse_click('left', px, py1)
                sleep(0.5,1.5)
                autoit.control_send(title, '', '{F4}', 0)
                counter = 0
    pass
コード例 #40
0
ファイル: daggerKarik.py プロジェクト: oyajiro/l2bot
def main():
    bot = Bot()
    autoit.win_wait(bot.title, 5)
    counter = 0
    poitonUse = 0
    cycle = True
    fullCounter = 0
    while cycle:
        hpstatus = bot.checkOwnHp()
        print 'hp ' + str(hpstatus)
        if hpstatus == 0:
            bot.sleep(2,3)
            if hpstatus == 0:
                print 'Dead'
                cv2.imwrite('Dead' + str(int(time.time())) + '.png',bot.getScreen(leftCornerx,leftCornery,x2,fullY2))
                cycle = False
        if hpstatus == 1:
            if poitonUse == 0:
                autoit.control_send(bot.title, '', '{F10}', 0)
            poitonUse += 1
            if poitonUse > 5:
                poitonUse = 0
        else:
            poitonUse = 0
        res = bot.findHP();
        print 'tgs ' + str(res)
        if res == 3:
            fullCounter += 1
            print 'fc ' + str(fullCounter)
        else:
            fullCounter = 0
            lure = 0
        if fullCounter > 6:
            autoit.control_send(bot.title, '', '{ESC}', 0)
            bot.sleep(0.3,0.6)
            autoit.control_send(bot.title, '', '{F3}', 0)
            # bot.mouseRotate()
            fullCounter = 0
            
        if res > 0:
            autoit.control_send(bot.title, '', '{F1}', 0)
            counter = 0

            if res == 1 or res == 3:
                bot.sleep(0.3,0.6)
            if res > 1 and res < 3:
                bot.sleep(1,3)
        else:
            fullCounter = 0
            if counter < 2:
                autoit.control_send(bot.title, '', '{F3}', 0)
                bot.sleep(0.1,0.2)
                autoit.control_send(bot.title, '', '{F1}', 0)

            if counter > 1:
                # bot.findTarget()
                print 'counrter > 1'
                autoit.control_send(bot.title, '', '{F7}', 0)
                bot.sleep(0.3,0.5)
                if bot.findHP() > 0 :
                    print 'lure'
                    autoit.control_send(bot.title, '', '{F5}', 0)
                    bot.sleep(5,7)
                counter = 0
            counter += 1
        print 'cnt ' + str(counter)
    pass
コード例 #41
0
ファイル: spoil.py プロジェクト: oyajiro/l2bot
def checkOwnMp():
    bot = Bot()
    if bot.checkOwnMp() <= 1:
        print 'MP_USE'
        autoit.control_send(bot.title, '', '{F12}', 0)
コード例 #42
0
ファイル: spoil.py プロジェクト: oyajiro/l2bot
def main():
    bot = Bot()
    print bot.title
    autoit.win_wait(bot.title, 5)
    counter = 0
    poitonUse = 0
    cycle = True
    spoilCount = 0
    fullCounter = 0
    deadCounter = 0
    sweepcounter = 0
    while cycle:
        hpstatus = bot.checkOwnHp()
        print 'hp ' + str(hpstatus)
        checkOwnMp()
        if hpstatus == 0:
            autoit.control_send(bot.title, '', '{F9}', 0)
            bot.sleep(0.3,0.6)
            print 'I\'m Dead', str(datetime.now())
            str(datetime.now())
            cv2.imwrite('Dead' + str(int(time.time())) + '.png',bot.getScreen(leftCornerx,leftCornery,x2,fullY2))
            cycle = False
        if hpstatus == 1:
            if poitonUse == 0:
                autoit.control_send(bot.title, '', '{F10}', 0)
            poitonUse += 1
            if poitonUse > 5:
                poitonUse = 0
        else:
            poitonUse = 0
        res = bot.findHP();
        print 'tgs ' + str(res)
        if res == 3:
            fullCounter += 1
            print 'fc ' + str(fullCounter)
            autoit.control_send(bot.title, '', '{F1}', 0)
        else:
            fullCounter = 0
        if fullCounter > 6:
            autoit.control_send(bot.title, '', '{ESC}', 0)
            bot.sleep(0.1,0.3)
            autoit.control_send(bot.title, '', '{F3}', 0)
            bot.sleep(0.1,0.3)
            # bot.mouseRotate()
            fullCounter = 0
            spoilCount = 0
        if res > 0:
            autoit.control_send(bot.title, '', '{F1}', 0)
            # autoit.control_send(bot.title, '', '{F2}', 0)
            if res < 3:
                counter = 0
                sweepcounter = 0
            deadCounter = 0

            if res > 0 and spoilCount < 4:
                autoit.control_send(bot.title, '', '{F5}', 0)
                bot.sleep(0.2, 0.4)
                # autoit.control_send(bot.title, '', '{F4}', 0)
            if spoilCount < 5:
                autoit.control_send(bot.title, '', '{F2}', 0)
                bot.sleep(0.2, 0.4)
                autoit.control_send(bot.title, '', '{F2}', 0)
                bot.sleep(0.2, 0.4)
                autoit.control_send(bot.title, '', '{F6}', 0)
                # if spoilCount % 2 == 0:
                #     autoit.control_send(bot.title, '', '{F2}', 0)
                # else:
                #     autoit.control_send(bot.title, '', '{F6}', 0)
                bot.sleep(0.2, 0.4)
                autoit.control_send(bot.title, '', '{F1}', 0)
                bot.sleep(0.1,0.3)
                autoit.control_send(bot.title, '', '{F1}', 0)
                spoilCount += 1
        else:
            deadCounter += 1
            spoilCount = 0
            bot.sleep(0.1,0.2)
            if res == 0 and counter < 2 and sweepcounter < 3:
                autoit.control_send(bot.title, '', '{F4}', 0)
                bot.sleep(0.1,0.3)
                autoit.control_send(bot.title, '', '{F4}', 0)    
                bot.sleep(0.1,0.3)
                autoit.control_send(bot.title, '', '{F4}', 0)                    
                bot.sleep(0.1,0.3)                
                autoit.control_send(bot.title, '', '{F4}', 0)                    
                bot.sleep(0.1,0.3)
                autoit.control_send(bot.title, '', '{F3}', 0)            
                print 'F4'
                deadCounter = 0
                sweepcounter += 1
            if counter < 3:
                autoit.control_send(bot.title, '', '{F3}', 0)
                bot.sleep(0.1,0.3)
                autoit.control_send(bot.title, '', '{F1}', 0)
                print 'F3'

            if counter > 2:
                # bot.findTarget()
                autoit.control_send(bot.title, '', '{F7}', 0)
                bot.sleep(0.1,0.3)
                autoit.control_send(bot.title, '', '{F7}', 0)
                print 'F7'
                counter = 0
            counter += 1
        print 'cnt ' + str(counter)
    pass
コード例 #43
0
ファイル: sh.py プロジェクト: oyajiro/l2bot
def main():
    bot = Bot()
    autoit.win_wait(bot.title, 5)
    counter = 0
    poitonUse = 0
    cycle = True
    fullCounter = 0
    while cycle:
        hpstatus = bot.checkOwnHp()
        print 'hp ' + str(hpstatus)
        checkOwnMp()
        if hpstatus == 0:
            print 'Dead'
            cv2.imwrite('Dead' + str(int(time.time())) + '.png',bot.getScreen(leftCornerx,leftCornery,x2,fullY2))
            cycle = False
        res = bot.findHP();
        if hpstatus < 2 and res > 0:
            autoit.control_send(bot.title, '', '{F5}', 0)
            bot.sleep(0.1,0.4)
            autoit.control_send(bot.title, '', '{F1}', 0)
            bot.sleep(0.1,0.3)
            autoit.control_send(bot.title, '', '{F3}', 0)
            continue
        print 'tgs ' + str(res)
        if res == 3:
            fullCounter += 1
            print 'fc ' + str(fullCounter)
        else:
            fullCounter = 0
        if fullCounter > 9:
            autoit.control_send(bot.title, '', '{ESC}', 0)
            bot.sleep(0.3,0.6)
            # autoit.control_send(bot.title, '', '{F3}', 0)
            # bot.mouseRotate()
            fullCounter = 0
            
        if res > 0:
            print 'F1'
            autoit.control_send(bot.title, '', '{F1}', 0)
            counter = 0
            bot.sleep(0.1,0.3)
            autoit.control_send(bot.title, '', '{F1}', 0)
            continue
            # autoit.control_send(bot.title, '', '{F4}', 0)
        else:
            fullCounter = 0
            if res == 0:
                autoit.control_send(bot.title, '', '{F11}', 0)
                bot.sleep(0.1,0.4)
                autoit.control_send(bot.title, '', '{F11}', 0)
            autoit.control_send(bot.title, '', '{F7}', 0)
            if counter < 3:
                autoit.control_send(bot.title, '', '{F3}', 0)
                print 'F3'
                bot.sleep(0.1,0.2)
                autoit.control_send(bot.title, '', '{F1}', 0)

            if counter > 2:
                # bot.findTarget()
                autoit.control_send(bot.title, '', '{F7}', 0)
                print 'F7'
                counter = 0
            counter += 1
        print 'cnt ' + str(counter)
    pass
コード例 #44
0
ファイル: summon.py プロジェクト: oyajiro/l2bot
def main():
    bot = Bot()
    print bot.title
    autoit.win_wait(bot.title, 5)
    counter = 0
    poitonUse = 0
    cycle = True
    summAttackCount = 0
    while cycle:
        hpstatus = bot.checkOwnHp()
        print 'hp ' + str(hpstatus)
        if hpstatus == 0:
            print 'Dead'
            cv2.imwrite('Dead' + str(int(time.time())) + '.png',getScreen(leftCornerx,leftCornery,x2,fullY2))
            cycle = False
        if hpstatus == 1:
            if poitonUse == 0:
                autoit.control_send(bot.title, '', '{F10}', 0)
            poitonUse += 1
            if poitonUse > 5:
                poitonUse = 0
        else:
            poitonUse = 0
        res = bot.findHP();
        print 'tgs ' + str(res)

        if res > 0:
            autoit.control_send(bot.title, '', '{F1}', 0)
            bot.sleep(0.1,0.6)
            autoit.control_send(bot.title, '', '{F2}', 0)
            counter = 0

            if res == 1:
                bot.sleep(0.3,0.6)
            if res > 1:
                if summAttackCount < 3:
                    autoit.control_send(bot.title, '', '{F2}', 0)
                bot.sleep(1,3)
                summAttackCount += 1
            # autoit.control_send(bot.title, '', '{F5}', 0)
        else:
            autoit.control_send(bot.title, '', '{F5}', 0)
            if counter < 3:
                autoit.control_send(bot.title, '', '{F3}', 0)
                bot.sleep(0.1,0.2)
                autoit.control_send(bot.title, '', '{F1}', 0)

            if counter > 1:
                # bot.findTarget()
                autoit.control_send(bot.title, '', '{F7}', 0)
            if counter > 2:
                autoit.control_send(bot.title, '', '{F8}', 0)
                counter = 0
            counter += 1
        print 'cnt ' + str(counter)
    pass
コード例 #45
0
ファイル: destr.py プロジェクト: oyajiro/l2bot
def main():
    autoit.win_wait(title, 5)
    counter = 0
    poitonUse = 0
    cycle = True
    fightCounter = 0
    rage = 0
    while cycle:
        cpstatus = checkOwnCp()
        hpstatus = checkOwnHp()
        print 'hp ' + str(hpstatus)
        if cpstatus == -1:
            print 'CPDamage'
            cv2.imwrite('CPDamage' + str(int(time.time())) + '.png',getScreen(leftCornerx,leftCornery,x2,fullY2))
            cycle = False
            # autoit.win_kill(title)
        if hpstatus == 0:
            print 'Dead'
            cv2.imwrite('Dead' + str(int(time.time())) + '.png',getScreen(leftCornerx,leftCornery,x2,fullY2))
            cycle = False
        if hpstatus == 1:
            if poitonUse == 0:
                autoit.control_send(title, '', '{F10}', 0)
            poitonUse += 1
            if poitonUse > 5:
                poitonUse = 0
        else:
            poitonUse = 0
        if (not matchBuff('template_rage.png',360,80)):
            if (rage == 0):
                autoit.mouse_click('left', 1485, 885)
                sleep(0.1,0.3)
                rage += 1
                autoit.control_send(title, '', '{F1}', 0)
            if (rage > 5):
                rage = 0
        else:
            rage = 0

        img = getScreen(leftCornerx,leftCornery,x2,y2)
        res = findHP(img);
        print 'tgs ' + str(res)

        if res > 0:
            autoit.control_send(title, '', '{F1}', 0)
            counter = 0

            if res == 1:
                sleep(0.3,0.6)
            if res > 1:
                sleep(2,4)
        else:
            if counter < 2:
                autoit.control_send(title, '', '{F3}', 0)
                sleep(0.1,0.2)
                autoit.control_send(title, '', '{F1}', 0)

            if counter >= 2:
                # autoit.control_send(title, '', '{F11}', 0)
                # findTarget()
                autoit.control_send(title, '', '{F11}', 0)
                sleep(0.1,0.2)
                autoit.control_send(title, '', '{F3}', 0)
                # sleep(0.1,0.2)
                # autoit.control_send(title, '', '{F1}', 0)
                counter = 0
            counter += 1
        print 'cnt ' + str(counter)
    pass
コード例 #46
0
ファイル: spoil.py プロジェクト: oyajiro/l2bot
def main():
    autoit.win_wait(title, 5)
    counter = 0
    splcnt = 0
    poitonUse = 0
    cycle = True
    while cycle:
        hpstatus = checkOwnHp()
        cpstatus = checkOwnCp()
        print 'hps ' + str(hpstatus)
        print 'cps ' + str(cpstatus)
        if cpstatus < 3:
            print 'CPDamage'
            cv2.imwrite('CPDamage' + str(int(time.time())) + '.png',getScreen(leftCornerx,leftCornery,x2,fullY2))
            autoit.win_kill(title)
        if hpstatus == 0:
            print 'Dead'
            cv2.imwrite('Dead' + str(int(time.time())) + '.png',getScreen(leftCornerx,leftCornery,x2,fullY2))
            cycle = False
            continue
            # autoit.win_kill(title)
        if hpstatus == 1:
            if poitonUse == 0:
                autoit.control_send(title, '', '{F10}', 0)
            poitonUse += 1
            if poitonUse > 5:
                poitonUse = 0
        else:
            poitonUse = 0

        if hpstatus == -1:
            autoit.control_send(title, '', '{F9}', 0)
            sleep(6,10)
            restoreMenyHp()
            autoit.control_send(title, '', '{F9}', 0)

        img = getScreen(leftCornerx,leftCornery,x2,y2)
        res = findHP(img);
        print 'tgs ' + str(res)

        if res > 0:
            if res > 2 and splcnt < 4:
                autoit.control_send(title, '', '{F2}', 0)
                sleep(1,3)
                splcnt += 1
            else:
                autoit.control_send(title, '', '{F1}', 0)
                if (res > 1):
                    sleep(2,4)
                else:
                    sleep(0.5, 1)
            counter = 0
        else:
            splcnt = 0
            if res == 0:
                autoit.control_send(title, '', '{F4}', 0)
                sleep(0.2,0.7)

            if counter < 2:
                autoit.control_send(title, '', '{F3}', 0)
                if res == 0 and counter == 0:
                    sleep(0.1,0.3)
                    autoit.control_send(title, '', '{F2}', 0)

            if counter > 1:
                findTarget()
                # autoit.control_send(title, '', '{F11}', 0)
                counter = 0
            counter += 1
        print 'cnt ' + str(counter)
    pass
コード例 #47
0
ファイル: notepad.py プロジェクト: Codehimn/pyautoit
# -*- coding: utf-8 -*-

__author__ = 'Jace Xu'

import autoit

autoit.run("notepad.exe")
autoit.win_wait_active("[CLASS:Notepad]", 3)
autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}")
autoit.win_close("[CLASS:Notepad]")
autoit.control_click("[Class:#32770]", "Button2")
コード例 #48
0
def main():

    user_dir = get_users_main_directory()
    check_lp_power_data_folder_exists(user_dir)
    check_database_file_exists(user_dir)
    trial = {}
    trial = prompt_setup(trial, user_dir)

    # stopgap for pre-class variables
    walk_speed = trial["Speed [MPH]"]
    walk_style = trial["Walk Style [Normal/LP]"]
    pack_number = trial["Pack Number [XXX]"]

    # MAKE FOLDERS FOR TRIAL BASED ON PREVIOUSLY-ENTERED INPUTS
    make_pack_folder(pack_number, walk_speed, walk_style, user_dir)

    print('.....')
    print("..........Launching.....")

    # SET UP BASIC AUTO-IT SETTINGS TO USE WINDOW-RELATIVE COORDINATES
    autoit.auto_it_set_option('MouseCoordMode', 0)
    autoit.auto_it_set_option('SendKeyDelay', 10)

    # OPEN PICOSCOPE USING OUR DEFAULT WINDOW LAYOUT WITH TWO PANELS AND POWER UP TOP
    default_pico = os.path.join(user_dir, "electrical_power.psdata")
    click_on_file(default_pico)

    # PREPARE TO RUN THE RECORD DATA MACRO
    autoit.win_wait('PicoScope 6 - [electrical_power.psdata]')
    autoit.win_activate('PicoScope 6 - [electrical_power.psdata]')
    time.sleep(0.5)
    autoit.send('{ALT}{TAB}{TAB}{TAB}{TAB}{ENTER}{END}{UP}{ENTER}')
    autoit.win_wait('Macro Recorder')
    autoit.control_click('Macro Recorder', "[Name:_buttonImport]")
    time.sleep(1)
    macro_text = os.path.abspath(os.path.join(user_dir, "record_20sec.psmacro"))
    autoit.clip_put(macro_text)
    autoit.win_wait("Open")
    autoit.send('^V', 0)
    autoit.send('{ENTER}')
    msgbox("Ready to go?")

    # RUN THE MACRO
    autoit.win_activate('Macro Recorder')
    autoit.win_wait('Macro Recorder')
    autoit.control_click('Macro Recorder', "[Name:_buttonExecute]")
    time.sleep(22)
    autoit.win_activate('Macro Recorder')
    autoit.send('{ESCAPE}')

    # BEGIN SAVING THE DATA
    i = datetime.now()
    save_text = os.path.abspath(os.path.join(user_dir, 'LP Power Data', "{}".format("LP-{0}".format(pack_number)), "{0}MPH-{1} Walk".format(walk_speed, walk_style),
                             "{0}MPH-{1} Walk_".format(walk_speed, walk_style) + i.strftime('%Y-%m-%d %Hh%Mm%Ss')+ ".psdata"))
    autoit.clip_put(save_text)

    # SAVE ALL CAPTURED WAVEFORMS IN PICO FORMAT
    autoit.win_activate('PicoScope 6')
    autoit.win_wait("PicoScope 6")
    autoit.send('{ALT}{f}{a}')
    time.sleep(.5)
    autoit.win_wait("Save As")
    autoit.control_send('Save As', "[Class:Edit;INSTANCE:1]", '^V', 0)
    autoit.send('{ENTER}')

    # BEGIN SAVE SEQUENCE FOR CSV FORMAT
    autoit.win_activate('PicoScope 6')
    autoit.win_wait("PicoScope 6")
    autoit.mouse_click("primary", 433, 67, 2, 1)
    # MUST CLICK ON SECTION OF WINDOW CONTAINING POWER TRACE OR ALL AVERAGES CALCULATED WILL BE MESSED UP
    autoit.win_activate('PicoScope 6')
    autoit.win_wait("PicoScope 6")
    autoit.mouse_click("primary", 230, 260, 1, 0)
    # autoit.control_click('PicoScope 6', "[CLASS:WindowsForms10.Window.8.app.0.1114f81_r13_ad1; INSTANCE:55]")
    autoit.send('{ALT}{f}{a}')
    time.sleep(.5)
    autoit.win_wait("Save As")
    autoit.control_send('Save As', "[Class:Edit;INSTANCE:1]", '^V', 0)

    # SAVE ALL CAPTURED 5SEC INTERVALS
    autoit.control_click('Save As', "[CLASS:ComboBox;INSTANCE:3]")
    autoit.send("{HOME}{DOWN}{DOWN}{ENTER}")
    # autoit.control_click("Save As", "[NAME:_currentBufferRadio]")
    time.sleep(0.5)
    autoit.send('{ENTER}')
    time.sleep(4.5)
    autoit.process_close('PicoScope.exe')
    # BOTH SAVE OPERATIONS NOW COMPLETE. THERE IS A CSV FOR EACH 5SEC INTERVAL IN A NEW SUBDIRECTORY OF THIS TRIAL.

    print("")
    print("Sit tight, I'm still doing some thinking....")

    # UPDATE ALL CSV FILES TO BE XLSX AND CALCULATE THEIR 5SEC AVERAGES
    run_avgs = recursively_repair_all_csv_files(save_text, user_dir, walk_speed)

    # ADD ALL INFORMATION COLLECTED TO THE EXPERIMENTS SPREADSHEET
    patch_experiments_database(trial, run_avgs, user_dir)
    print("")

    # WRITE THE METADATA SETTINGS TO A FILE FOR FUTURE RECORD
    with open('{}'.format(save_text.replace(".psdata", ".LPmeta")), 'w') as outfile:
        json.dump(trial, outfile, indent=4, separators=(',', ': '))
    print("")
    print("LP Metadata file successfully saved for the future with all info the state of the pack as you have just tested it.")

    print("")
    # print_average_power(dest_filename)
    print(".................................. Testing Complete.")