PDA

View Full Version : Add Action or Script?


Mythwyn
01-01-2004, 05:27 PM
First off I am quickly coming to terms with v5 but still have some ways to go before accessing the full power of new features. I appoligize if earlier posts painted me as a malcontent, just a bit of frustraition. (would still like a "switch" to turn off default settings).

I'm trying to leverage some of the new features of v5 for a reworking of a v4 tool I made to install XP critical updates. I'm looking for a bit of guidance concerning the best route.

What I want to do is a [Registry.DoesKeyExist] to see if particular Hotfixes have been installed.
example:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Upda tes\Windows XP\SP2\KB817778

I then want to use the result variable as a switch for a [File.Run] to install the update is the variable is false.
My question is one of accessing the variable and getting it to the [File.Run] my feeling is a "if" command. But since I want to check on the existance of several hotfixes and generate switch to install any false result variables, should I be dealing with tables?

Mainly once I can understand how to convert a result variable to a [File.Run] I can see there may by several ways to accomplish the action. Would appreciate help on the convertion and thoughts on the best means to do this for several results.

On a side note, once I get this, I'll also be looking to create a display of the [DoesKeyExist] that would say "4 of 10 Hotfixes Needed" in a text label. Thats what has me thinking a table may be needed, am I right.

Thanks Much,

Mythwyn
01-01-2004, 10:14 PM
Heres what I figured out.

01 -- A check to see if a particular registry key exists, "Result" is the container for true/false value
02 Result = Registry.DoesKeyExist (HKEY_LOCAL_MACHINE, "Software\\My Application\\Key");
03 -- An if ... else statement that checks boolean value and evokes one of two actions
04 -- The "if" seems to assume a true value, and passes to then, no "=" needed
05 if (Result) then
06 Dialog.Message("Notice", "Exists", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
07 else
08 Dialog.Message("Notice", "Does Not Exist", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
09 end

I used a dialog just for testing, but should be able to use any or multiple actions with simular format.

Figured maybe this will help someone else.