| Newsgroups |
gmane.comp.windows.gui4cli |
| Message-ID |
<[email protected]> |
Hi Dimitris,
I looked at "$$g4c.isinstall" but it gives not enough info for what I want to do.
In my case it is the executable that need to check but "$$g4c.isinstall" returns
zero (0) when called from the executable, even if g4c IS installed.
The example you gave in your previous post however to extract the INSTALL:
and HOME: paths is quite versatile and useful.
To find out if g4c IS installed there are a few "what if's" to consider.
At installing g4c, the user is free to choose it's own location and folder name
so you can't rely on the name Gui4Cli" in the path.
I have tested this on two systems with and without g4c installed and found
that if g4c is NOT installed, INSTALL: return something like;
"C:/my_apps/Avanti-gui/INSTALL:"
If g4c IS installed, INSTALL: could return something like;
"D:/my_apps/whatever/"
so I have to check out in more detail. To do so, I came to this;
// extract clean install path
install = 'INSTALL:'
extract install FULLPATH
extract install UNQUOTE
repVar install 'INSTALL:' ''
// extract clean home path
home = 'HOME:'
extract home FULLPATH
extract home UNQUOTE
ifexists FILE '$install/gui4cli.gui'
... remove only Avanti related registry keys.
elseif $install = $home
... remove all Gui4Cli keys from the registry.
endif
This seems to be quite safe when used in a executable, unless you change the
"gui4cli.gui" name in future versions :)
The second condition "elseif $install = $home" is also true during development
when running the script but it will still trigger on the first. It is NOT true
when running the exectable and g4c IS installed so there it is a double check.
It could be done easier if I not clean up the INSTALL: return path and check for
the word "INSTALL:" with "searchVar install '/INSTALL:' FIRST".
This is only there from a executable if g4c is NOT installed.
Aside from the conditions if g4c IS/ISNOT installed, there is a third condition
for which I can't find a solution.
This is when the system doesn't have g4c installed but there are Gui4Cli keys
in the registry because the user runs another g4c executable.
I suppose when I do a first run of my executable on a system with a "clean"
registry, g4c will immediately create the keys and that there is no way
to check the registry before it does?
I came to this registry cleanup option because a Avanti user told me he is
running it from a memory stick on host machines. Then it would be nice if he
could leave the machines registry "clean" when the job is done. Of course this
is not done automatically and the user has to confirm the operation.
BTW; I tried it on Windows 7 with g4c installed on a non-admin and guest account
and was surprised it let me remove the Avanti related keys without any complaints.
Interresting stuff to play with :)
Chris
---In [email protected], <gui4cli@...> wrote :
Hi Chris,
From version 19.31
Added $$G4C.ISINSTALL, which = 1 if the gui4cli executable you are running
is the one installed in this system (if any g4c is installed, else = 0)