You can, but it is not as simple as it sounds. To check for the number of instances of AutoCAD, you would need to use API calls, then you would need to be able to reference the application in order to do what is suggested. It is not impossible, but it is somewhat complex.