How to paste n+1 every single time without copying new line from excel

Joined
Jul 13, 2023
Messages
2
Reaction score
0
I'm working in a call center and I always have to copy a 7 digit number and paste it to a website to be able to call someone (as an example I have to call starting from 1234567 then when i call the next person the number is 1234568, 1234569) is there a way to paste the n+1 every single time I paste without copying the new one from excel? or just make a program to click on once to copy n+1 so i can copy it and make my work easier?
 
Joined
Jul 18, 2023
Messages
1
Reaction score
0
Executed via CMD. I hope you understand Python.

Python:
"""
N+1 Automation Program - V.0.0.1 - By Malicious Coder
-----------------------------------------------------
KeyBinds
-----------------------------------------------------
P = Pause
Enter or Space = Enter new number tap twice
R = Resume
Q + Enter = End Script
"""
import pyautogui
import keyboard


def run_script():
    # Define the starting number
    start_number = 1234567

    # Set the initial clipboard value
    pyautogui.write(str(start_number))

    # Function to check if a specific key is pressed
    def is_key_pressed(key):
        return keyboard.is_pressed(key)

    # Variable to track the pause state
    paused = False

    # Variable to control script execution
    running = True

    # Loop to increment the number
    while running:
        # Check if the "p" key is pressed to toggle pause/resume
        if is_key_pressed('p'):
            paused = not paused
            if paused:
                print("Paused")
            else:
                print("Resumed")

        # Check if the process is not paused
        if not paused:
            # Wait for the user to press a key to paste the number
            while True:
                if any(is_key_pressed(key) for key in ['enter', 'space']):
                    break
                elif is_key_pressed('x'):
                    paused = True
                    print("Paused")
                    break

            # Check if the process is still paused
            if paused:
                # Wait for the user to press the resume key ("r")
                while not is_key_pressed('r'):
                    pass

                paused = False
                print("Resumed")

        # Check if the process is not paused
        if not paused:
            # Simulate pressing the Enter key to proceed
            pyautogui.press('enter')

            # Increment the number
            start_number += 1

            # Update the clipboard value with the new number
            pyautogui.write(str(start_number))

        # Check if the "q" key is pressed to stop the script
        if is_key_pressed('q'):
            print("Script stopped.")
            running = False


# Call the run_script() function to execute the script
run_script()

Demo
----------
1689670752656.png

----------
Github
----------
https://github.com/NichOne/PythonHelp
 
Joined
Jul 4, 2023
Messages
376
Reaction score
42
  • What system are you running on (e.g. iOS, Windows, Android, etc.)?
  • You can run applications written in Python on your computer?
 
Joined
Jul 4, 2023
Messages
376
Reaction score
42
# Set the initial clipboard value
pyautogui.write(str(start_number))

BTW,
the write() function from the pyautogui library is used to simulate typing text on the keyboard. It is commonly used for automating tasks such as filling out forms, inputting data into applications, not to operate with clipboard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,794
Messages
2,569,641
Members
45,355
Latest member
SJLChristi

Latest Threads

Top