Video Screencast Help

ghost explorer quiet mode switch

Created: 29 Jan 2014 • Updated: 03 Feb 2014 | 4 comments
This issue has been solved. See solution.

font-family:"Helvetica","sans-serif";color:#333333">I am calling up ghost explorer from within a php script using the exec() command

echo exec ('X:\scan_ghost\Ghostexp.exe -tf="X:\scan_ghost\temp\catalogue.txt" "X:\upload\Stack.gho"');

This scans the ghost image and outputs the contents to a text file (which we later check for the occurrence of certain files)

All works fine untill ghost has reason to put up an alert window such as "Not a ghost image file" or  "Stack.gho does not exist".

Because It has been called from php I do not see the message box or get the opportunity to respond to it. Therefore my php program hangs as it fails to complete as ghost explorer is still running. I am not really interested in the message box or the alert message as I can check for the absence of the txt file or its contents later.

So .....How do I get ghost explorer to close elegantly and automatically on a failure. I know there is a quiet switch and a batch switch in ghost itself but it appears there isn't one for ghost explorer.

Any help on this would be greatly appreciated as I have spent most of the day trying to come up with a work round.

Thank you

Operating Systems:

Comments 4 CommentsJump to latest comment

EdT's picture

Check out a program called AutoIT from Hiddensoft. You can use this to monitor windows popping up and respond accordingly. Alternatively, you could use TaskKill to kill the running process if an output is not obtained within a default time.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

oddballash's picture

Thank you very much for your advice. I will consider both options and advise progress. (looks like AutoIT is quite involved, so might take a while).

Really appreciate your input.

Thank you.

oddballash's picture

Cheers, all sorted now. Thank you for your suggestions.

Resolution was to kick off the ghostexplorer task in the background and catch its PID (so it didn't wait for completion) from php using $WshShell->Run

.. and at the same time start a timeout using tasktill to stop the PID after a 5mins

If we have a text file, ghostexp finished the scan, will have closed itself down and created the file - which we then check for the occurrence of specific files.

If after 5 mins we have no file we assume ghost has failed or is waiting for an input, we quarantine the imagefile and the timeout takes care of stopping the ghostexp process.

Thanks again!

EdT's picture

Glad to hear you were able to get this sorted using tools you have experience with already - always the best way.  I would be grateful if you could use the "mark as solution" flag to mark the answer that most helped you.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.