View Full Version : Decide to "update" or "install"
NewsArchive
10-21-2011, 12:46 AM
My ignorance gets in the way -- AGAIN :-)
Running SB.Ver 7.5.3378
I want to look at the WIN.Registry and decide whether to run the
"Initial Install" script or the "Update Install" script.
I have the following code at the beginning of the User-Interface
script area
Set Variable %_SB_REGISTRY_CURRVER% to FUNCTION:Get Registry
SubValue("APP_CurrentVersion") from
"HKEY_LOCAL_MACHINE\SOFTWARE\WeLoopHATS"
If %_SB_ERRORCODE% Does Not Equal "0" Or %_SB_REGISTRY_CURRVER% Less
Than "1.00.02" Then
... initialize some variables and call
Set Active Setup Type to "Initial_Install"
else
... initialize some variables and call
Set Active Setup Type to "Update_Install"
end
If the key
"HKEY_LOCAL_MACHINE\SOFTWARE\WeLoopHATS"
is NOT in the registry I get what I expect--Install Script
If the key
"HKEY_LOCAL_MACHINE\SOFTWARE\WeLoopHATS"
IS IN the registry and the value of "APP_CurrentVersion" is 1.00.03 I
get what I expect--Update Script
BUT -- If the key
"HKEY_LOCAL_MACHINE\SOFTWARE\WeLoopHATS"
IS IN the registry and the value of "APP_CurrentVersion" is 1.00.00 I
fall into the Update script -- should use the Install Script
Any thoughts greatly appreciated
Guy
NewsArchive
10-22-2011, 02:36 AM
Hi Guy,
> If %_SB_ERRORCODE% Does Not Equal "0" Or %_SB_REGISTRY_CURRVER% Less
> Than "1.00.02" Then
As I understand it, you would like to compare version numbers, right?
But the "Less Than" condition does not work for version numbers. I would
suggest to use the "Version Less Than" condition.
Does this help?
Friedrich
NewsArchive
10-22-2011, 02:36 AM
Hi Friedrich -
Thanks for the reply.
My initial reaction was to be thankful you did not begin your response
with "Hey dummy! Pay attention!" :-)
I made the change, same result. Now I'm wondering if I am handling
"version" all wrong.
Set Variable %_SB_REGISTRY_CURRVER% to FUNCTION:Get Registry
SubValue("APP_CurrentVersion") from
"HKEY_LOCAL_MACHINE\SOFTWARE\WeLoopHATS"
retrieves the version from the registry
The registry "APP_CurrentVersion" subkey
- is a TYPE REG_EXPAND_SZ
- contains the characters 1.00.00
I will
Set Variable %_SB_REGISTRY_CURRVER% to "[PRODUCTVER]"
Registry Value (REG_EXPAND_SZ) "HKLM\WeLoopHATS\APP_CurrentVersion"
= %_SB_REGISTRY_CURRVER% (Initiail Install)
Are leading-zeros in the version the problem?
Any other thoughts?
Guy
NewsArchive
10-22-2011, 02:37 AM
>
> Are leading-zeros in the version the problem?
>
Perhaps in your case, the %_SB_REGISTRY_CURRVER% value is not what you
expect it to be?
See attached test code-snippet. %_SB_REGISTRY_CURRVER% is 1.00.00 and it
executes "Initial_Install" (because version 1.00.00 is less than 1.00.02).
Friedrich
NewsArchive
10-22-2011, 02:37 AM
BTW, do you read from the correct key?
1. One time you say HKEY_LOCAL_MACHINE\SOFTWARE\WeLoopHATS and then you say
HKLM\WeLoopHATS\ (missing "SOFTWARE").
2. And as I understand it you are using "Get Registry SubValue...". I think
your intention was to use "Get Registry Key Value..."
If 1. is just a typo then I am sure it's 2.
Friedrich
NewsArchive
10-22-2011, 02:38 AM
BINGO! So now what? :-)
I've been expecting the %_SB_REGISTRY_CURRVER% value to be the Version
( 1.00.03" or whatever)
I used the Display Message Box ( Thanks for pointing THAT out! ) to
show me the value after
> Set Variable %_SB_REGISTRY_CURRVER% to FUNCTION:Get Registry SubValue("APP_CurrentVersion") from "HKEY_LOCAL_MACHINE\SOFTWARE\WeLoopHATS"
> Display Message Box "Initial Install - %_SB_REGISTRY_CURRVER%" -- ""
> Display Message Box "Update Install - %_SB_REGISTRY_CURRVER%" -- ""
If I rename the Reg.Key to
"HKEY_LOCAL_MACHINE\SOFTWARE\WeLoop_HATS"
the message display is
Initial Install - 0
which fits with what I expect because there is no value there
If the Reg.Key is named correctly
"HKEY_LOCAL_MACHINE\SOFTWARE\WeLoopHATS"
and the SubKey is "APP_CurentVersion" with the
value 1.00.00 in the registry
the message display is
Update Install - 4
NOT what I expect
If I rename the SubKey to "APPCurrent_Version"
and the value remains 1.00.00 in the registry
the message display is still
Update Install - 4
That makes me believe I don't know how to use Version
? where do I go from here ?
some documentation or example installs that I'm overlooking?
Thanks
Guy
NewsArchive
10-22-2011, 02:38 AM
Hi Guy,
> That makes me believe I don't know how to use Version
>
> ? where do I go from here ?
> some documentation or example installs that I'm overlooking?
Just use the correct function and you are done ;-) I think you switched
from "Get Registry SubValue..." to "Get Registry SubKey..." now. But that's
not correct!
See my previous posting. You have to use the "Get Registry Key
Value..."!!!!! In the documentation, you'll find source code examples for
all the GetRegistry functions ;-)
Friedrich
NewsArchive
10-22-2011, 02:39 AM
Thank you sir!
I'm think I've reached the "throw it against the wall to see if it
will stick" point. I'll get fresh cup of coffee, print this thread,
and slow down. As you suggest, I think I'm tripping over my own feet.
I worked with a fellow for several years who used to say "making
idiot-proof applications is really difficult because idiots are so
cleaver". Thanks for dealing with an idiot :-)
See ya later
Guy
NewsArchive
10-22-2011, 02:40 AM
<G> :-)
Friedrich
NewsArchive
10-22-2011, 02:40 AM
I don't know if it was the fresh coffee, or your gently phrased
suggestion I slow down and do it right, but
I WON!
Thanks again Friedrich!
Guy Bernard
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.