RPA primary simulates user inputs in software applications or uses API calls. To be able to perform this operation at all, these software applications, additional tools and programming languages are required on the robot machine. You have different options to deploy these, which are necessary in the context of an automation process, on your robot machine. For example you can deploy the software as NuGet package or as Microsoft Installer (MSI). In this post I present one possibility how to verify the presence of software, on a robot machine, where the deployment is outside the control of the RPA platform.
First an approach of a comparison of advantages and disadvantages of using a NuGet package or Installer:
Advantages | Disadvantages | |
NuGet Package |
|
|
Installer |
|
|
It is to be estimated individually which way is the better one or whether perhaps a mixture is used, depending on the use case and the necessary software with its license conditions. If the case arises that necessary software applications may not be available on the robot machine, e.g. in the case of a massive scaling that was not foreseeable, here an approach for checking whether the software application is installed, i.e. entered in the Windows registry. Here an Invoke Code routine to read all software installations and to check if the desired one is present:
//-Begin----------------------------------------------------------------
string displayName;
string displayVersion;
DataTable dtUninstall = new DataTable();
dtUninstall.Clear();
dtUninstall.Columns.Add("displayName");
dtUninstall.Columns.Add("displayVersion");
Microsoft.Win32.RegistryKey[] regKeys = new Microsoft.Win32.RegistryKey[] {
Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"),
Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"),
Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"),
Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall")
};
foreach(Microsoft.Win32.RegistryKey regKey in regKeys) {
try {
foreach(String keyName in regKey.GetSubKeyNames()) {
Microsoft.Win32.RegistryKey subkey = regKey.OpenSubKey(keyName);
displayName = subkey.GetValue("DisplayName") as string;
displayVersion = subkey.GetValue("DisplayVersion") as string;
if(!String.IsNullOrEmpty(displayName)) {
DataRow drUninstall = dtUninstall.NewRow();
drUninstall["displayName"] = displayName;
drUninstall["displayVersion"] = displayVersion;
dtUninstall.Rows.Add(drUninstall);
}
}
} catch {
continue;
}
}
dtUninstall.DefaultView.Sort = "displayName ASC";
dtUninstall = dtUninstall.DefaultView.ToTable();
foreach(DataRow line in dtUninstall.Rows) {
if(line["displayName"].ToString().ToLower().Contains(Name.ToLower())) {
if(!String.IsNullOrEmpty(Version)) {
if(line["displayVersion"].ToString().Contains(Version)) {
Available = true;
}
} else {
Available = true;
}
}
}
//-End------------------------------------------------------------------
The input parameters are Name, this is the program name respectively a part of it, and optional the Version, this is the program version, respectively a part of it. The code delivers the availability as a boolean expression as output parameter.
The following example checks if Edge is available in version 102:
Certainly, the routine can also be extended to check a minimum version. The routine works in the compatibility modes Windows and Windows - Legacy.
Depending on whether a software application is available or not, the bot can now decide how to proceed.
CheckIfProgramIsInstalled.xaml (7.1 KB)