<< Click to Display Table of Contents >> Navigation: 3. Script Language > OS and Software > OS and Software Operations |
MiniRobotLanguage (MRL)
IAI. Conditional Statement
If Application Installed
Intention
This command can be used to find out if a specified application is installed. It can also be used, to find out if an program has a specified "Uninstall-Option" like "silent Uninstall" or "Modify/Repair" or not. Standard-Search Pattern can be used.
The most important usage is, to find out, if a specified application is installed.
The following script will do that:
IAI.mozil&ANDTHEN:Fire
VAR.§§APP=$$000
DBP. §§APP is installed.
ELS.
DBP. No such Application installed.
EIF.
May result in this output:
if that program is really installed on that particular PC. You can keep it simple. You can just give a part of what you want.
IAI.firefo
STS.DUMP
ELS.
DBP. No such Application installed.
EIF.
MBX.!
Take a look at these programs:
They both contain the term "block". Lets search them. If we just write:
' Without any option we search for a program NAME
IAI.block
STS.DUMP
EIF.
We search for ANY program with that term "block" in name. Thats the way how we check, if a program is installed. See the result in the picture below.
Now we want to know if that program has a option to be uninstalled. We just add an "|u" for this.
IAI.block|u
STS.DUMP
EIF.
The result is as expected. Because that option is available.
Now we add a check, if an option for a silent uninstall is available.
IAI.Antiblock
' $$000 is the same as $tos$
IAI.$$000|s
STS.DUMP
ELS.
STS.DUMP
PRT.No such option/application available.
EIF.
EIF.
This way you can check, if an application is installed, and also if it has an option to be uninstalled.
You can dig more deep using IAI. You can say "Tell me if there is ANY available Uninstall Option" for this program. We use the "|a" Option for this.
IAI.Antiblock
IAI.$tos$|a
STS.DUMP
ELS.
STS.DUMP
PRT.No such option/application available.
EIF.
EIF.
Now the robot looks if there is a
- silent-uninstall available.
- a normal uninstall-string available.
- a repair/modify string available
if any of these is found (in that order!), it is returned.
You can also say "look only for the silent and the uninstall string". Like this:
IAI.$tos$|su
Then it will only return the silent or the uninstall string. Or evaluate to FALSE (jump to ELS.) if they are not available.
Note that there is a priority, if more then one of these strings is available.
The order of search is always the same: silent,uninstall,modify. The first found will be returned.
If you specify one of the flags u,m or s, then the specified "uninstall-string" must be available to be TRUE. Otherwise IAI. will decide FALSE, even if the application itself is installed.
There is one more thing here. Watch this script, and the result.
IAI.Antiblock
IAI.$$000|$$TXT|a
STS.DUMP
MBX.$$TXT+$crlf$+$tos$
ELS.
STS.DUMP
PRT.No such option/application available.
EIF.
EIF.
As you can see in the picture below, the name of the found application can be directly returned to a variable, instead of the TOS (Top of Stack).
NAI. is the negative form of this statement.
NAI.Antiblock
GII.Antiblock
STS.DUMP
MBX.Ready
EIF.
END.
++++++++++++++++++++++++++++++++++++++++++++++
IMPORTANT:
To verify, if a specified Patch is installed, you can not use IAI.
Instead use this Skript
$$HOT=KB4016871
$$TXT=?path\$$HOT
$$VAR=wmic qfe get hotfixid | find "$$HOT" > "$$TXT"
$$ZIE=?path\$$HOT.bat
CTF.$$ZIE|$$VAR
EXC.$$ZIE
$$PID=#pid#
WPT.$$PID
FIL.Length|$$TXT|$$RES
IVV.$$RES!0
MBX.Patch $$HOT installiert.
ELS.
MBX.Patch $$HOT ist nicht installiert.
EIF.
ENR.
Syntax
IAI.P1[|opt]
IAI.P1|P2[|opt]
Parameter Explanation
P1 - Application to test if installed
P2 - Variable for Result if found.
opt
s - try command-line for silent Uninstallation
u - try command-line for standard Uninstallation
m - try command-line for Modify/Repair
a - (any) get the first uninstall string available.
this option will try the availability of the
uninstall-Information in this order:
- silent
- uninstall
- modify/repair
It will return the first available uninstall string
on the TOS.
Example
'**********************************************
' IAI./NAI. - Sample
'**********************************************
'DBM.2
PRT.=====================================================
IAI.{office&ANDTHEN:Prof&ANDTHEN:2003}&AND:{&NOT:Visio}
VAR.§§APP=$$000
PRT. §§APP is installed.
ELS.
PRT. No such Application installed.
EIF.
PRT.=====================================================
NAI.office
PRT. No such Application installed.
ELS.
VAR.§§APP=$$000
PRT. §§APP is installed.
EIF.
PRT.=====================================================
END.
Remarks
The IAI. command works transparently with both x32 and x64 applications.
Technically the command reads the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
to get these information.
IAI. as well as GII. as well as "InstaRec" build the Name of the Program using a Combination of the "DisplayName" and the "DisplayVersion" Properties. Therefore you can more easily separate which Software you want to deal with.
Limitations:
This command looks for standard information details at:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
If the application being tested for installation did not register this information, the command will not be able to retrieve installation information.
See also:
• GII. - Get-Installation-Information