Announcement

Collapse
No announcement yet.

Checking If a Particular Program is Running

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Checking If a Particular Program is Running

    AutoPlay Media Studio 5.0 Knowledge Base

    Checking If a Particular Program is Running

    Document ID: IR10087
    The information in this article applies to:
    • AutoPlay Media Studio 5.0 Professional Edition

    SUMMARY

    This article describes how to check if a particular program is running.

    DISCUSSION

    As an example, let us assume that you want to run your program, only if there is not another autorun.exe running on the system. To accomplish this use the Window.EnumerateProcesses action, and check every process against the filename autorun.exe.

    Insert the following code into the On Show event of your page:

    instances_of_file = 0;

    --have all lowercase

    file_to_check_for = "autorun.exe";

    processes = Window.EnumerateProcesses();



    for j, file_path in processes do

    file = String.SplitPath(file_path);

    if (String.Lower(file.Filename..file.Extension)) == file_to_check_for then

    instances_of_file = instances_of_file + 1;

    end

    end



    if instances_of_file > 1 then

    Window.Hide(Application.GetWndHandle());

    Dialog.Message("Error", "Autorun already running: code: already running");

    Window.Close(Application.GetWndHandle(), CLOSEWND_TERMINATE);

    else

    Window.Show(Application.GetWndHandle());

    end

    MORE INFORMATION

    For more information please see the following topics in the AutoPlay Media Studio 5.0 help file:

    • Program Reference | Actions | Window | Window.EnumerateProcesses
    • Program Reference | Actions | Application | Application.GetWndHandle

    KEYWORDS: AutoPlay Media Studio 5.0, Window, Application, Find, Running


    Last reviewed: October 3, 2003
    Copyright © 2003 Indigo Rose Corporation. All rights reserved.
Working...
X