12-09-2022 12:40 PM
I want Test stand version selector code. Any one has any idea how to get that?
Solved! Go to Solution.
12-09-2022 01:09 PM - edited 12-09-2022 01:11 PM
Why would you need that piece of code?
(BTW, anything that NI did not provide source code through the installer or on their webpage is considered IP and general users do not have access to them - I would consider TS Version Selector to be the same)
Or do you just need a way to invoke the version selector programmatically?
12-09-2022
05:19 PM
- last edited on
10-28-2024
10:07 AM
by
Content Cleaner
Perhaps version selector CLI would be enough?
12-25-2022 08:49 AM
I am able to call programmatically used ShellCommand that is solved but I have one new issue, I have to read installed TestStand versions in a PC(example TS 2017, 2019) how to get this info, not with vi, but with regedit or any command. Please suggest anyone.
12-25-2022 01:32 PM
@Sanjubn wrote:
I am able to call programmatically used ShellCommand that is solved but I have one new issue, I have to read installed TestStand versions in a PC(example TS 2017, 2019) how to get this info, not with vi, but with regedit or any command. Please suggest anyone.
Instead of asking for bits and pieces, please explain your problem instead of sticking to your way of solving it, maybe others have a better and more elegant solution.
12-26-2022 08:24 AM
I just want to know the installed TS versions, please suggest how to get that?
12-26-2022 10:41 AM
You can get that from NIPM CLI. See for example this https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019SRWSA2&l=pl-PL
12-28-2022 05:22 AM
Thank you I was able to generate the report, but I has too much of information. Can you please help me simplify this, like what is that string that can tell that any specific TS version(here 2017/2019) is installed or not installed in the PC?
I have attached the reports with 2017 TS installed and 2017 TS uninstalled, please have a look. Thank you.
12-29-2022 05:41 AM
The main TS package name format is something like ni-teststand-<version number>-<bitness>
, so you could use, e.g., the following command (with a pattern) to get all TS versions from 201x to 202x (both bitnesses).
nipkg list-installed ni-teststand-20[12]?-x[86][64]
Below you can find help. Read the pattern section to understand better the filtering I used.
nipkg help list-installed
list-installed - Show a list of installed packages
nipkg list-installed [OPTIONS]... [PATTERN]...
Show a list of installed packages.
PATTERN
A Unix-like pattern used to match against the name of the package.
Supported patterns include:
* - matches any number of any characters including none
? - matches any single character
[seq] - matches any character in seq
[!seq] - matches any character not in seq
If not specified, PATTERN returns all possible matches.
OPTIONS
--suppress-incompatibility-errors
Suppress forward incompatibility errors.
WARNING: Suppressing errors could leave your system in an unusable state.
--install-root=<DIRECTORY>
Override the default installation root directory when enumerating
packages for this operation. Applies only to packages with the control
file attribute "Plugin: relative-file".
GLOBAL OPTIONS
--config=<PATH>, -c=<PATH>
Allows the caller to specify an absolute path to a custom configuration
file.
ALIASES
list_installed
I'm leaving parsing for you 😉
12-29-2022 05:52 AM
Thats great!!, thank you. It helped me a lot. One last query is, by any chance do you know how we can redirect this output to a file in Windows? I am using shellexecute but this just executes command but does not redirect the output of this command to a file. I need a mechanism to redirect the output of this command "
nipkg list-installed
to a file and then verify the strings in the file.
I am doing this in my cpp file:
sprintf_s(cmd, "%s", "info-installed");
ShellExecuteA(NULL, "runas", "C:\\Program Files\\National Instruments\\NI Package Manager\\nipkg.exe", cmd, NULL, SW_SHOW); //executes command
i am using below for redirection like,
char cmd[100];
const char* s = "C://report.txt";
FILE *stream;
errno_t err = fopen_s(&stream, s, "w+");
sprintf_s(cmd, "%s", "info-installed > s");
ShellExecuteA(NULL, "runas", "C:\\Program Files\\National Instruments\\NI Package Manager\\nipkg.exe", cmd, NULL, SW_SHOW);
This doesnot redirects the output to report.txt instead it creates files with no data. Please help.