|
-
Feb 28th, 2003, 07:02 AM
#1
Thread Starter
Frenzied Member
Showing information
I often use .VBS files for doing small things around my system...
Things like modifying subject lines in well defined and structured e-mail messages to include data from the body of the message. Or listing all entries in a directory / Global Address List / Distribution List etc.
Typically I use a MSGBOX at the beginning and end of the .VBS file in order to show that it is starting and it is ending.
BUT a MSGBOX requires the user to hit the button before it continues.
Is it possible to have a "form" or another message box appear while the script is running, with information on it saying what it is doing, and to then have this disappear when the .VBS script file has finished.
In VB, it would be the main form with a label or caption or progress bar being modified to show how far things had got. Bt in a .VBS script file??
-
Feb 28th, 2003, 07:54 AM
#2
Hyperactive Member
Look up the WshShell popup method , heres an example :
Code:
Dim WshShell, BtnCode
Set WshShell = WScript.CreateObject("WScript.Shell")
BtnCode = WshShell.Popup("Do you feel alright?", 7, "Answer This Question:", 4 + 32)
Select Case BtnCode
case 6 WScript.Echo "Glad to hear you feel alright."
case 7 WScript.Echo "Hope you're feeling better soon."
case -1 WScript.Echo "Is there anybody out there?"
End Select
The second parameter in the popup method is the number of seconds that the box is displayed , 0 means it will stay displayed until the user clears it and in the above example it will stay for 7 seconds before automatically closing down.
If this isnt suitabe try looking at running your scripts from the command prompt with Cscript.exe, heres a small sample :
Code:
Function IsCScript()
' Check whether CScript.exe is the host.
If (InStr(UCase(WScript.FullName), "CSCRIPT") <> 0) Then
IsCScript = True
Else
IsCScript = False
End If
End Function
'make sure we are running this in the right envionment otherwise we
'will have 150 message boxex to deal with!!
if IsCScript then
for i = 1 to 150
wscript.echo "Hello World!"
next
end if
save as a .vbs then run from the command prompt like this :
cscript c:\test.vbs
---
Anglo saxon
-
Feb 28th, 2003, 08:05 AM
#3
Thread Starter
Frenzied Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|