# 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 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
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. #### Share this post ##### Link to post ##### 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
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?

##### Share on other sites

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 ProcessExists("chrome.exe") Then
ElseIf $idleTimer < 10 Then ProcessClose("notepad.exe") EndIf EndIf EndIf EndIf WEnd Jos Visit the SciTE4AutoIt3 Download page for the latest versions - Beta files Live for the present, Dream of the future, Learn from the past. #### Share this post ##### Link to post ##### Share on other sites Well, I've tried that but the ElseIf IdleTimer doesn't function.  ElseIf$idleTimer < 10 Then
ProcessClose("notepad.exe")

##### Share on other sites

For which IF is that ElseIf intended? It current is part of the 4th level If.

Live for the present,
Dream of the future,
Learn from the past.

##### 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

##### Share on other sites

There's going to be 16 checks for different processes running so there is going to be 16 IF statements

##### Share on other sites

I did a whole re-code on the script and I some how got it working.

Thanks for the help I guess.

## Create an account

Register a new account

×

• Wiki

• Back

• Git