Author Topic: Any way to check for open processes?  (Read 9052 times)

xdanishgamerz

  • Guest
Any way to check for open processes?
« on: August 14, 2016, 08:16:06 PM »
So I am about to make a "general" profile where I open and close applications.
But I'm not sure if I can, for example, say "launch steam" and if steam already is open, make voice attack respond with TTS saying that its already open if the steam process is already running. And if its not, make it launch it.

BlackJack

  • Jr. Member
  • **
  • Posts: 68
Re: Any way to check for open processes?
« Reply #1 on: August 15, 2016, 04:25:10 AM »
Hi,

The easiest way is to perform a window function and check if the called window is open.
Code: [Select]
Display window 'Elite Dangerous Launcher' as [Normal]
Begin Text Compare : [{ACTIVEWINDOWPROCESSNAME}] Equals 'EDLaunch'
   Close 'EDLaunch' process
   Pause 0,3 seconds
End Condition
This will not work, if the process has now Window or is minimized to system tray. (to tasklist works!)

Or you use the windows command process:
Code: [Select]
Run application 'CMD' -with parameters '/c tasklist /FI "IMAGENAME eq EDLaunch.exe" >"%Temp%\VoiceAttackTemp.txt"' (hidden) - wait until it completes

xdanishgamerz

  • Guest
Re: Any way to check for open processes?
« Reply #2 on: August 15, 2016, 08:28:08 AM »
Is there a way to program a command with text like how you wrote?

BlackJack

  • Jr. Member
  • **
  • Posts: 68
Re: Any way to check for open processes?
« Reply #3 on: August 15, 2016, 05:25:07 PM »
I've made a command for each variant.
Hope that helps. ;D
« Last Edit: August 17, 2016, 04:54:06 PM by BlackJack »

xdanishgamerz

  • Guest
Re: Any way to check for open processes?
« Reply #4 on: August 16, 2016, 12:53:35 PM »
holy s#|+, didn't know you could use the CMD like this, is there some sort of API where you can learn these functions from?
Many thanks tho'.
I have a idea how it works but its a lot more complex than what I thought it would be haha .D!

xdanishgamerz

  • Guest
Re: Any way to check for open processes?
« Reply #5 on: August 16, 2016, 12:59:15 PM »
The one by name, what does it mean when you write {TXT:Process} I understand the Process part, but not hte TXT, where does that come from?

You also you use TXT:Activewindowstitle to remove the variable again, but not to set it?
I hope you will help me understand this better, if you got time ofc haha :D!
« Last Edit: August 16, 2016, 01:06:36 PM by xdanishgamerz »

BlackJack

  • Jr. Member
  • **
  • Posts: 68
Re: Any way to check for open processes?
« Reply #6 on: August 16, 2016, 05:57:58 PM »
The one by name, what does it mean when you write {TXT:Process} I understand the Process part, but not hte TXT, where does that come from?
I'm not sure if I understand, but I'll try to explain:
That is the way you call a token (variable) in VoiceAttack, such as {TXT:Name} for Text or {INT:Name} for an Integer.
You'll find all of them in the really good help file, that comes with VA.

To make it a little clearer, I added some commends to the 'via name' command.

holy s#|+, didn't know you could use the CMD like this, is there some sort of API where you can learn these functions from?
The command process itself can list all commands. Just open a terminal and write 'help'.
« Last Edit: August 16, 2016, 06:01:58 PM by BlackJack »

xdanishgamerz

  • Guest
Re: Any way to check for open processes?
« Reply #7 on: August 17, 2016, 10:37:25 AM »
Thanks, I will look more at the PDF, didn't know that you could do all of these kind of things.