Complex Shortcut Installshield using variables - installation

I need to create a shortcut for my application in Installshield, and the path to do so is:
C:\app\bin\exe.exe -basekey ini -ininame settings.ini -p cal.p -pf s:\pfs\sec_l_oea.pf
This shortcut is essentially split up into three bits:
C:\app\bin\exe.exe
This is the location of a pre existing software that I would like to find using System Search.
-basekey ini -ininame settings.ini -p cal.p -pf
This will always be the same and does not need any variables
s:\pfs\sec_l_oea.pf
The user should have to browse to find this file.
My problem is I don't know how to get the path for part one, I have set up a System Search to hopefully find it, and store it in the "PROWIN" variable, however, how do I access that variable when setting a shortcut?
I could also do with knowing how to take a user variable (from installation) and set the shortcut depending on that for part 3.
Any help is appreciated

Once you have the file stored in a variable/property I think it can be used in multiple places by putting the name in a string with square brackets around it.
Your argument might look something like this:
-basekey ini -ininame settings.ini -p cal.p -pf [PROWIN]
As a side point: In the installshield termanology, dynamically stored values are always strings and they are refered to "properties" not variables, this might help with future searches.

Related

Similarity measures for WordNet in Prolog

I would like to be able to check if two words are similar (using the path similarity) in WordNet with Prolog.
I found on the internet this article doing exactly what I want.
I'll paste here the steps needed to let this work:
Download WordNet 3.0 Prolog version from
http://wordnetcode.princeton.edu/3.0/WNprolog-3.0.tar.gz
and unzip it in a directory of your choice. For example:
c:\wn_prologDB
Set the environment variable WNDB to this newly created directory.
For example, use either the system dialog box in Control Panel
(Environment Variables), or write in a Command Prompt (cmd.exe):
set WNDB=c:\wn_prologDB
Download the modules of WN_CONNECT from
https://dectau.uclm.es/bousi-prolog/applications and unzip
it in a directory of your choice. For example:
c:\wn
Add to the PATH environment variable the directory where this tool
is located (similar to step 2 above):
set PATH=c:\wn;%PATH%
Open a terminal and execute the shell script:
wn.sh
I followed those steps, and run wn.bat (since I'm using windows).
As you can see from the picture, the wn_word_info predicate is working, while I cannot understand why wn_path is not working.
Here is the signature:
wn_path(+Word1, +Word2, -Degree)
Any tips on how I could get it to work? Or any solution to calculate path similarity?
The signature was a bit different:
wn_path(+Word1:SS_type1:W1_Sense_num, +Word2:SS_type2:W2_Sense_num, -Degree)
So this actually works:
wn_path(cat:A:B, dog:C:D, E).
Here I'm specifying only the word and the other parameters are variables, but one can specify all three the parameters.
I paste here some of the docs I found in the WN_CONNECT folder:
** wn_path(+Word1:SS_type1:W1_Sense_num, +Word2:SS_type2:W2_Sense_num, -Degree):
This predicate implements the PATH similarity measure.
Takes two concepts (terms -- Word:SS_type:Sense_num) and returns the degree of similarity between them. Note that we do not explicitly require information about the synset type and sense number of a word (that can be variables).

Windows show local path as list in the Environmental Variables pane

I like to modify my Windows environmental variables by opening the Advanced System Settings -> Environmental Variables. I particularly like that when I try to modify the system path (by clicking on System Variables -> Path), that I get a nice, easy to read list of the folders on the path:
However, when I click on the User Variables -> Path, I still get the old dialog, which is not very user friendly:
Is it possible to have Windows always display the list, as is the case for the System variables?
For what its worth, I think I remember seeing the desired behavior on a friend's computer, so I believe it should be possible.
EDIT:
It seems that having a variable as part of the path is the problem. Is there a way to get path list even when the path contains variables?
Context:
When I want to add a program to my path, I will create a new variable that redirects to its path. The reason to do that is simple... Programs typically have compound paths, and so making a consolidated variable seems like a wise decision. For instance, on my machine, I have multiple python instances (sometimes I need an Anaconda installation of Python 3.6, and sometimes I want a version of the bare-bones Python 3.5). To accomodate this, I create environmental variables for the paths to each installation.
Now if I want to switch which version is on my path, I can simply update my path variable from
path=...;%PATH_PYTHON35%
to
path=...;%PATH_PYTHON36A%
See how easy that was?
The problem is that the GUI doesn't seem to like this for the local variables. I can confirm that this is the case because when I remove the variables from the local path, I get the nice list like the System Variables case. However, what is perplexing to me is that the System Variables path DOES include some variables as well:
So I take this to mean that there must be a way of getting the local variables list to pop up, just like the System Variables case...
Guess I'm late to the party, but this works for me:
PATH=C:\DATA\bin;%JAVA_HOME%\bin
whereas this does not work:
PATH=%JAVA_HOME%\bin;C:\DATA\bin
A speculation based on my own observations.
It seems list view is only presented when at least one of the first two entries begins either with a drive letter notation (like C:\) or a specific variable. I'm not sure which variables are considered "valid", but here are a few environmental variables that show up as list:
%USERPROFILE%+%LOCALAPPDATA%;aaa;bbb;
aaa;Q:\%LOCALAPPDATA%;bbb;
These however show up as a string:
%LOCALAPPDATA%+%USERPROFILE%;aaa;bbb;
aaa;bbb;%USERPROFILE%;
Not sure what makes %USERPROFILE% different, but i tried a few other variables instead of %LOCALAPPDATA% (%OS%, %HOMEDRIVE%) - result was the same.

Set path in Visual Foxpro

I want to set path in Visual Foxpro. In such a way that I want to keep exe file on local machine and data\tables on server. How can I do so?
I personally have never liked using SET PATH, especially if you have many "paths" that your application is expecting to use.. If you have a given table / file in multiple locations that are visible with multiple paths that qualify, you may be getting the wrong table, but you won't necessarily know it since the application just runs as normal, finds a table and continues.
Instead, I would suggest one of a few things. Yes, have your application on each user's local machine, but have the person's shortcut have the "START IN" folder pointing to the path on the server where your data is. This way, your application will BE in the folder where the data resides and processes without issue. If no data is on the local machine, during your startup, you could add a messagebox about ... hey... your shortcut should be set to "Start In" setting to X:\SomeShareOnServer\MyVFPDataPath...
If not that, then another avenue I have used is to have your application during startup, add a property to the "_Screen" object which will NEVER loose scope, and set that property to the path you have the data located such as...
_Screen.AddProperty( "cDataPath" )
_Screen.cDataPath = "X:\SomeShareOnServer\MyVFPDataPath\"
Then, in your code, any of your opening tables or SQL queries, use the path variable PLUS the table... something like
if not used( "SomeTable" )
select 0
use ( _Screen.cDataPath + "SomeTable" )
endif
if doing a query, use similar approach
select ST.* ;
from ( _Screen.cDataPath + "SomeTable" ) ST ;
where ST.SomeID = 123;
into cursor C_TmpResult readwrite
So, although the second option may take more effort, especially on an existing application, the first option to make sure the "Start In" path is where the data is might help.
Again, this is my suggestion as I hate chasing down ambiguous -- sometimes it works, but not others. If I can't find a file, I WANT TO KNOW about it and fail outright.
Your call, your app, your environment. But if you DO use the "SET PATH" command, you might want to make sure you use the ADDITIVE command, just in case there are other settings, such as pointing to the a path for forms, classes, report folders... You run a SET PATH without it, and you kill your other paths...
SET PATH TO "X:\SomeShareOnServer\MyVFPDataPath\" ADDITIVE
Also, if you have any spaces in your path in question, MAKE SURE you use quotes around it, otherwise it will fail finding the path you expect and may cause compile error, such as
SET PATH TO X:\Some Share On Server\MyVFPDataPath\ ADDITIVE
You can use VFP's Set Path command
Set Path To m.lcDataFolder
early in your client startup code, i.e. in your project's "main.PRG".
Where the content of the m.lcDataFolder could for example come from something like a custom "myConfig.XML/INI/TXT" containing the desired string, e.g. \\fileServerNameOrIP\sharedDataFolder
Use 'SET DEFAULT TO' to change the current working directory or use explicit full paths as per the answer by #DRapp.

Should environment variables that contain a executable-path with spaces also contain the necessary quotes?

When defining an environment variable (on Windows for me, maybe there is a more general guideline)
set MY_TOOL=C:\DevTools\bin\mytool.exe
if the tool is located on a path with spaces
set MY_TOOL=C:\Program Files (x86)\Foobar\bin\mytool.exe
should the environment variable already contain the necessary spaces?
That is, should it read:
set MY_TOOL="C:\Program Files (x86)\Foobar\bin\mytool.exe"
instead of the above version without spaces?
Note: In light of Joeys answer, I really should narrow this question to the examples I gave. That is, environment variables that contain one single (executable / batch) tool to be invoked by a user or by another batch script.
Maybe the spaces should be escaped differently?
I'd say, do it without quotes and use them everywhere you use the variable:
set MY_TOOL=C:\Program Files (x86)\Foobar\bin\mytool.exe
"%MY_TOOL%" -someoption someargument somefile
Especially if you let the user set the value somewhere I guess this is the safest option, since they usually tend not to surround it with quotes rather than do so.
If there are plenty of places where you use the variable you can of course redefine:
set MY_TOOL="%MY_TOOL%"
which makes things more resilient for you. Optionally you could detect whether there are quotes or not and add them if not present to be totally sure.
When your variable represents only a path to a directory and you want to append file names there, then the "no quotes" thing is even more important, otherwise you'd be building paths like
"C:\Program Files (x86)\Foobar\bin"\mytool.exe
or even:
""C:\Program Files (x86)\Foobar\bin"\my tool with spaces.exe"
which I doubt will parse correctly.
The command shell can answer your question: type C:\Pro and hit the tab key.
Autocomplete will leave all spaces as-is and add quotes around the filename. So, this is what is "officially" expected.
(this assumes that autocomplete is turned on, I'm not sure whether the default is on or off, but most people have it on anyway, I guess)

Registry does not like long filename for shell commands or verbs

(if not applicable to SO, please refer to another appropriate place, thanks).
When using the registry to associate file extensions and application, I put in the full filename of my application, but that does not work well, only if I use the 8.3 filename.
for example ( taken from the registry) this works:
[HKEY_CLASSES_ROOT\Toto.Document\shell\myVerb\command]
#="C:\\my\\path\\bin\\Debug\\bin\\myexe_~1.EXE /dde"
[HKEY_CLASSES_ROOT\Toto.Document\shell\myVerb\ddeexec]
#="[myVerb(\"%1\")]"
but this does not work :
[HKEY_CLASSES_ROOT\Toto.Document\shell\myVerb\command]
#="C:\\my\\path\\bin\\Debug\\bin\\myexecutable.EXE /dde"
[HKEY_CLASSES_ROOT\Toto.Document\shell\myVerb\ddeexec]
#="[myVerb(\"%1\")]"
The action is called by right-clicking on the file in Explorer, I get the error :
"Windows cannot find 'c:\users\me\desktop\tata.toto'. Make sure you typed the name correctly, and then try again".
I'm creating the keys programatically with CRegKey and using GetModuleFileName to get the application path.
2 questions :
- I'm probably missing something in my registry entry ? (i've tried quoting the paths, but does not work)
- Can I get the "short" filename ? (searching a little bit seems that GetShortPath should work, but not always!)
Thanks.
Max.
(edit 22/03/2011)
I tried using quotes but it did not work (with /dde)
I decided to use normal parameters instead of /dde and it seems to work nicely with the normal path (not shortened like stated above).
I'm still not certain why when creating a simple MFC SDI project it will write out registry values with the old short name instead of the long name.
Thanks again.
Max.
Try creating the key with another couple of double-quotes (note between .EXE and /dde:
#="C:\\my\\path\\bin\\Debug\\bin\\myexecutable.EXE" "/dde"

Resources