I am working in a manufacturing company. We manufacture PCB for HDD. Each PCB need to be loaded with firmware in manufacturing process. I would open the application the i would browse for the suitable ini file and then start uploading the FW to PCB.My problem is when I open the application initially it would show some warning message box with window name "Warning" for CRC error. Then I would close this window by clicking OK button or the "X" button int the corner an then load correct ini file and start uploading the process. I would like to create a batch file which will open the FW application close this warning window. I find that there are only three possible ways.

  1. The batch file must virtually press "Enter" key to click OK button to close the warning window.
  2. The batch file must virtually press the corner "X" button to close the warning window.
  3. The batch file must look for the window name "Warning" and close it.

I have surfed through internet for a solution but I end up helpless. If there is any way it would be greatly helpful.


Autohotkey is a great free app that can do what you require - http://www.autohotkey.com/board/topic/20202-automatically-clicking-ok-in-a-dialog-box/

TaskKill  /f /Im whatever.exe /t <--Kills all Instances
TaskKill /f /fi "windowtitle eq whatever - Internet Explorer" /im "iexplore.exe" /T <--Isolates the specific But Tricky To Determine Exact window title. The /f is force the /t is any other System process started by it Closes to. 

This will only work if the message window Shows up as a separate Task from the initial application.

--Alternative Method Auto Create VBS Script--

Echo set oshell = createobject("wscript.shell") >PressEnter.vbs        
Echo oshell.sendkeys "{enter}" >>PressEnter.vbs      
Echo wscript.quit >>PressEnter.vbs     
Start PressEnter.vbs     
Del /Q PressEnter.vbs       
  • You can freely edit your own posts but for your protection, this must be done under the original user account. It looks like you may have tried to edit the answer without logging into your account. BTW, the site uses some markdown to format posts to make them more readable. I keep trying to fix that for you and you keep undoing it. I've also tried fixing the strange random capitalization and you put that back, also. I can't be sure the edit is yours, and the formatting changes make it less readable, so I'll vote to reject it. Please review the previous edits. – fixer1234 Jan 30 '17 at 4:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.