pythonkeyboardsolidworks

Is it possible for send keys/keyboard to type the contents of one index on a list using python


I am working on python code to change specifications in thousands of Solidworks Drawing files. Id like to use the Keyboard function or something similar to send keys in VBA. I have all of the specifications stored in three different lists/arrays. It is possible to have send keys type out the contents of lets say the second index in my list?

I am new to python so i havent tried much. Just want some feedback on the viability of this strategy since time is not on my side for this deliverable.


Solution

  • I think pyautogui might be a good match for your needs. here is a quick examples of using it to type text from a list. the sleep if for you to have time to focus on a text field.

    import pyautogui
    import time
    
    my_list = ["this","is","a","list"]
    time.sleep(5)
    pyautogui.typewrite(my_list[1])
    

    pyautogui documentation