PDA

View Full Version : Registry Question


abnrange
12-12-2008, 12:54 PM
Hello,

Quick question - I have a small exe file that once run I want to set a registry or ini value that, if the exe has already been installed don't install it again. How do I tell the exe not to run again?

On Button Click
File.Open("AutoPlay\\SoftwareDIS\\ImagingFiles\\UniImage.exe", "", SW_SHOWNORMAL);
-- Set the data "Installed" in the Local Machine Registry.
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\IFD5", "ImagingFiles", "Installed", REG_SZ);

Then I would get the value from the registry

value = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\IFD5", "Installed", true);

if value == true then

??????

Thanks

mwreyf1
12-12-2008, 01:01 PM
Would it not be easier to just check for the existence of the file and if it exists don't run it again?

abnrange
12-12-2008, 01:12 PM
So, my exe file once excuted created a folder on the root of C:\call sysprep in the folder is sysprep.inf.


result = File.DoesExist("C:\\Sysprep\\sysprep.inf");
then?????
This is were I get stuck

THanks

mwreyf1
12-12-2008, 01:45 PM
if File.DoesExist("C:\\Sysprep\\sysprep.inf") then
-- DON'T RUN
else
-- RUN FILE HERE
end

holtgrewe
12-12-2008, 01:48 PM
...your test will return a boolean value so you can test for result being true or false.

result = File.DoesExist("C:\\Sysprep\\sysprep.inf");
if result == false then -- didn't find it
-- do your install scripting here
else
-- do a Dialog.Message("Installation Status", "Already Installed")
end

I hope this is what you are asking...

mwreyf1 - sorry, you beat me to it..

abnrange
12-12-2008, 01:55 PM
Thanks that worked great!