PDA

View Full Version : Checking for unexpected error!


ronwilliams
05-28-2009, 06:18 AM
Hi, AMS is the best by FAR! unfortunately I did stuff years ago on another CRAP program with a very unstable runtime! No the client wants it and it is way.. to much work to redo in AMS. soo... I use AMS as frame to run the older "player.exe" application, but now and then PLAYER crashes and gives me the
""""An unexpected error occurred...click CANCEL or SEND report""""""""""
and just sits there without going back to AMS

Is there any way to have AMS be on the lookout for this and restart the app if it happens???

I have :

file_to_check_for = "player.exe";

--------debugging helper
StatusDlg.Show();
StatusDlg.SetMessage(" PLEASE WAIT..............");
Page.StopTimer(num_Interval);
-- now run the program (WaitForReturn = false)
File.Run(_DesktopFolder.."\\OLDER\\SOFTWARE\\eXPORT\\PLAYER.EXE", "", "", SW_SHOWNORMAL, false);

-- here until we see the process active----
repeat
found = false;
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
found = true;
end
end
Application.Sleep(500);
until (found == true);

-- Update debug
StatusDlg.SetMessage("FINISHED,PLEASE WAIT..............");

-- Now the process is running, wait for it to end------------
repeat
active = false;
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
active = true;
end
end

Application.Sleep(500);
until (active == false);

ronwilliams
05-28-2009, 07:53 AM
I think what I am looking for is " something to check the STATUS of a TASK or APPLICATION. If it is Running then OK, if it is NOT RESPONDING then FALSE

or check the status EnumerateProcesses(); ?

ronwilliams
05-28-2009, 10:09 AM
Anybody have any idea on this?

Centauri Soldier
05-30-2009, 04:16 AM
It is likely that you would get more responses if you tabbed your code. If you could post your existing code (from the old player and AMS) we might be able to help a bit more. With all of the plugins and dlls floating around, it might be easier than you think to remake the entire project in AMS.