PDA

View Full Version : Is this possible with AMS?



DTX
10-21-2005, 05:02 PM
Hi, I am building a loader that starts an Access Database, I want to make sure that it doesn't open twice so on the preload I want to add the command...

FindAndCloseProcessByName("MSACCESS.EXE");

Which closes any running instances of Access.

This works in Set Up Factory, and at a push I could use that as the loader, but I want to personalise it a little more, hence me wanting to use AMS

Any help appreciated.

Worm
10-21-2005, 08:26 PM
Look into

System.EnumerateProcesses

and

System.TerminateProcess

The help file has some great example code, so I won't bore you with that.

DTX
10-21-2005, 08:59 PM
Yay! that's the fella!

Many thanks for the pointer.

For others benefit I had to change Lower to Upper as MSACCESS.EXE is upper case

code works a treat...

instances_of_file = 0;
file_to_check_for = "MSACCESS.EXE"; --have all uppercase
processes = System.EnumerateProcesses();

for j, file_path in processes do
file = String.SplitPath(file_path);
if (String.Upper(file.Filename..file.Extension)) == file_to_check_for then
System.TerminateProcess(j);
end
end

Thank very much Worm, very much appreciated.
Cheers
Drew

TJ_Tigger
10-21-2005, 09:00 PM
Is FindAndCloseProcessByName() a built in function in setup factory? You can build the same function in AMS if it is. It would make a cool function.

Tigg

Worm
10-21-2005, 09:05 PM
glad you were able to work it out.

Thanks for posting your code for others, that's what makes this forum such a cool place to hang out. :yes

DTX
10-23-2005, 02:36 PM
Now I'm getting giddy with all these things I can do, I'm starting to be adventurous...

I currently have it so that this Access file loader, displays system date and time, plus operating system (Just because I can ;) ) What I would now like to do is say to user "are thes details correct?" if not click Here and it opens the Default windows Date and Time Properties window.

Is this possible? and is it a Shell command?

Cheers
Drew

Corey
10-23-2005, 02:55 PM
In a small way AutoPlay Media Studio has finally reached that hallowed status of classic apps like Photoshop and Flash in that new users have a "transformation" (as Photoshop guru Ben Willmore refers to it) when they realize all the things they can do with it. I feel it too. I wish there were 36 hours in each day so that I could spend 12 of them just using AutoPlay Media Studio to build all the stuff in my head. :yes

yosik
10-23-2005, 03:33 PM
I wish there were 36 hours in each day so that I could spend 12 of them just using AutoPlay Media Studio to build all the stuff in my head. :yes

You and me both, Corey. I don't know if 36 would be enough, but it would be a start.... ;)
Yossi