Script Control Message Box

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
AndrewT
Junior Coder
Posts: 38
Joined: Thu Sep 17, 2015 6:06 pm

Script Control Message Box

Post by AndrewT » Tue Feb 16, 2016 4:47 pm

I have a MS program that uses the SQLToCSV VB script. The SQL query is on a large table so it takes a bit longer, but almost immediately a message box comes up that is labeled Script Control. The message says that the script is taking longer than expected to execute and gives the use the option to end or continue. But if you just wait, the message box goes away and the query finishes just fine. The message box doesn't look like the standard MS message format, so I am not sure how it's being generated.

I am wondering of there is a way to disable or delay this script control message box so it doesn't concern the end user?

Thanks,
Andrew

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Script Control Message Box

Post by JRL » Tue Feb 16, 2016 6:39 pm

I use SQLToCSV all the time and have the same issue. Generally not a problem because I'm the one watching it.

One way to remove it would be to make it invisible. Compile this and call the executable each time you are about to run SQLToCSV. The window will still pop up and will possibly cause a slight flicker on the screen before the executable makes it invisible. But very unlikely anyone will ever be able to see the window long enough to be concerned.

The executable will close on its own IF the "Script Control" window pops up. If the window does not pop up then you would need to control the process. The script as posted has a WW_TIMEOUT set to 30 seconds. If the "Script Control" window is not seen in 30 seconds the program will close. Depending on how your script works you may want tighter controls than that. For example, you might, after SQLToCSV completes, check to see if the Executable process is still running and kill it if it is. In that case you would not need the WW_TIMEOUT.

Code: Select all

Let>WW_TIMEOUT=30
WaitWindowOpen>Script Control
GoSub>MakeOpaque,Script Control,0

//Usage:
//GoSub>MakeOpaque,Window Name,Opacity number (0-255) zero is invisible
//For Example
//GoSub>MakeOpaque,Notepad*,90

SRT>MakeOpaque
  If>%MakeOpaque_var_2%=
    Let>MakeOpaque_var_2=255
  EndIf
  If>MakeOpaque_var_1<>
    GetWindowHandle>%MakeOpaque_var_1%,HndWin
    //constants
    Let>GWL_EXSTYLE=-20
    Let>WS_EX_LAYERED=524288
    Let>LWA_ALPHA=2
    //get style attributes of window
    LibFunc>user32,GetWindowLongA,attribs,%HndWin%,GWL_EXSTYLE
    Let>attribs={%attribs% OR %WS_EX_LAYERED%}
    //make window transparent
    LibFunc>user32,SetWindowLongA,swl,%HndWin%,GWL_EXSTYLE,attribs
    LibFunc>user32,SetLayeredWindowAttributes,res,%HndWin%,0,%MakeOpaque_var_2%,LWA_ALPHA
  EndIf
END>MakeOpaque

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts