Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2006
    Posts
    12

    problem closing a running process..

    I am attempting to close a running .exe file. (SQLSERVR.EXE) I need to terminate or close down the .exe before i delete the folder where the file lives. (i am removing a previous version of a software package before installing a new version using Autoplay) I can find no way to close a running application. after it closes the application, I will delete the associated files, folders, shortcut, and registry keys. Here is what i have started with... any suggestions?

    Code = Dialog.Input("Verification Code", "NOTE: This uninstall procedure works ONLY with WINDOWS XP and WINDOWS 2000. Please enter the code given to you by AccuShade Support.", "", MB_ICONEXCLAMATION);

    if Code == "5TGBHU8" then

    StatusDlg.Show(MB_ICONNONE, false)

    SQLresult = File.IsInUse("c:\\Program Files\\Microsoft SQL Server\\MSSQL\\Binn\\sqlservr.exe");
    if SQLresult == true then

    File.Rename("C:\\Program Files\\Microsoft SQL Server\\MSSQL\\Binn\\sqlservr.exe", "C:\\Program Files\\Microsoft SQL Server\\MSSQL\\Binn\\sqlserver.old");
    File.Delete("C:\\Program Files\\Microsoft SQL Server\\MSSQL\\Binn\\sqlserver.old");

    else

    File.Delete("C:\\Program Files\\Microsoft SQL Server\\MSSQL\\Binn\\sqlservr.exe");

    end


    Shell.DeleteShortcut(Shell.GetFolder(SHF_DESKTOP), "AccuShade Color Retrieval System", nil);

    Folder.DeleteTree("C:\\Program Files\\Matrix", nil);
    Folder.DeleteTree("C:\\Program Files\\Microsoft SQL Server", nil);
    Folder.DeleteTree("C:\\Program Files\\MSSQL7", nil);
    Folder.DeleteTree("C:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Matrix System", nil);

    Registry.DeleteKey(HKEY_CURRENT_USER, "Software\\Plexus Systems LLC", nil);
    Registry.DeleteKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Microsoft SQL Server", nil);
    Registry.DeleteKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Uni nstall\\InstallShield Uninstall Information", nil);
    Registry.DeleteKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Uni nstall\\InstallShield_{401BC821-2FFC-4FC3-981A-74D3D88AE3B3}", nil);
    Registry.DeleteKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Uni nstall\\InstallShield_{821FDAAB-B416-41B9-918A-ECCC2D86636C}", nil);

    Registry.DeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Plexus Systems LLC", nil);
    Registry.DeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Microsoft SQL Server", nil);
    Registry.DeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Microsoft SQL Server Setup{E09B48B5-E141-427A-AB0C-D3605127224A}", nil);
    Registry.DeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Microsoft SQL Server Setup.{EFB70B01-B1F3-4960-AB69-4A280084A60C}", nil);
    Registry.DeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\MSSQLServer", nil);
    Registry.DeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uni nstall\\{689404D2-1C94-44B3-9203-BEC5594FDA7A}", nil);
    Registry.DeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uni nstall\\{821FDAAB-B416-41B9-918A-ECCC2D86636C}", nil);
    Registry.DeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uni nstall\\{401BC821-2FFC-4FC3-981A-74D3D88AE3B3}", nil);
    Registry.DeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uni nstall\\{E09B48B5-E141-427A-AB0C-D3605127224A}", nil);
    Registry.DeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uni nstall\\InstallShield Uninstall Information", nil);

    StatusDlg.Hide();

    Application.Exit(0);

    -- If an error occurred, display the error message.
    error = Application.GetLastError();
    if (error ~= 0) then
    Dialog.Message("Error", _tblErrorMessages[error] "Please contact AccuShade software support at (877) 422-2823 and report this error code.", MB_OKCANCEL, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    end
    end

  2. #2
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    475
    I might be little late and you might have solved the problem, yet i wrote a library to solve the quoted problem.

    ...I can find no way to close a running application...
    Here you can download the ams5 project.

  3. #3
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Take a look also at a post I had a while ago:

    http://www.indigorose.com/forums/showthread.php?t=16889

    There is a command-line option and it works via right-click in day-to-day Windows activities.
    Intrigued

  4. #4
    Join Date
    Jul 2006
    Posts
    12
    this script is to be used as part of an installer/uninstaller. if things go awry, i want the user to be able to click on a single button, put in a code in a input box and have it shut down the process running in the taskmanager, remove the files and registry keys i listed while showing the current progress ( a bar)

    as i mentioned in my first post, i am VERY new at scripting and this was... dropped in my lap, so any help in ... explaining would help as well. i won't list out all the keys this time.. i am still... stuck... (yes, i got if off you guys, it LOOKS like it will do what i want it to, and i KINDA understand it, but there is something i am doing wrong.

    Code = Dialog.Input("Verification Code", "NOTE: This uninstall procedure works ONLY with WINDOWS XP and WINDOWS 2000. Please enter the code given to you by AccuShade Support.", "", MB_ICONEXCLAMATION);

    if Code == "5TGBHU8" then

    StatusDlg.Show(MB_ICONNONE, false)
    function KillProcess (sProcess)
    -- ****( DECLARE LOCAL VARIABLES )****
    local tProcesses = {};
    local tSplitPath = {};
    local sFilename = "";
    local bReturn = false;
    -- ****( GET TABLE OF ALL SYSTEM PROCESSES )****
    tProcesses = Window.EnumerateProcesses(false);
    -- ****( TRAVERSE THE PROCESS TABLE )****
    for nHandle, sProcessPath in tProcesses do
    -- ****( SPLIT THE CURRENT PATH, GET JUST FILENAME AND EXTENSION ) ****
    tSplitPath = String.SplitPath("C:\\Program Files\\Microsoft SQL Server\\MSSQL\\Binn\\sqlservr.exe");
    sFilename = tSplitPath.sqlservr .. tSplitPath.exe;
    -- ****( IF THE CURRENT FILENAME/EXTENSION MATCHES PASSED )****
    if String.CompareNoCase(sFilename, "sqlservr.exe") == 0 then
    -- ****( PROCESSES MATCH, TERMINATE IT )****
    Window.Close(nHandle, CLOSEWND_TERMINATE);
    end
    end
    error = Application.GetLastError(0);
    if (error ~= 0) then
    Dialog.Message("Error", _tblErrorMessages[error]);
    else

    Shell.DeleteShortcut(Shell.GetFolder(SHF_DESKTOP), "AccuShade Color Retrieval System", nil);

    Folder.DeleteTree("C:\\Program Files\\Matrix", nil); ..........................

    delete all folders , files, reg keys...

    StatusDlg.Hide(0);
    Application.Exit();

    -- If an error occurred, display the error message.
    error = Application.GetLastError(0);
    if (error ~= 0) then
    Dialog.Message("Error", _tblErrorMessages[error] "Please contact AccuShade software support at (877) 422-2823 and report this error code.", MB_OKCANCEL, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    end
    end
    end
    end

  5. #5
    Join Date
    Jul 2006
    Posts
    12
    Thank you for all the help! got the project in just under the wire!

  6. #6
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    That's a good feeling for sure, victory and "just in time."

    Intrigued

Similar Threads

  1. Problem running File.Run
    By casman in forum Setup Factory 7.0
    Replies: 11
    Last Post: 03-28-2006, 10:23 AM
  2. AMS6: any idea to check if a process is running
    By slafta in forum AutoPlay Media Studio 6.0
    Replies: 3
    Last Post: 03-01-2006, 11:52 AM
  3. Function: Terminate Process
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 05-17-2004, 10:53 AM
  4. Search for running process ?
    By cyberwebwerks in forum AutoPlay Media Studio 4.0
    Replies: 1
    Last Post: 09-08-2003, 01:15 PM
  5. Problem with program closing
    By davinci in forum AutoPlay Media Studio 4.0
    Replies: 6
    Last Post: 08-21-2002, 08:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts