I'm not sure if this helps, but I recently worked with a customer who was performing custom software scans. They did not use a custom script, but we encountered numerous errors trying to scan custom software. We spent weeks to resolve a simple issue that was not documented. Our process for uploading custom signatures was:
Use scanwin-<version>.exe or equivalent scanning application for your platform (e.g., scanlinux-<version>.sh) on a managed server that had custom software installed. This provided us with the signatures of the custom software we wanted to scan.
Use the Software Application Index (SAI) editor to prune the list of discovered software to the list of custom applications we wanted to scan and to provide additional data about the discovered software.
Exported the custom software signatures to XML.
Uploaded the XML using dstool to the SA core.
Performed scans on other managed servers we knew to be running the custom applications.
Our custom applications were never discovered. We eventually learned that during step 2 you need to change the application type from "associated" to "main".
During our debugging we also learned that you need to apply the configuration custom attribute "LOG_MODE=DEBUG" to both the "opsware.server.module.discovered_software" package and the normal "Software Discovery" package if you want to get debug logs for custom software discovery.
Hope this helps some. I can dig up the case details if you need more specific information on discovering software using custom signatures. I'm afraid I can't help much when it comes to creating a custom script to perform software discovery.