Jump to content

Create an AutoIt Script that Checks if Mulitple softwares are running.


Recommended Posts

Okay, I'm brand new to this, 1 Day to be exact. I was up till 3 this morning trying to figure out how to write a script for this and I can't figure it out.

What I'm trying to do is write a script that checks if my Computer has been Idle for 3 Minutes If it has been idle for 3 min, I want to check if a list of Software/Windows are NOT running if they are NOT running then I want it to start a software.

Then

When my computer stops being Idle I want it to check if a list of software/windows are running if they are running Kill them if Not then do nothing.

This needs to be in a loop I think so it constantly checks for my computer becoming idle.

I didn't write this in my code but I also need something to check if my system has been idle for 32Min then Kill FireFox. (I Often Leave Firefox open by accident and the script won't run if i leave it open)

#include <Timers.au3>
While 1
    Sleep(10)
   $idleTimer = _Timer_GetIdleTime()
   If $idleTimer > 10000 And Not WinExists(("Administrator: C:\Bitcoin\MPM_v2714\MultiPoolMinerV2.7.1.4\Start-MiningPoolHub.exe") _
        And Not WinExists("Administrator: C:\Bitcoin\MPM_v2714\MultiPoolMinerV2.7.1.4\Start-MiningPoolHub.exe") _
        And Not WinExists("Administrator: Start-MiningPoolHub") _
        And Not ProcessExists("C:\Bitcoin\MPM_v2714\MultiPoolMinerV2.7.1.4\Start-MiningPoolHub.exe") _
        And Not ProcessExists("F:\Program Files (x86)\Origin Games\Battlefield 1\bf1.exe") _
        And Not ProcessExists("F:\Program Files (x86)\Steam\GameOverlayUI.exe") _
        And Not ProcessExists("C:\Program Files (x86)\Common Files\Acronis\TrueImageHome\TrueImageHomeService.exe") _
        And Not ProcessExists("C:\Program Files\iTunes\iTunes.exe") _
        And Not ProcessExists("F:\Program Files (x86)\Overwatch\Overwatch.exe") _
        And Not ProcessExists("C:\Users\datea\AppData\Roaming\Twitch\Bin\Electron\TwitchUI.exe") _
        And Not ProcessExists("C:\Program Files (x86)\VideoLAN\VLC\vlc.exe") _
        And Not ProcessExists("F:\Program Files (x86)\Other\STC\SortTheCourt.exe") _
        And Not WinExists("Minecraft Launcher S0.0.3")) Then
            While Not ProcessExists("notepad.exe")
                RunWait("notepad.exe")
            WEnd
   ElseIf $idleTimer = 0 Then
      ProcessClose("notepad.exe") And
      WinClose("")
   EndIf
WEnd

I did attempt it so I'm not just coming here for the code and leaving. If anyone can help me it would be really appreciated.

 

If anyone's curious about what I'm trying to build. I'm trying to make a script that runs a Bitcoin Miner when my system is idle. When it checks if a software is not running its checking for FireFox, Twitch, VLC, Steam because those are video apps and games and I don't want my Bitcoin Miner to run during those because when it runs it causes my system to freeze up and lag.

Thanks for your time and I hope someone can help me.

Link to comment
Share on other sites

#include <Timers.au3>


While 1
    Sleep(10)
    $idleTimer = _Timer_GetIdleTime()
    If $idleTimer > 10000 And Not ProcessExists("notepad.exe") Then
        If Not WinExists("Administrator: C:\Bitcoin\MPM_v2714\MultiPoolMinerV2.7.1.4\Start-MiningPoolHub.exe") Then
            If Not ProcessExists("hiopad.exe") Then
                If Not ProcessExists("chrome.exe") Then
                    RunWait("notepad.exe")
    ElseIf $idleTimer < 10 Then
        ProcessClose("notepad.exe")
                EndIf
            EndIf
        EndIf
    EndIf
WEnd

 

I did some more work on it today and I have most of it working I'm just stumped on why the ElseIf isn't working. Anyone have any suggestions?

Link to comment
Share on other sites

  • Developers

Are you still puzzled when you properly format the source?

#include <Timers.au3>


While 1
    Sleep(10)
    $idleTimer = _Timer_GetIdleTime()
    If $idleTimer > 10000 And Not ProcessExists("notepad.exe") Then
        If Not WinExists("Administrator: C:\Bitcoin\MPM_v2714\MultiPoolMinerV2.7.1.4\Start-MiningPoolHub.exe") Then
            If Not ProcessExists("hiopad.exe") Then
                If Not ProcessExists("chrome.exe") Then
                    RunWait("notepad.exe")
                ElseIf $idleTimer < 10 Then
                    ProcessClose("notepad.exe")
                EndIf
            EndIf
        EndIf
    EndIf
WEnd

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Okay, so what i'm trying to do is go through a list of checks and then after the last if is run and completes the checks it runs the Process. Well then the ElseIf is saying that when I move my mouse at Any Time it will close that Process

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...