Jump to content
Sign in to follow this  

Cpu at 50%

Recommended Posts

Here is the code im running on my pc
I juste want to check if the program yyy.exe is running 
If not im killing program xxx.exe
It's alway running at 50% on my vm
Is it normal ? 
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..Program Files (x86)AutoIt3Iconsau3script_v10.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------
 AutoIt Version:
 Author:         myName
 Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
While 1
If Not ProcessExists("xxx.exe") Then
MsgBox(0,"info","xxx Not Running.  Closing yyy")
If Not ProcessExists("yyy.exe") Then Run("C:Program Files (x86)xxxxxx.exe","C:Program Files (x86)xxx")
MsgBox($MB_ICONERROR, "", "Launch xxx")
Thanks !

Share this post

Link to post
Share on other sites

your code is breacking my head ... rly... i dont get the conditional position...

The Wend position is strange ..

it s like there is two way to get the else stat i rly dont get it ... lol


you even can do a while of 1 or 2 seconde ... sleep (1000) or (2000) as you usualy need to save memory and CPU on a VM

Edited by caramen

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote


 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

ADO - Wiki


Share this post

Link to post
Share on other sites


See my sig for how to post code.

Your code as posted generates the following when run through Au3Check...

>"C:Program Files (x86)AutoIt3SciTEtidytidy.exe" "C:UsersADMIN010Documentsbb.au3"
Tidy AutoIt3 v14.801.1932.0   Copyright © Jos van der Zande  August 01,2014
"C:UsersADMIN010Documentsbb.au3"(28) : ### Tidy Error: "else" is likely missing it's opening statement. next line creates a negative tablevel.
"C:UsersADMIN010Documentsbb.au3"(31) : ### Tidy Error: "endif" is likely missing it's opening statement. next line creates a negative tablevel.
!> there were  2 error(s) encountered. look in your source for:### Tidy Error:
+> Tidy AutoIt3 finished. Original copied to:"C:UsersADMIN010DocumentsBackUpbb_old3.au3"
>Exit code: 2    Time: 1.53


The code also seems illogical.  If XXX is running and YYY is not you will run instances of XXX continuously.  You also need a Sleep somewhere to idle the processor.

If you can define what you are trying to do maybe we can help.


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post

Link to post
Share on other sites

What your code does:


IF xxx.exe is not running,

THEN blindly close yyy.exe (which may or may not be running) and exit

ELSE (note: xxx.exe is running!): if yyy.exe is not running, then start xxx.exe

goto :begin

(and then here some unreachable code which is never executed)

In other words, as long as xxx.exe is running and yyy.exe is not running, start another instance of xxx.exe.

In yet other words: if yyy.exe is not running, you are starting addidional instances of xxx.exe as fast as your computer can handle. That must be why your CPU is boiling over. Check your task manager to confirm.

Still, it's hard to guess what you're actually aiming to accomplish with this script, and also it has unreachable code under the WEnd. Did you mean it to be active continuously or just to run it once? Please explain a bit more about the situation you're facing.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post

Link to post
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
Sign in to follow this  

  • Create New...