Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Check if a .exe program is running

Engaged ,
Mar 16, 2022 Mar 16, 2022

Hello everyone, everything good?
How do I check if the application (.exe ) is running through script? Thanks in advance.

TOPICS
Actions and scripting
712
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Mar 16, 2022 Mar 16, 2022

checked on win7 cs6

var exe_name = "Roland VersaWorks.exe"

var tmp_name = "tmp.tmp"

system("tasklist >%TEMP%/"+tmp_name)

var file = new File(Folder.temp.fsName + "/" + tmp_name);
file.open("r");
var s = file.read();
file.close();
file.remove();

if (s.search(new RegExp(exe_name, "i")) >= 0)
    alert(exe_name + " is running")
else
    alert(exe_name + " is not running")
Translate
Adobe
LEGEND ,
Mar 16, 2022 Mar 16, 2022

You can check process identificator (pid) with .vbs. Just google it yourself 😉

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 16, 2022 Mar 16, 2022

Hi @Kukurykus ! I have a very complex script exporting in batch after performing some adjustments on images which then opens the "Roland VersaWorks.exe" printing software whenever it is executed, however, the problem is that if it is already is running, shows an unwanted message. My objective is to check if "Roland VersaWorks.exe" is already running, if it's true, don't run it again.
I tried to follow your advice and googled it, but I confess I was not able to understand any of this language.

Captura de tela 2022-03-16 102649.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 16, 2022 Mar 16, 2022

You should type in google same phrase like how to check pid vbs. When you know it you can remove process by command prompt using system() method or still by .vbscript.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Mar 16, 2022 Mar 16, 2022

checked on win7 cs6

var exe_name = "Roland VersaWorks.exe"

var tmp_name = "tmp.tmp"

system("tasklist >%TEMP%/"+tmp_name)

var file = new File(Folder.temp.fsName + "/" + tmp_name);
file.open("r");
var s = file.read();
file.close();
file.remove();

if (s.search(new RegExp(exe_name, "i")) >= 0)
    alert(exe_name + " is running")
else
    alert(exe_name + " is not running")
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 16, 2022 Mar 16, 2022
LATEST

Hi @r-bin, here in the latest version of photoshop/W10 it worked perfectly fine. great. Thanks for sharing.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines