SetupBuilder Community  

Go Back   SetupBuilder Community > SetupBuilder Software Installation System > SetupBuilder - NNTP

Reply
 
Thread Tools Display Modes
  #1  
Old 10-21-2011, 12:46 AM
NewsArchive NewsArchive is offline
Senior Member
 
Join Date: Jan 2005
Posts: 27,144
Default Decide to "update" or "install"

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
Reply With Quote
  #2  
Old 10-22-2011, 02:36 AM
NewsArchive NewsArchive is offline
Senior Member
 
Join Date: Jan 2005
Posts: 27,144
Default Re: Decide to "update" or "install"

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
Reply With Quote
  #3  
Old 10-22-2011, 02:36 AM
NewsArchive NewsArchive is offline
Senior Member
 
Join Date: Jan 2005
Posts: 27,144
Default Re: Decide to "update" or "install"

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
Reply With Quote
  #4  
Old 10-22-2011, 02:37 AM
NewsArchive NewsArchive is offline
Senior Member
 
Join Date: Jan 2005
Posts: 27,144
Default Re: Decide to "update" or "install"

>
> 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
Attached Images
 
Reply With Quote
  #5  
Old 10-22-2011, 02:37 AM
NewsArchive NewsArchive is offline
Senior Member
 
Join Date: Jan 2005
Posts: 27,144
Default Re: Decide to "update" or "install"

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
Reply With Quote
  #6  
Old 10-22-2011, 02:38 AM
NewsArchive NewsArchive is offline
Senior Member
 
Join Date: Jan 2005
Posts: 27,144
Default Re: Decide to "update" or "install"

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
Reply With Quote
  #7  
Old 10-22-2011, 02:38 AM
NewsArchive NewsArchive is offline
Senior Member
 
Join Date: Jan 2005
Posts: 27,144
Default Re: Decide to "update" or "install"

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
Reply With Quote
  #8  
Old 10-22-2011, 02:39 AM
NewsArchive NewsArchive is offline
Senior Member
 
Join Date: Jan 2005
Posts: 27,144
Default Re: Decide to "update" or "install"

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
Reply With Quote
  #9  
Old 10-22-2011, 02:40 AM
NewsArchive NewsArchive is offline
Senior Member
 
Join Date: Jan 2005
Posts: 27,144
Default Re: Decide to "update" or "install"

<G> :-)

Friedrich
Reply With Quote
  #10  
Old 10-22-2011, 02:40 AM
NewsArchive NewsArchive is offline
Senior Member
 
Join Date: Jan 2005
Posts: 27,144
Default Re: Decide to "update" or "install"

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
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 11:39 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright © 2004-2012 Lindersoft