ich the check is not too complicated (e.g. checking if an executable exists) you can set the preinstalled condition ("Condition for existing installation") of the packet - if this condition is met a package that wasn't executed before and isn't already installed will be set to installed.
This has the advantage that the package will not be downloaded into the cache.
if you can't do the check in this way you have to check it in the script - but remember to do this only if the execution mode is install or you will prevent reinstallations
I would like to recommend to check the registry. You will find all software installation in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall. This is the part which you can see in the program library of the control panel of windows too.
There you have the possibilty to check for the program version if you create a if request for the DisplayVersion value. In the current dsm release you will find a regsearch command. If you using this you can let it searching for the software, because on every key you will find the DisplayName value. So if you know that key is different to the program version, you can use regsearch and put the output in a variable and make a check for the existing or for a special version. In my opinion the best way to do, because its for all application the same way.
Here is an example for greenshot:
!Pre Installation Check
If not CheckInstallMode(imReinstall)
! === Enable for x64 Check
ExitProcEx(Done,'%CurrentPackage.Object.Name% was already installed!')
Im using this in the escript, but you can do this in the properties of the package too. I know in my case the package will be staged, but thats no problem in my case and i like to have it in the escript. its more clearly arranged.