PDA

View Full Version : Checking for Version



NewsArchive
12-10-2012, 12:36 AM
Friedrich

Before installing, I need to check what version is already installed on the
disk before installing
The version info is kept in the program INI file. Version=7.04.04
Can SB7 read an INI File? Something like %_SB_INSTALLDIR%\gpconfig.ini

If version = 7.04.04
InstallNewVersion
Else
Quit
End

TIA
Dan Scott
Garage Partner Pro/Invoice Partner
www.garagepartner.com

NewsArchive
12-10-2012, 12:37 AM
Why of course it does <g>
Get INI Value

DUH!

Dan Scott

NewsArchive
12-10-2012, 12:37 AM
Friedrich

Is this code OK for checking version? Just Checking

========================
Set Variable %_LAST_VERSION% to FUNCTION:Get INI Value("Installed") from
"%_SB_INSTALLDIR%\gpconfig.ini"
If %_LAST_VERSION% Does Not Equal (Ignore Case) "7.04.02" Then
Display Message Box "Your are using trying to install out of order" --
"Wrong Install Version"
Exit Installation()
End
========================

Dan

NewsArchive
12-10-2012, 12:37 AM
Dan,

> Is this code OK for checking version? Just Checking

You might want to check for file existence before attempting to read a
value from it.

--
Lee White

RPM Report Viewer.: http://www.cwaddons.com/products/rpm/
RPM Review........: http://www.clarionmag.com/cmag/v11/v11n06rpm.html
Report Faxing.....: http://www.cwaddons.com/products/afe/
---Enroll Today---: http://CWaddons.com

Enhanced Reporting: http://CreativeReporting.com

Product Release & Update Notices
http://twitter.com/DeveloperPLUS

Windows 8 brings us "The Oval, Bumper Car, Roller Coaster of Wait!"

NewsArchive
12-10-2012, 12:39 AM
> You might want to check for file existence before attempting to read a
> value from it.

Pushed that button too soon!<g>

I was going to recommend that you move to version resource within the
EXE instead of maintaining it in an INI file. I understand that you
currently have it in the INI but now might be a good time to go the
other direction with this upgrade and on new installs.

--
Lee White

RPM Report Viewer.: http://www.cwaddons.com/products/rpm/
RPM Review........: http://www.clarionmag.com/cmag/v11/v11n06rpm.html
Report Faxing.....: http://www.cwaddons.com/products/afe/
---Enroll Today---: http://CWaddons.com

Enhanced Reporting: http://CreativeReporting.com

Product Release & Update Notices
http://twitter.com/DeveloperPLUS

Windows 8 brings us "The Oval, Bumper Car, Roller Coaster of Wait!"

NewsArchive
12-10-2012, 12:40 AM
Lee

I do keep track of the version within the app using rUpdate from reibens,
but it is much easier to
simply have SB read an INI file.
Thanks for the heads up on the missing ini file...
Now I just have to remember to increment to the last version in the install
file each time I update.
Changed to this
=================
If %_SB_INSTALLDIR%\GPCONFIG.INI File or Folder exists Then
Set Variable %_LAST_VERSION% to FUNCTION:Get INI Value("Installed") from
"%_SB_INSTALLDIR%\gpconfig.ini"
If %_LAST_VERSION% Does Not Equal (Ignore Case) "7.04.04" Then
Display Message Box "Your are using trying to install a version out
of..." -- "Wrong Install Version"
Exit Installation()
End
Else
Display Message Box "%_SB_INSTALLDIR%\gpconfig.ini does not
exit\nClosi..." -- "Can't find File"
Exit Installation()
End
==================

Dan Scott

NewsArchive
12-10-2012, 12:41 AM
Dan,

> but it is much easier to
> simply have SB read an INI file.

That depends on your point of view.<g> (see attached)

Lee White

NewsArchive
12-10-2012, 12:42 AM
Dan,

First of all, I would suggest to use one of the "Version" conditions (see
screenshot). Then you can even detect a newer installed version.

For example, if the version installed is newer than the version in the
setup.exe, you can display:

---
The setup has detected that version %INSTALLEDVERSION% of [PRODUCTNAME] is
already installed.

This setup installs an earlier version of [PRODUCTNAME].

You will have to uninstall the previous version before installing this
version.
---

And Lee is right. It's better to check the "real" version from an .EXE
version resource. Just use the "Get File Info(File Version)" script
function and you are done. An INI file can be "manipulated" too easily.

Friedrich

NewsArchive
12-10-2012, 07:45 AM
What Lee said. Here is how I do it:

#get file info(File Version [Resource]) from "C:\Clarion
Projects\Clarion 8\RFI\RFIHR\Working\FusionHR.exe" into [PRODUCTVER]
#msg "Current Version: [PRODUCTVER]"

What that does is display the version number during my compiles. But
its my app that checks is a new update is available on the server and if
so, downloads it. It almost identical to how SB7 does its updates. It
even checks if my app is still running and won't proceed until the user
closes it. I do that in my webupdate script:

Loop
Set Variable %RFIHRACTIVE% to FUNCTION:Detect Active
Application("FusionHR.EXE") [File Name]
If %RFIHRACTIVE% Equals "1" Then
Display Message Box "RFI HR is still running. Please save your
work an..." -- "RFI Human Resources is still running"
Else
Put INI Value(RFIHR, Updated, 1) to "c:\MiscUpdate.ini"
Break Loop
End
End

--

Russ Eggen
RADFusion International, LLC

NewsArchive
12-11-2012, 12:28 AM
Lee

I saw that, but thought it would be more work.

Dan

NewsArchive
12-11-2012, 12:29 AM
Friedrich

Thanks, I will take a look at your examples, but I don't want to make it too
hard.
The version thing is only to protect the end user from going backwards and
getting error 47
Not trying to protect anything.

Thanks

Dan

NewsArchive
12-11-2012, 12:29 AM
Thanks Russ

Dan Scott