Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MsgBox Popup

Status
Not open for further replies.

rbri

Programmer
Jun 27, 2002
84
US
Hello Everyone:

Does anyone know if there is away to create a MsgBox that will popup with some information you have given it but allows the program to continue to run. In other words you do not have to pick the OK button to continue the script the window just pops up and the script just keeps on going.
Thank you in advance for your help.

Thanks Randy
 
rbri,

Couple of questions.

1) You are talking about VBScript?

2) Are you talking about creating a VBS script to run from WSCRIPT?

3) You are talking about a non-modal dialog box that would pop up, display something but not restrict the application/VBScript from running?

If the above is true, suggest you look at about 2/3's down the screen. Not really sure if this will do what you are looking for, and does involve using a control (.ocx)

This probably needs to be answered by dilettante or one of the other Forum Experts.

Hope you get your answer.
DougCranston
 
It's just us chickens in here dougcranston. I think "expert" here means "been answering a lot and nobody got too mad at you."

Was that one of this guy's pages??


The link I gave above talks about non-modal dialogs in WSH, and how they are really a no-no in WSH. But he does offer a tip or two on how to achieve them nonetheless. ;-)

People wander in here and ask "VBScript" questions w/o context a lot. Knowing what exactly rbri's environment in will help a lot in answering the question, as you suggest.

If it is WSH, and as you say WScript and not CScript, I'd suggest creating an HTA instead. HTA's aren't perfect WSH/WScript replacements, but they offer many goodies WSH can't offer.
 
Sorry for not giving more content. I made alot of assumptions and they all seemed to be wrong. We all know what happens when we assume I need to remember that.
Here is my excuses:
1. I thought that only VBScript type questions where addressed in here.
2. I thought that there was only one type of vbscript but from the above question unless I am not understanding the that question. I didn't realize that vbscript takes on a different mode depending on which scripting engine you chose to work with Wscript or Cscript. Until a few months ago all my programming and scripting was done in UNIX. In UNIX a particular scripting language syntax say posix remains constent throughout the language reguardless of what other scripting languages you might call or use inside of that posix script.
3. I thought that there was only one way to create a message box in vbscript and that was to call MsgBox reguardless of what scripting engine was used.
That's it for my excusses.
From the above questions number 3 sounds what I am trying to do. Again let me apoligize for not giving enough content on my question. I will remember that for the future. Thank you for all your help I will try the above links. Thanks again

Randy
 
To rbri AND dilettante,

dilettante. Point taken. However out of respect, and honesty, your skill level is considerably past alot of us, and you willingness to share makes you and the others "experts". Does that mean you have all the answers, no. To suggest that is wrong. However, you make an effort and it is appreciated. All may not like the answers, but atleast when you respond you have given them direction, which in the final analysis is why we come here in the first place. Thanks. To often people fail to say thanks and are to quick to critize. ;-) DougCranston


rbri,

No offense taken. dilettante has helped me and others. But providing the information helps the "more advanced" as dilettante, to help out with fewer questions to ask to understand the environment and what your trying to accomplish. This gives the forum experts time to look and potentially help more users than might otherwise be reasonable or possible.

Since dilettante referenced HTA as a better solution, I would suggest bypassing the att site I referenced.

Try instead:
Introduction to HTML Applications (HTAs)

Also, try and use a search str of: "how to create hta"

Hope this helps. Good luck.
DougCranston
 
Well thanks dougcranston, the kind words will serve to help me redouble my efforts at being a useful member here. I appreciate it.

rbri, you are correct, there really is only one VBScript language and syntax, barring slight version differences over the years. The important point though is that VBScript (or JScript, or Perl) only exist as a scripting "glue" for manipulating objects on Microsoft platforms.

Some of these objects are external, while others are provided by the script host (such as WSH in both WScript and CScript flavors, IE, Office products, 3rd party programs that host Active Script engines, and so on).

Simple example:

If you have a line like
Code:
WScript.Echo "Hello there!"
in your script, you get different results based on how you run it. If run under CScript which is non-GUI command-shell based, you get a line of output in your command window. If run under WScript the same text appears in a GUI dialog that looks a lot like a simple MsgBox dialog. If you try this line of script within an IE page or an HTA you'll have a script error, because there is no WScript object to invoke an Echo method on at all.

All that said, I'm pretty sure what you want to achieve is what is called a non-modal dialog on Microsoft platforms. These are not really "legal" under WSH and no direct way to create them is provided under WSH, though there are techniques that let you bend the rules and roll your own.

I suggested an HTA because that environment does indeed offer various sorts of non-modal dialogs. Here again they aren't as simple as calling MsgBox, but at least they're sanctioned and they're built into the script host (HTAs are hosted by Internet Explorer). The downside of an HTA is that it requires some HTML skills in addition to script skills. The advantage is that you get much richer GUI development capabilities and a more robust event-handling architecture.

But...

The easiest way to do what you want is to write a second WSH script that accepts a parameter and calls MsgBox with it. Then your original script could just WShell.Run the script with the string you want to display. A little crude, but it sure would get the job done!

Is that a more helpful idea?
 
Thank you dilettante and dougcranston for your help I used your hta suggestion which for me worked great.

Here is the code I used in case someone else wants to do what I did.

Sub notify()

Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim objFile1, strMsg1, strMsg2, strMsg3, strCode1
strMsg1 = "A New Directory Has been added"
strMsg2 = "Location and Name..."
strMsg3 = strFileName
strCode1 = &quot;<BUTTON onclick=&quot; & &quot;&quot;&quot;&quot; & &quot;window.close()&quot; & &quot;&quot;&quot;&quot; & &quot;>Close Window</BUTTON>&quot;
Set objFile1 = objFso.CreateTextFile(&quot;c:\temp\notify.hta&quot;, 2)
objFile1.writeline(&quot;<HTML>&quot;)
objFile1.writeline(&quot;<HEAD>&quot;)
objFile1.writeline(&quot;<TITLE>Notify Window</TITLE>&quot;)
objFile1.Writeline(&quot;<SCRIPT LANGUAGE=JavaScript><!--&quot;)
objFile1.Writeline(&quot;if (document.all || document.layers)&quot;)
objFile1.Writeline(&quot; window.resizeTo(600,200)&quot;)
objFile1.Writeline(&quot;//--></SCRIPT>&quot;)
objFile1.writeline(&quot;</HEAD>&quot;)
objFile1.writeline(&quot;<BODY BGCOLOR=yellow>&quot;)
objFile1.Writeline(&quot;<H2>&quot;)
objFile1.writeline(&quot;<CENTER>&quot;)
objFile1.writeline(strMsg1)
objFile1.writeline(&quot;</CENTER>&quot;)
objFile1.writeline(&quot;<P>&quot;)
objFile1.writeline(strMsg2)
objFile1.writeline(&quot;<BR>&quot;)
objFile1.writeline(strMsg3)
objFile1.writeline(&quot;<P>&quot;)
objFile1.writeline(&quot;<P>&quot;)
objFile1.writeline(&quot;<CENTER>&quot;)
objFile1.writeline(strCode1)
objFile1.writeline(&quot;</CENTER>&quot;)
objFile1.Writeline(&quot;</H2>&quot;)
objFile1.writeline(&quot;</BODY>&quot;)
objFile1.writeline(&quot;</HTML>&quot;)
objFile1.close
objShell.run &quot;C:\temp\notify.hta&quot;
Set objFile1 = Nothing

End Sub

objFso and objShell where initialized earlier in the script and strFilename is the variable passed to the Sub.

Thanks again for the advice and help with my problem.

Randy
 
great post dougcranston!

_________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
onpnt,

Don't know if it was great. Honestly, those individuals that take time out of their schedules to try to help are the ones that deserve the credit. An occassional star is great, but thanks to is rather infrequent based on my observations, sadly.

So thanks to all who try and help the wanna be's and those that need help and have no other resource than to tap into forums like this... (I fall into both categories, and frequently clueless can be pointed in my direction. ;-) )

And dilettante, is redboubling 24 hours a day reasonable? ;-) Just thanks for what you have and do, and let the rest of us wait our turn in line.

Waxing philosophical I guess.
DougCranston
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top