Script Center >
Scripting Forums
>
The Official Scripting Guys Forum!
>
how could i dismiss a dialog--vbscript
how could i dismiss a dialog--vbscript
- As i have an application, but it always pop up a diaglog show me "The filename, directory name, or volume label syntax is incorrect." now, i wonder:
1. if have some method know why this diaglog happen, if there is a program to detect
2. if could write a .vbs to automate dimiss the dialog so that my program could be smooth. could anyone give an example..
--hayden
All Replies
- If you wrote the application, fix it so it isn't looking for an incorrect file ;)
If you didn't writhe the program, as the program's provider what it is looking for.
If the program is looking for a file, folder, or volume that is missing, and your idea of a "fix" is to provide a script to dismiss the dialog box, I'd suggest that yiu just remove the program - it can't be too important to you.
Karl - thanks for your reply Karl
its important to me really. in fact i don't know what cause this error dialog. maybe its a systemic problem. anyway, i wanna get a script to dismiss the dialog box, if vbs could make it true?
-hayden - If you are determined to do it that way, the Sendkeys method can do it. I think it would be best to wrap a script around the launch of your application to handle this, something like this ...
with createobject("wscript,shell")
.run "pathspec\to\yourapp.exe", 1, false
do until .appacativate("titleof App Window"): wsh.sleep 50 : loop
if .appactivate("title of dialog window") then .sendkeys "{enter}"
end with
Tom Lavedas - Thanks Tom
in fact, i've tried as this before, but ENTER key can't dismiss the dialog box, only click mouse to dismiss. And if could hook the message "ERROR_INVALID_NAME" to dismiss the dialog box? and how to do it?cuz i run so many same App. at the same time.. - Are you absolutely sure that the dialog can only be dismissed with a mouse-click. I find that highly unlikely. I'll accept that the Enter key doesn't work, but maybe the spacebar or another key will work. What exactly does the button say that is used to dismiss the dialog? OK? Cancel? Try the first letter of that word. If there is an underlined letter, use it.
To 'hook the message "ERROR_INVALID_NAME"', change the title in the second AppActivate box to that string ...
if .appactivate("ERROR_INVALID_NAME") then .sendkeys " "
However, if the dialog must use a mouse-click, it cannot be done without a third party control, such as AutoItX (use a google search to find it). I don't use it now (though I have in the past), so I can't give you an example, but I know it has that functionality.
Tom Lavedas - Thanks Tom
are you sure if [ .appactivate("ERROR_INVALID_NAME") then .sendkeys " " ] will work? i think appactivate just work for message TITLE, its not work for error handler, am i right?
http://windows.errorpro.com/windowserror.php?ecode=ERROR_INVALID_NAME&descr=MS%20WINDOWS%20OS%20ERRORS - If it is a runtime error that is unhandled, I don't see how dismissing it can help. Doesn't the application exit when the error dialog is dismissed?
I don't think I really understand what your real problem is and therefore doubt I can be of particular help here.
Tom Lavedas - Thank you, Tom.
the application won't exit after dismiss the error dialog, so i want to write a script to auto-dismiss the box. BUT, now i don't think this "fix" idea is a good idea...
anyway, you provide me help.Thanks again..

