Categories
Planning

How to make your computer press a key every x seconds

Lowell is the founder and CEO of How-To Geek. He’s been running the show since creating the site back in 2006. Over the last decade, Lowell has personally written more than 1000 articles which have been viewed by over 250 million people. Prior to starting How-To Geek, Lowell spent 15 years working in IT doing consulting, cybersecurity, database management, and programming work. Read more.

Have you ever needed to press a key every couple of seconds, or every few minutes? Perhaps you’re playing a video game and you’re waiting for an item, or you’ve got some other reason. Either way, here’s how to make your PC do it automatically.

You’ll need to start by downloading and installing AutoHotkey, which is a simple scripting language that allows you to create easy scripts. Once you do that, right-click anywhere and choose New –> AutoHotkey Script.

Once you’ve done that, paste the following into the script:

#Persistent
SetTimer, PressTheKey, 1800000
Return

This simple script will wait every 30 minutes and press the Spacebar. You can adjust the 1800000 number above to the amount of milliseconds required. So, for example, if you wanted it to run every 2 minutes, you’d use 60 seconds * 2 minutes * 1000 milliseconds = 120000 total milliseconds.

(Warning: Don’t set a very low number of milliseconds. For example, if you set the time to 10 milliseconds, the script will press the Spacebar one hundred times per second, which could cause obvious problems.)

Save the file name as whatever you’d like, and then double-click on it to run it.

You can also send another hotkey or any number of characters just by changing the Send, line to something else—you can literally type out some letters you want to send, or you can use some of the special keys on the AutoHotkey documentation page. For example, to make it send the word “lazy” and then press the Space bar, you could use:

I’m not entirely certain what you’ll want to use this for, but that’s what makes scripting so much fun.

  • Guests
  • Last active:
  • Joined: —

Hello everyone. I am hoping to make an AHK script that presses a certain key every X seconds, but I have no idea where to start with this.

Also, I was wondering if it’s possible to have any ONE of the following (in order of importance):

-Make the script happen “behind the scenes”, meaning it would send the key press to a certain program, even if it doesn’t have focus.

-Make the timer automatically deactivate when the program I’m gonna use it on loses focus, and reactivates when I give it focus again.

-Make a key that activates/deactivates the timer manually.

Any help would be greatly appreciated! D: I’m really struggling with this.

  • Members
  • 398 posts
  • Last active: Jun 03 2015 09:03 AM
  • Joined: 11 Apr 2011

Your description contradicts itself . . .

You say that you want it to send a certain key to the program, even if it doesn’t have focus but you want the timer to deactivate whenever it doesn’t have focus . . . ??

It sounds like you still need to get some more basic knowledge on AutoHotkey so take you’re time with this and post back once you’ve had a few goes yourself after reading these docs because they are very helpful . . .

Hope this helps / Thanks

  • Guests
  • Last active:
  • Joined: —

Ahhh no, you must have misread me. I only wanted one of the three features I listed at the end. I listed all three, because I wasn’t sure if they were possible.

The best would be to automatically send the key input to the program, even if it doesn’t have the focus. So the input gets sent to that program while I’m doing other stuff.

If that’s not possible, I want the way to deactivate the timer, so that the key doesn’t get pressed while I’m doing other stuff (which is why I suggested deactivating either automatically, or manually).

Anyways, thanks for the links. I’ll try reading that to see if I can do this.

i’ve got some experience using C/C++ language. But i’m playing a game(independent software from mine), and i’d like to make a C program that interacts with the game, to press the key 2 or Space every two seconds. It’s for windows.

2 Answers 2

You can now choose to sort by Trending, which boosts votes that have happened recently, helping to surface more up-to-date answers.

Trending is based off of the highest score sort and falls back to it if no posts are trending.

Have a look at the functions SendInput and keybd_event . Those are functions that will tell Windows to press a key.

And all you need to do is create a loop that sleeps every 2 seconds. keybd_event is the old convention, but it is the one I’m familiar with.

The following will simulate the pressing of the NumLock

In windows, this is pretty easy. Make a C++ console program. Inside your program, you’ll need to search all the “windows” in Windows. Microsoft calls these windows window handles (HWND). You can search through them all with FindWindowEx: http://msdn.microsoft.com/en-us/library/windows/desktop/ms633500(v=vs.85).aspx. once you find your window (by name), you can send TO the window HWND keypresses. This is done with SendMessage(); Put this in a loop every 2 seconds and you’re done!

You can find the window you’re searching for’s properties by using Visual Studio’s Spy++. This will let you easily know what window name to search for.

Not the answer you’re looking for? Browse other questions tagged c++ c time key or ask your own question.

Related

Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

  • Blog
  • Facebook
  • Twitter
  • LinkedIn
  • Instagram

Site design / logo © 2022 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2022.7.1.42502

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

keith0528

Active Member
  • Apr 5, 2012
  • #1
  • Greetings VBA guru’s,

    I’m trying to keep my computer active when i go to lunch. Can vba simulate a click event every 30 or 60 seconds?

    thanks in advance,

    Excel Facts

    keith0528

    Active Member
    • Apr 5, 2012
  • #2
  • MrExcel MVP
    • Apr 5, 2012
  • #3
  • JokelesComedian

    Board Regular
    • Apr 5, 2012
  • #4
  • JokelesComedian

    Board Regular
    • Apr 5, 2012
  • #5
  • keith0528

    Active Member
    • Apr 5, 2012
  • #6
  • Ok, so i take it no one knows how to do that. I’ll keep digging around for code online.

    mikerickson

    MrExcel MVP
    • Apr 5, 2012
  • #7
  • p45cal

    Well-known Member
    • Apr 5, 2012
  • #8
  • a google for
    keep awake windows
    produced, among others:
    Caffeine
    http://www.zhornsoftware.co.uk/caffeine/index.html
    Stims – Keep Windows Awake | ACAPsoft – For software As Compact As Possible
    http://acapsoft.com/det.php?prog=Stims
    Stay-awake utility for Windows Vista and 7 (C#)
    http://www.808.dk/?code-csharp-stay-awake
    Download Stay Awake 1.0 Free – Prevent sleep or hibernate mode, allowing tasks to be carried out without interruption – Softpedia
    http://www.softpedia.com/get/Tweak/System-Tweak/Stay-Awake.shtml
    Computer does not stay awake for scheduled task – Microsoft Answers
    http://answers.microsoft.com/en-us/. led-task/8a5acf64-bddc-4539-9dc5-4b3cab43cfb9

    I don’t vouch for these, never tried them, onus is on you to check their malware status.

    keith0528

    Active Member
    • Apr 6, 2012
  • #9
  • All – thanks for your responses,

    I’ve pieced together what I was looking for. The below code will click on a spot on the screen that you designate with coordinates every x seconds. It works beautifully.

    All I need now is to figure out the right syntax to stop the code.

    Public Declare Function SetCursorPos Lib “user32” (ByVal x As Long, ByVal y As Long) As Long
    Public Declare Sub mouse_event Lib “user32” (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
    Public Const MOUSEEVENTF_LEFTDOWN = &H2
    Public Const MOUSEEVENTF_LEFTUP = &H4
    Dim TimerActive As Boolean

    Sub KeepWindowsActive()
    TimerActive = True
    ‘move cursor and click
    SetCursorPos 200, 200 ‘x and y position
    mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
    mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
    Application.OnTime Now + TimeValue(“00:00:10”), “KeepWindowsActive”

    Anyone know the correct way to stop it?

    “Hi, I have a problem where my Windows 10 computer is lagging whenever I open a newly installed or updated program/applications that are on another drive than my OS. Anyone that have had this problem or have an idea what I could do?”
    -from Windows 10 Forum

    Even though your computer is running Windows 10 with the newest hardware, you might recognize that the operating system seems to slow down or lag at times. Some Windows 10 users may encounter such problem like Windows 10 slow after updating, computer lagging Windows 10 in 2017, etc. Don’t be so fuss! The content below has had good descriptions of fixing Windows 10 slow performance.

    Option 1: Improve Windows 10 Slow Performance with Control Panel

    If you’re suffering Windows 10 slow performance, try to reset the Initial Size and Maximum Size to the Recommended File Size in Control Panel, this may improve computer’s performance.

    • 1. Open “Start” menu, find the “Control Panel” and then just tap it.
    • 2. In the Control Panel, go to the “Search” filed at the top-right side of the window and then type “performance”. Now hit Enter.
    • 3. You will find “Adjust the appearance and performance of Windows”, just click it and then it will open “Performance Options”.
    • 4. Just hit “Advanced” and then click on “Change…” button in the “Virtual memory” option.

    5. Uncheck the “Automatically manage paging file size for all drives”, select the C drive where Windows 10 is installed. Choose “Custom size” and change “Initial size” and “Maximum size” to the recommended values by Windows which is in the “Total paging file size for all drives” section. Different computer shows different file size.

    Option 2: Fix Windows 10 Computer Lagging with Task Manager

    One of the reasons that your computer become sluggish is that you’ve got too many applications that you never use or rarely use running in it. Consequently, try to close them and stop them effecting your PC.

    • Open “Task Manager”. Press “Ctrl+Alt+Delete” at the same time and then choose “Task Manager” in the blue screen. If it shows no tabs, click “More details” at the bottom of it.
    • Hit “Startup” menu. Find “Startup” menu in the main tabs and you will see all the applications that launch when you start Windows.
    • Disable program. To disable the apps that you don’t want to run, just choose it and right click your mouse, tap “Disable” button.

    Option 3: Fix Windows 10 Slow Performance with Windows Care Genius

    As a professional program to optimize Windows system, Windows Care Genius has helped millions of Windows users to protect or rescue their PCs. With 5 main functions and several clicks, it enables all Windows-based computers to run in better performance.

    Now let’s see the brief user guide as below:

      Step 1. Download, install and launch Windows Care Genius to your slow Windows 10 computer. You will see the main interface as below.

    Step 2. Tap “System Tuneup” option from the 5 functions and then you will see the sub menus, the default option “System Optimizer” is ready to use.

    Step 3. Click the green button “Optimize” and then begin to speed up Windows 10 performance instantly.

    That’s all the information that I have collected to improve slow Windows 10 performance for you and you are able to check if it makes any difference. Hope that after trying the method in this article, you’ll find that you’ve got a faster Windows 10 PC and it is less likely to have any problems. Leave your feedback in the comments whether these methods show improvement for you or not.

    While working with Microsoft Excel, you may need to create Macros to achieve some operations. For example, you want to create a Macro to automatically copy a range of data to a new place. As the data will be changed frequently, you need this Macro to automatically run every 5 minutes without manually triggering it in order to synchronize these two ranges of data. How to achieve it? Method in this article can help you.

    The following VBA code can help you to repeat a Macro every X minutes in Excel. Please do as follows.

    1. Press Alt + F11 keys at the same time to open the Microsoft Visual Basic for Applications window.

    2. In the Microsoft Visual Basic for Applications window, please click Insert > Module. Then copy and paste the below VBA code into the Code window. See screenshot:

    VBA code: Repeat or loop a Macro every X minutes in Excel

    Note: In the code, please replace this line ‘Insert your code here with the code you will run every X minutes.

    3. Press the F5 key to run the code. In the popping up Kutools for Excel dialog box, please enter the interval time you will repeat the macro based on, and then click the OK button. See screenshot:

    From now on, the certain Macro will run repeatedly every 5 minutes in your workbook.

    Note: If you need to stop the execution of the macro and change the interval of the cycle, please copy the below VBA code into the same Module window and press the F5 key to run the code. Then the Macro will be stopped, please rerun the above code to specify a new interval.

    VBA code: Stop the execution of the macro

    Office Tab – Tabbed Browsing, Editing, and Managing of Workbooks in Excel:

    Office Tab brings the tabbed interface as seen in web browsers such as Google Chrome, Internet Explorer new versions and Firefox to Microsoft Excel. It will be a time-saving tool and irreplaceble in your work. See below demo:

    A system administrator often needs to run a command repeatedly in a certain periods of time. Often such tasks can be easily completed with simple cron commands. In most of the cases this should work, but the shortest period which you can run cron command is every 1 minute. Believe it or not, in many cases this is too slow.

    Run Linux Command Every Second

    In this tutorial, you will learn a simple scripting techniques to monitor or keep a eye on a particular command in continuously running state similar to top command (continuously monitor the process and memory utilization) for every 3 seconds by default.

    We will not stop to discuss the reasons, why you would need to run commands this often. I believe everyone has different reasons for that in their daily jobs or even at home PCs and laptops.

    1. Use watch Command

    Watch is a Linux command that allows you to execute a command or program periodically and also shows you output on the screen. This means that you will be able to see the program output in time. By default watch re-runs the command/program every 2 seconds. The interval can be easily changed to meet your requirements.

    Monitor Memory Usage

    “Watch” is extremely easy to use, to test it, you can fire up a Linux terminal right away and type the following command:

    The above command will check your system free memory and update the results of the free command every two seconds.

    Monitor Memory Usage in Linux

    As seen per the above output, you have a header, displaying information about (from left to right) update interval, command that is being executed and current time. If you wish to hide this header, you can use the -t option.

    The next logical question is – how to change the execution interval. For that purpose, you can use the -n option, that specifies the interval with which the command will be executed. This interval is specified in seconds. So let’s say you want to run your script.sh file every 10 seconds, you can do it like this:

    Note that if you run the command like shown above, you will need to cd to the directory (learn Learn 15 cd Command Examples) where the script is located or otherwise specify the full path to that script.

    Other useful options of watch command are:

    1. -b – creates a beep sound if the exit of the command is non-zero.
    2. -c – Interprets ANSI color sequences.
    3. -d – highlights the changes in the command output.

    Monitor Logged-In Users, Uptime and Load Average

    Let’s say you want to monitor logged-in users, server uptime and load average output in continuously phase every few seconds, then use following command as shown:

    Watch Linux Load Average

    To exit the command, press CTRL+C .

    Here, the ‘uptime’ command will run and display the updated results every 2 seconds by default.

    Monitor Progress of Copy Command

    In Linux, while copying files from one location to other using cp command, the progress of data is not shown, to see the progress of data being copied, you can use the watch command along with du -s command to check the disk usage in real time.

    Monitor Progress of Copy Command

    If you think that the above process is too complicated to achieve, then I suggest you to go for Advance copy command, which shows progress of data while copying.

    2. Use sleep Command

    Sleep is often used to debug shell scripts, but it has many other useful purposes as well. For example, when combined with for or while loops, you can get pretty awesome results.

    If you are new to bash scripting, you can check our guide about bash loops here.

    In case this is the first time you hear about the “sleep” command, it is used to delay something for a specified amount of time. In scripts, you can use it to tell your script to run command 1, wait for 10 seconds and then run command 2.

    With the above loops, you can tell bash to run a command, sleep for N amount of seconds and then run the command again.

    Below you can see examples of both loops:

    for loop Example

    The above one liner, will run the echo command and display the current date, total of 10 times, with 5 seconds sleep between executions.

    Here is a sample output:

    You can change the echo and date commands with your own commands or script and change the sleep interval per your needs.

    while loop Example

    Here is sample output:

    The above command will run until it is either killed or interrupted by the user. It can come in handy if you need to run a command running in the background and you don’t want to count on cron.

    Important: When using the above methods, it is highly recommend that you set interval long enough to give enough time of your command to finish running, before the next execution.

    Conclusion

    The samples in this tutorial are useful, but are not meant to completely replace the cron utility. It is up to you to find which one works better for you, but if we have to separate the usage of both techniques, I would say this:

    1. Use cron when you need to run commands periodically even after system reboots.
    2. Use the methods explained in this tutorial for programs/scripts that are meant to run within the current user session.

    As always if you have any questions or comments, do not hesitate to submit them in the comment section below.

    If You Appreciate What We Do Here On TecMint, You Should Consider:

    TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

    If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

    We are thankful for your never ending support.

    Chris Hoffman is Editor-in-Chief of How-To Geek. He’s written about technology for over a decade and was a PCWorld columnist for two years. Chris has written for The New York Times and Reader’s Digest, been interviewed as a technology expert on TV stations like Miami’s NBC 6, and had his work covered by news outlets like the BBC. Since 2011, Chris has written over 2,000 articles that have been read nearly one billion times—and that’s just here at How-To Geek. Read more.

    Windows 10’s taskbar clock can display the precise time down to the second. This feature requires a registry hack to enable, and only works on Windows 10. Windows 7 users will instead need a third-party utility like T-Clock Redux to do this instead.

    Early beta versions of the taskbar clock did show seconds. However, this caused performance problems in the 90’s, and the feature was removed before the release of Windows 95.

    How to Show Seconds by Editing the Registry

    Warning: The Registry Editor is a powerful tool and misusing it can render your system unstable or even inoperable. This is a pretty simple hack and, as long as you stick to the instructions, you shouldn’t have any problems. That said, if you’ve never worked with the Registry Editor before, consider reading about how to use the Registry Editor before you get started. And definitely back up the Registry (and your computer!) before making changes.

    To get started, open the Registry Editor by clicking Start, typing “regedit” into the box at the bottom of the Start menu, and pressing Enter. Give the Registry Editor permission to make changes to your PC.

    Use the left sidebar to navigate to the following key in the Registry Editor:

    Right-click the “Advanced” key in the left pane and select New > DWORD (32-bit) Value.

    Name the value ShowSecondsInSystemClock and press Enter.

    Double-click the value you just created, enter a value data of 1 , and click “OK”.

    You can now close the Registry Editor. You will have to sign out and sign back in again before your changes will take effect.

    If you want to undo this change, return here and either delete the “ShowSecondsInSystemClock” value or set its value data to 0.

    Download Our One-Click Registry Hack

    If you don’t feel like editing the registry yourself, you can use our downloadable registry hacks. We’ve created two hacks: One that will show seconds in the system clock, and one that will reverse the change and hide seconds from the clock. Both are included in the following ZIP file. Double-click the hack you want to use, agree to the prompt, and then sign out and sign back in again for your changes to take effect.

    These hacks just set the ShowSecondsInSystemClock value in the same way we described above. Running the “Show Seconds In System Clock” hack creates the ShowSecondsInSystemClock value with a value data of 1 , while running the “Remove Seconds From System Clock” hack deletes the ShowSecondsInSystemClock value from your registry. If you’re ever curious what these or any other .reg files do, you can right-click them and select “Edit” to view their contents in Notepad, or any other plain text editor. And, if you enjoy playing with the registry, it’s worth learning how to make your own registry hacks.

    You may also be interested in showing the current day of the week in the taskbar clock. This is possible without visiting the registry at all, as you can easily customize the date format that appears below the time from the standard Control Panel interface.

    Though rare, you may sometimes need to reset your CMOS. The CMOS, also known as the Complementary Metal-Oxide-Semiconductor, is a small chunk of memory used to store your computer’s BIOS or UEFI configuration. This configuration controls what your computer does on boot.

    If you’ve mangled your BIOS with a failed overclocking setup, changed the wrong BIOS settings, or your machine won’t boot properly, returning the BIOS or UEFI to the factory defaults can often set things right. Occasionally, even a virus can corrupt your BIOS. You will lose any custom BIOS configurations during a reset, but those can typically be easily reset. If you have an especially complicated setup, you can often back up your working UEFI settings and restore later. You might not have one now, but it’s a good procedure for the future.

    If you’ve built your own computer, it should be easy to reset your CMOS. Pre-built systems might be a little more picky, but you can normally make one of the methods below work for you.

    Note: for the sake of brevity and recognition, we will use the term “BIOS” below to refer to UEFI and BIOS firmware.

    Resetting Your CMOS with a Case Button

    If you see a button on your computer’s case labelled “Clear” or “Reset,” that will reset your CMOS. This is the easiest method, but not applicable to all computers.

    1. Turn off your computer.

    2. Disconnect your computer from the wall outlet. You can unplug the power from the back of your power supply or from the wall outlet.

    3. Locate the case button labelled “Clear” or “Reset.” It’s typically next to or near the power button.

    4. Hold the “Clear” or “Reset” button down for five to ten seconds, then release it. You may need to use the end of a pen to hold down the button if it’s small.

    5. Reconnect your computer to power and reboot.

    6. Press the correct key to enter your BIOS options. Depending on your motherboard, it can be the . , Delete , F2 , F8 or F12 . Different computer makers use different keys, or you can set Windows 10 to boot into your BIOS for you.

    7. Adjust your BIOS options as necessary. Some motherboards have the option to load “optimized defaults,” which are a great starting point.

    Resetting Your CMOS with a Motherboard Button

    Some higher-end motherboards have a board-mounted button to reset the CMOS. This can be accessed by opening the computer case and locating the button within the case. It will typically be labelled something like “CLR,” “CLEAR” or “RESET.”

    1. Turn off your computer.

    2. Disconnect your computer from the wall outlet. You can unplug the power from the back of your power supply or from the wall outlet.

    3. Press the case’s power button multiple times to discharge any motherboard capacitors.

    4. Locate the correct button on your motherboard. If you’re not sure where to find it, look at your motherboard’s manual. You can find these on your motherboard manufacturer’s or computer manufacturer’s website.

    5. Press and hold the button for five to ten seconds with your finger or the eraser end of a pencil. If you use your finger, make sure to ground yourself by tapping a bare metal surface (doorknobs are great) before touching anything inside your computer.

    6. Reconnect your computer to power and reboot.

    7. Press the correct key to enter your BIOS options.

    8. Adjust your BIOS options as necessary.

    Reset Your CMOS by Reseating the CMOS Battery

    If you have no other way to reset your CMOS, you can erase saved settings by removing the CMOS battery. This battery allows the volatile CMOS memory to stay powered even when the computer is disconnected from an outlet. By removing and replacing the battery, you’ll erase the CMOS, forcing a reset.

    1. Turn off your computer.

    2. Disconnect your computer from the wall outlet.

    3. Press the power button multiple times to clear any capacitors.

    4. Find the CMOS battery on your motherboard. This is most commonly a CR2032 battery, a coin-sized battery as shown below. You’ll find it near the PCI Express slots on most motherboards. Consult your motherboard’s manual for its exact location.

    5. Gently remove the CMOS battery. If it is secured by a metal clip, slide the battery out from under the clip. Take care not to bend the clip.

    6. Wait a few minutes, then replace the CMOS battery.

    7. Reboot your computer.

    Reset Your CMOS with the Motherboard Jumper

    By manually adjusting the right jumper, you can trigger the CMOS clearing function.

    1. Turn off your computer.

    2. Disconnect your computer from the wall outlet.

    3. Press the power button multiple times to clear any capacitors.

    4. Open your computer case and locate the CMOS clearing pins. It will typically be a two- or three-pin configuration mounted on the motherboard labelled “CLEAR,” “RESET,” or even “CLRPWD” for “clear password.”

    5. On a three-pin configuration with a shared middle pin, move the plastic jumper over to connect the middle pin and the previously disconnected pin. For a two-pin configuration, remove the jumper completely.

    6. Wait a few minutes, then return the jumper to its original configuration.

    7. Reboot your computer.

    You will be able to reset your CMOS using any of the above methods. Let us know if it is working for you. Once everything’s working, take the time to optimize your BIOS settings.

    Our latest tutorials delivered straight to your inbox

    Hello coders!! In this article, we will understand the concept of auto clicker in python. We will first understand its meaning and its implementation in python. So without wasting any time, let’s get straight into the topic.

    What is an auto clicker?

    Auto clicker is a script available in python that facilitates the user to repeatedly clicking their mouse within small delay intervals. It is controlled by user-defined keys and works on every environment – Windows, Mac, and Linux. To achieve this, we will use a module called PyAutoGUI in Python. This will allow us to control the mouse and monitor the keyboard at the same time.

    Ways to Create an Auto Clicker in Python:

    1. Using PyAutoGui
    2. Using Pynput

    PyAutoGUI Installation:

    To install pyautogui, type the following command:

    Key features of PyAutoGUI:

    • Sends Keystrokes to applications
    • Moves the mouse and clicks in the windows of other applications
    • Locate an application’s window
    • Display of message boxes for user interaction

    Keyboard and Mouse Controls using PyAutoGUI:

    PyAutoGUI uses the (x,y) coordinate with the origin (0,0) at the screen’s top-left corner. The x coordinates increase as we go to the right, whereas the ‘y’ coordinates increase as we go down. Currently, PyAutoGUI works only on the primary monitor. It isn’t reliable for the screen of a second monitor. All the presses on the keyboard done by PyAutoGUI are delivered to the window that currently has focus.

    Making auto clicker in Python using PyAutoGUI:

    Making Auto Clicker in Python using Pynput:

    Pynput is a module available in python used to control mouse movements. It can be used to make an auto clicker in python.

    Installation of Pynput:

    To install pynput, type the following command:

    Explanation:

    Importing required modules:

    • Button and controller: to control the mouse.
    • Listener and KeyCode: to watch for keyboard events to start and stop the python auto clicker.

    Declaring important variables:

    • button: a button that will be clicked.
    • begin_end: the key that we will use to start and stop the auto clicker.
    • exit_key: to close and reset the program and reset everything.

    Creating a class to extend threading:

    The thread created will allow us to control the mouse clicks. There are two parameters – delay and button. There are also two flags about whether the program is running or not.

    Creating methods to handle the thread externally:

    • begin(): starts the thread
    • end(): stops the thread
    • exit(): exits the program and resets

    Creating a method that will run when the thread starts:

    This method will run once the thread starts. We will keep iterating through the loop till the value of run_prgm is True. The loop inside the first loop is iterated till the value of a run is True. Once we are inside both the loops, we click the set button.

    Creating an instance for mouse controller:

    The Mouse_click thread that we created will start when the user gets into the loop in the run method.

    Creating a method to setup keyboard listener:

    If the key pressed is the begin_end, it will stop clicking given that the flag is set to true. Otherwise, it will start it. If the key pressed is the exit_key, the exit method is called in the thread and stop the listener.

    Conclusion: Python Auto Clicker

    These are two different ways in which one can create an auto clicker in python. It can be further modified as per one’s requirement.

    However, if you have any doubts or questions, do let me know in the comment section below. I will try to help you as soon as possible.

    On a Windows computer, a sleep timer is available in the Power & Sleep options utility. The sleep timer settings allow you to set a timer to put a computer to sleep after a specified period of inactivity. Unfortunately, if music or a video is playing, the sleep timer will not take effect because there is activity on the computer.

    If you want to automatically sleep or shut down your computer after a time, regardless of activity, a script is required. Select a link below for the type of script you want to create.

    • Shut down the computer after a pre-defined time.
    • Shut down the computer after a user-defined time.

    Shut down the computer after a pre-defined time

    A script to shut down a Windows computer after a pre-defined time consists of three lines of code. The following example code can automatically shut down your computer.

    The first line of code, @echo off, stops the echoing of commands in the Windows command line window. Using @echo off keeps the command line window clean.

    The second line of code, timeout 30, is the command telling Windows to wait a time before executing the next line of code. The number after timeout is the amount of time, in seconds, that Windows waits. You can set this value to your desired wait period. Using the timeout command, a countdown is displayed on the command line window, showing you how much time is left before the computer shuts down. However, you can press any key on the keyboard to skip the rest of the timer and immediately execute the next line of code.

    The third line of code, shutdown -s, is the command to shut down Windows and the computer.

    Using Notepad, add these three lines of code to a blank file, then save the file as a .bat batch file.

    Shut down the computer after a user-defined time

    A script to shut down a Windows computer after a user-defined time consists of four lines of code. The following example code can automatically shut down your computer-based on a timer defined by the user.

    The first line of code, @echo off, stops the echoing of commands in the Windows command line window. Using @echo off keeps the command line window clean.

    The second line of code, set /p timer= “. “, is the command that allows the user to define the timer period. The set command initializes the variable, timer in our code, and assigns the value entered by the user to that variable. The /p switch makes the prompt appear, with the text between the quotes after the equal (=) sign. Without the /p switch, the timer variable would be assigned the text after the equal sign, and no user prompt would show.

    The third line of code, timeout %timer%, is the command telling Windows to wait a period of time before executing the next line of code. The %timer% after timeout is the variable storing the numeric value, the number of seconds, entered by the user, for which Windows waits. Using the timeout command, a countdown is displayed to let you know how much time is left before shutting down. However, if desired, press any key on the keyboard to skip the timer and immediately execute the next line of code.

    The fourth line of code, shutdown -s, is the command to shut down Windows and the computer.

    Using Notepad, add these four lines of code to a blank file, then save the file as a .bat batch file.

    Copyright logo keyboard shortcut and other methods

    • Tweet
    • Share
    • Email
    • Tweet
    • Share
    • Email

    What to Know

    • On a Windows numerical keypad, press and hold Alt while typing 0169. On a Mac, press and hold Option and then press the g key.
    • Without a numerical keypad, press Fn+NumLk. Press and hold the Alt key and type 0169 on the numeric keys. Don’t see numbers? Try MJO9.
    • Alternate Windows method: Open Start and search for map. Choose Character Map. Double-click the copyright symbol and select Copy.

    How to Make the Copyright Symbol in Windows

    With a Numerical Keypad

    For most laptops and other compressed keyboards, the process is different. Look for tiny numbers above the 7, 8, 9, U, I, O, J, K, L, and M keys. These keys act as 0 through 9 when Num Lock is activated.

    Without a Numerical Keypad

    Press Fn+NumLk to turn on Num Lock.

    If this doesn’t work, you may have a designated NumLK key, or it might be mapped to another key.

    Locate the numeric keys. If you don’t see the numbers on the keys, try them anyway: M=0, J=1, K=2, L=3, U=4, I=5, O=6, 7=7, 8=8, 9=9.

    Press and hold the Alt key and type 0169 on the numeric keys (some laptops also require you to press and hold the Fn key as you type).

    Release all the keys to see the © symbol in your text.

    Using a Character Map on a Windows PC

    Open the Start menu, search for map, then select Character Map.

    If you can’t find Character Map, open the Run dialog box (press WIN+R) and then enter the charmap command.

    Using Character Viewer on a Mac

    Go to the Finder menu, then select Edit > Emoji & Symbols.

    The keyboard shortcut for this menu is Control+Command+Space.

    Go to the left panel and select Letterlike Symbols.

    On Android, tap the Symbols key, then tap the 1/2 button on the left side, then tap the degree key. On iOS, press and hold the 0 (zero) key. Then slide your finger over to the degree symbol.

    Windows 10 has been plagued by tons of different issues ever since it was introduced. One of the issues is that the Num Lock not being automatically turned on at startup. Read this post from MiniTool to get the methods to keep Num Lock on.

    Num Lock

    Short for the numeric lock or number lock, the Num Lock is located on the top left corner of the numeric keypad of the keyboard and enables and disables the numeric pad. When Num Lock is enabled, you can use the numbers on the keypad. When Num Lock is disabled, pressing those keys activates those keys’ alternate functions.

    The following are the three most effective solutions that have managed to make Num Lock stay startup.

    How to Keep Num Lock On After Startup on Windows 10

    Solution 1: Turn off Fast Startup

    You can try turning off fast startup. Here is how to do this.

    Step 1: Press the Windows key and R key at the same time to open the Run dialog, type powercfg.cpl and click OK.

    Step 2: Click Choose what the power button does from the left panel.

    Step 3: Then choose Change settings that are currently unavailable. When the User Account Control warning appears, you should click Yes.

    Step 4: Uncheck Turn on fast startup (recommended) and click the Save changes button.

    Now restart your system and check if the Num Lock is turned on. If not, you can try the second solution.

    Solution 2: Use Registry Editor

    If Solution 1 doesn’t work or if you simply don’t want to sacrifice Fast Startup to fix this issue, then you can keep Num Lock on by tweaking certain aspects of your computer’s Registry via the Registry Editor. In order to use this solution, you need to:

    Step 1: Press the Windows key + R key to open the Run dialogue box.

    Step 2: Type regedit and click OK to launch the Registry Editor.

    Step 3: In the left pane of the Registry Editor, navigate to the following directory:

    Computer > HKEY_CURRENT_USER > Default > Control Panel > Keyboard

    Step 4: In the right pane, locate and double-click the registry value named InitialKeyboardIndicators, then click Modify.

    Step 5: Modify the Value data to 2147483648. Then click OK.

    Step 6: Exit the Registry Editor and restart your computer.

    Then you can check whether the Num Lock is turned on or not when you get to the login screen. If not, you can try the last solution to turn Num Lock on.

    Solution 3: Turn the Num Lock off in Your Computer’s BIOS

    The last solution is to turn the Num Lock off in your computer’s BIOS. Here is the tutorial.

    Step 1: Boot into your computer’s BIOS, read this post – How to Enter BIOS Windows 10/8/7 (HP/Asus/Dell/Lenovo, any PC).

    Step 2: Once in your computer’s BIOS, search for an option that dictates whether or not the Num Lock is to be turned on at startup. Then disable it.

    Step 3: Save your changes and exit the BIOS.

    Then boot up your computer, and see whether the Num Lock turns on or not.

    Final Words

    If you find that your Num Lock is turned off, you can try the solutions above to help you make Num Lock stay startup. I think all of them are useful and powerful.

    • Facebook
    • Twitter
    • Linkedin
    • Reddit

    About The Author

    She was graduated from the major in English. She has been the MiniTool editor since she was graduated from university. She specializes in writing articles about backing up data & systems, cloning disks, and syncing files, etc. She is also good at writing articles about computer knowledge and computer issues. In daily life, she likes running and going to the amusement park with friends to play some exciting items.

    BIOS stands for “basic input/output system.” This software checks the health of your computer’s hardware and allows Windows to start. When you turn on your PC, its BIOS runs a power-on self-test (POST) to ensure that the machine’s devices (hard drive, sound card, keyboard, and the like) are connected and working properly. If the test finds no problems, the BIOS turns over control of your PC to another piece of software, typically the operating system.

    Every PC has a BIOS, and you may need to access yours from time to time. Inside the BIOS you can set a password, manage hardware, and change the boot sequence. The BIOS user interface is straightforward and easy to access, but you should take caution when exploring the BIOS–don’t change settings if you don’t know what they do.

    Step by Step: Entering the BIOS

    1. Get ready to act quickly: You need to start the computer and press a key on the keyboard before the BIOS hands over control to Windows. You have only a few seconds to perform this step.

    2. Boot (or restart) the PC: Pay close attention to the first screen that appears. Look for a message that indicates which key you need to press in order to access the BIOS. That key is likely to be:

    –A Function key (such as F1, F2, or F3)

    On this PC, you’d press F2 to enter the BIOS setup menu.

    On some PCs, entering the BIOS may require pressing another key or a combination of keys. Keep your eyes open for an on-screen message that says something like:

    –‘Press F1 to enter setup’

    –‘BIOS settings: Esc’

    –‘System configuration: F2’

    If you don’t catch it the first time, simply try again. Your computer’s documentation may also tell you which key to press.

    3. When you know the right key, start the computer again and press the key when the first screen pops up: You may hear a confirmation beep or see a new message. If you timed it correctly, you’ll be in the BIOS within a few seconds.

    Additional Tips

    Remember, don’t make changes unless you’ve done your homework. Check out “Make Your PC Boot Faster With These BIOS Tweaks” for some ideas about tweaking the BIOS for speed.

    Keep your BIOS current. The process of updating the BIOS is fast and simple. Note the existing version of the BIOS, and check the support section of your computer manufacturer’s website for updates. For a step-by-step guide, read “How to Update Your BIOS.”

    Playing games with errors and continuous crashes is the most frustrating thing for a gamer. Fortnite is one of the most popular games around, but frequent crashes are making it difficult for users to keep playing the game. Recently, a lot of Windows users also reported that the game freezes and hangs. If you are one of those users whose Fortnite randomly freezes then this article is for you.

    Fortnite Keeps Freezing? Try these Fixes

    Tired of the Fortnite freezing and stuttering issues? Stop pondering over ‘why does Fortnite keep freezing’ and focus more on finding the fix. We have summarized a list of solutions that you can try to solve the issue. Try them out!

    Fix #01: Check your computer specs

    Every game has a set of minimum system requirements to run it on your PC. If your PC doesn’t meet these requirements, then you’re likely to run into crashing, freezing and other performance issues. Here’s the minimum system requirement for Fortnite:

    • Processor: Core i3 2.4GHz
    • RAM: 4GB
    • HDD: 16GB Free Space
    • Graphics Card: Intel HD 4000
    • OS: Windows 7, 8, or Windows 10 64-bit
    • DirectX: Version 11 or better

    Now, follow these steps to check your system information:

    1. Press Win+R key to open the Run dialog.
    2. Type “dxdiag” in the input field and click OK. This will open the DirectX Diagnostic Tool window.
    3. Check the required settings in the System tab.
    4. Next, click the Display tab to check your graphics card’s information.

    Update your hardware if it doesn’t meet the minimum requirements to run the game.

    Fix #02: Install the latest Fortnite patch

    Sometimes, playing the old version of the game also ends up in crashes and freezes. Developers of Fortnite continuously release new updates to fix bugs and issues in the game. Go to Fortnite’s official website and check if there is any update available. If so, install it and see if the game still freezes. If it does, then move to the next fix.

    Fix #03: Run Fortnite as an Administrator

    Your Fortnite might be freezing because it can’t access certain game files and folders on your computer. Try running the game as an administrator to see if that’s the problem for you.

    1. Exit Epic Games Launcher.
    2. Right-click on the Epic Games icon and select Run as Administrator.
    3. Restart the game and see if the issue persists.

    Fix #04: Update your graphics driver

    Your game’s performance is heavily dependent on your graphics card, which is why an outdated or corrupted graphics driver can make your game crash or freeze. You can simply update your driver to get rid of this problem.

    All you need to do is visit the official website of your graphics card manufacturer (Nvidia, AMD, or Intel), and search for the most recent correct driver. Don’t forget to check if it is compatible with your variant of Windows system.

    Download and install the driver on your computer. Then restart your computer and launch the game again to see if it still freezes.

    Fix #05: Verify the integrity of your game files

    This issue might happen if any of the game files is missing or damaged. To fix it, you need to verify your game files on Epic Games Launcher. Here’s how you can do it:

    1. Open the Epic Games Launcher.
    2. Click on Library >SETTINGS.
    3. Click VERIFY.
    4. Now relaunch your game to see if the problem continues to occur.

    Fix #06: Close unnecessary programs

    Sometimes the game freezes because your PC is spending most of its energy on other applications running in the background. Your computer might not have enough power or memory to run the game along with those other apps. Here’s how you can close all the unnecessary programs to let your game run smoothly:

    1. Right-click on your taskbar and select Task Manager.
    2. From here, check the CPU and Memory usage to see which programs are taking the most resources.
    3. Right-click on the program and click End Task.

    Fix #07: Increase your Virtual Memory

    Virtual memory is an addition to your PC’s memory, so when your RAM runs out, the PC starts saving your files in virtual memory. Running out of virtual memory can lead your game to freeze. Here’s how you can increase your virtual memory:

    1. Press the Windows logo key and type “advanced system settings” in the search field. Then click View advanced system settings.
    2. In the Advanced tab, click the first Settings button—the one in the Performance box.
    3. The Performance Options window will show up. Click the Advanced tab, then click Change.
    4. In the resulting Virtual Memory window, uncheck the box next to Automatically manage paging file size for all drives. Then click your C drive.
    5. Click the option button for Custom size, then type 4096 in the text box next to Initial size (MB) and Maximum size (MB).
    6. Click Set, then OK to save your changes.

    Now restart your computer and relaunch the game to check whether your problem has been resolved.

    Fix #08: Turn Off VSync

    You can synchronize the game’s frame rate with your monitor’s refresh rate to reduce screen tearing in 3D PC games. Often, the syncing process can cause your game to freeze. You can easily turn VSync off to avoid this issue.

    1. Launch Fortnite and click on Battle Royale.
    2. Go to Settings.
    3. Find VSync and set it OFF.
    4. If it’s already OFF, try turning it ON, then restart your game and turn VSync OFF again.

    Restart your PC and Fortnite again to test your issue.

    Fix #09: Reinstall Fortnite

    You can also try reinstalling Fortnite if the issue persists. In many cases, when everything fails to work, reinstalling the game is very likely the solution for you. First, uninstall the game from the Epic Games launcher, then download and install it again on your computer.

    We hope these solutions have helped you fix the Fortnite freezing issue on PC. If you have any questions, queries, or suggestions, please leave them in the comments below. Thanks for reading!