Python Forum
loop in pyautogui (python automation GUI application)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
loop in pyautogui (python automation GUI application)
#1
HI!I'm working on automation with my "exceldata to GUI app import". It goes quite well, but I have an issue with loop. When I'm looping, it imports data good in textboxes and with 'tab' it moves trough another textboxes very smooth. But loop stops at the end of the first row. it looks like my loop is not going through the whole excel file. What I need: import data from one row to textboxes, confirm this with entering, and repeat in other rows

here's my code:

wb = openpyxl.load_workbook('test.xlsx')
sheet = wb.active
max_row = sheet.max_row
max_column = sheet.max_column

def start_program():
    pyautogui.hotkey('win','r')
    pyautogui.typewrite(r"C:\Users\User\Desktop\GUITEST.lnk")
    pyautogui.hotkey('enter')
    pyautogui.sleep(3)

def loop_excel_sheet():
    for i in range(107, max_row+1):
        for j in range(1, max_column+1):
            cell_obj = sheet.cell(row=i, column=j)
            pyperclip.copy(str(cell_obj.value))
            pyautogui.typewrite(pyperclip.paste())
            pyautogui.hotkey('tab')

start_program()
loop_excel_sheet()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Automation of GUI by python function dghosal 4 774 Aug-18-2023, 10:23 AM
Last Post: dghosal
  How do I properly implement restarting a multithreaded python application? MrFentazis 1 588 Jul-17-2023, 09:10 PM
Last Post: JamesSmith
  Pyautogui, İmagesearch, Moving target Beyazx 0 554 Jun-27-2023, 08:47 PM
Last Post: Beyazx
  home automation using python barryjo 1 1,163 Jul-24-2022, 09:09 PM
Last Post: Larz60+
  PyautoGUI- How to use If - Else with pyautogui.locateCenterOnScreen Tiel 3 8,131 Jun-27-2022, 02:00 PM
Last Post: DeaD_EyE
  Python running only in application Mawixy 2 1,091 Apr-19-2022, 11:38 AM
Last Post: Mawixy
  pyautogui.locateOnScreen producing error dude8074 6 3,735 Apr-17-2022, 05:05 PM
Last Post: bowlofred
  How to send data from a python application to an external application aditya_rajiv 1 2,131 Jul-26-2021, 06:00 AM
Last Post: ndc85430
  Python Help, New User, Computer Automation hexagonalyeti 2 1,627 Jun-25-2021, 11:43 AM
Last Post: hexagonalyeti
  python application and credentials safety concern aster 4 3,418 Mar-06-2021, 06:51 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020