Hello,
I am performing some long lasting action and I'd like to send some window to the screen i.e. "Searching..." with 1 button "Cancel". If the user presses the button the action will end. The MsgBox or PopUp functions aren't good as they are modal so if the dialog box is present the script is waiting for reply and the action is not performed. Could you send me a piece of .vbs code or paste it here ??? Thanks lot... Tomas
Page 1 of 1
WSH - non modal dialog box WSH - creating dialog box with 1 button
#2
Posted 12 August 2005 - 03:41 PM
search this forum for gunsmokingman's HTA scripts.
like the one in this thread. http://www.msfn.org/board/index.php?showtopic=51517&hl=
like the one in this thread. http://www.msfn.org/board/index.php?showtopic=51517&hl=
This post has been edited by dman: 12 August 2005 - 03:42 PM
#3
Posted 12 August 2005 - 05:26 PM
Added A Stop Button To The Script. Hope This Helps
Quote
<TITLE> CountDown</TITLE>
<HTA:APPLICATION ID=GsmRadio APPLICATIONNAME=GsmUpdaterV1 SYSMENU="yes"
Icon="http://www3.telus.net/GSMJAK1E/AUABuilder/BgImgs/Hta2.ico"><head>
<!-- ;;;;; RESIZES THE WINDOW ;;;;; -->
<script language="vbscript">
window.resizeTo 500,275
Dim Act : Set Act = CreateObject("Wscript.shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Sd : Sd = Act.ExpandEnvironmentStrings("%systemdrive%")
Dim UName : UName = Act.ExpandEnvironmentStrings("%UserName%")
Dim IntA
Function Rst1 '''' <!-- ;;;;; SCRIPT THIS IS THE AMOUNT OF TIME IT STOPS 1000 = 1 SECOND ;;;;; -->
Dim Ts : Set Ts = Fso.OpenTextFile(SD & "\Rest1.vbs", 2, true)
Ts.WriteLine "Wscript.sleep 1000"
Ts.close
Act.run(SD & "\Rest1.vbs"), 1 , True
On Error Resume Next
Fso.DeleteFile(SD & "\Rest1.vbs")
End Function
Function RunTheTest '''' <!-- ;;;;; SCRIPT COUNT DOWN ;;;;; -->
INTA = 11
Do
INTA = INTA -1
DataArea1.InnerHTML = Uname & ", This Is The Counter Number = " & INTA
Rst1
Loop Until INTA = 0
DataArea1.InnerHTML = "Completed The Count Down"
Rst1
DataArea1.InnerHTML = ""
exit Function
End Function
Function StopTheTest
IntA = INTA - INTA
DataArea1.InnerHTML = Uname & ", Stopping The CountDown"
Rst1
Rst1
DataArea1.InnerHTML = ""
End Function
</script>
<!-- ;;;;; MAIN BODY AND BACK GROUND ;;;;; -->
<body Title="This Is The Main Body Pop Up Text"STYLE= "10.75pt Palatino Linotype; color:#006c6c;
filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#e8e4de', EndColorStr='#c7c3be')">
<!-- ;;;;; THE BUTTON THAT THE USER PUSHES ;;;;; -->
<input id=runbutton class="button" type="button" value="Run Count Down" name="ok_button"STYLE="font:8.75pt Palatino Linotype;color:#006c6c;font-weight:Bold-Italic;
"Title="This Is This Buttons Pop Up Text" onclick="RunTheTest"><TD width="55"></TD>
<!-- ;;;;; THE BUTTON THAT STOPS THE COUNTDOWN ;;;;; -->
<input id=runbutton class="button" type="button" value="Stop Count Down" name="ok_button"STYLE="font:8.75pt Palatino Linotype;color:#006c6c;font-weight:Bold-Italic;
"Title="This Is This Buttons Pop Up Text" onclick="StopTheTest">
</Table>
<BR><span id=DataArea1>
<HTA:APPLICATION ID=GsmRadio APPLICATIONNAME=GsmUpdaterV1 SYSMENU="yes"
Icon="http://www3.telus.net/GSMJAK1E/AUABuilder/BgImgs/Hta2.ico"><head>
<!-- ;;;;; RESIZES THE WINDOW ;;;;; -->
<script language="vbscript">
window.resizeTo 500,275
Dim Act : Set Act = CreateObject("Wscript.shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Sd : Sd = Act.ExpandEnvironmentStrings("%systemdrive%")
Dim UName : UName = Act.ExpandEnvironmentStrings("%UserName%")
Dim IntA
Function Rst1 '''' <!-- ;;;;; SCRIPT THIS IS THE AMOUNT OF TIME IT STOPS 1000 = 1 SECOND ;;;;; -->
Dim Ts : Set Ts = Fso.OpenTextFile(SD & "\Rest1.vbs", 2, true)
Ts.WriteLine "Wscript.sleep 1000"
Ts.close
Act.run(SD & "\Rest1.vbs"), 1 , True
On Error Resume Next
Fso.DeleteFile(SD & "\Rest1.vbs")
End Function
Function RunTheTest '''' <!-- ;;;;; SCRIPT COUNT DOWN ;;;;; -->
INTA = 11
Do
INTA = INTA -1
DataArea1.InnerHTML = Uname & ", This Is The Counter Number = " & INTA
Rst1
Loop Until INTA = 0
DataArea1.InnerHTML = "Completed The Count Down"
Rst1
DataArea1.InnerHTML = ""
exit Function
End Function
Function StopTheTest
IntA = INTA - INTA
DataArea1.InnerHTML = Uname & ", Stopping The CountDown"
Rst1
Rst1
DataArea1.InnerHTML = ""
End Function
</script>
<!-- ;;;;; MAIN BODY AND BACK GROUND ;;;;; -->
<body Title="This Is The Main Body Pop Up Text"STYLE= "10.75pt Palatino Linotype; color:#006c6c;
filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#e8e4de', EndColorStr='#c7c3be')">
<!-- ;;;;; THE BUTTON THAT THE USER PUSHES ;;;;; -->
<input id=runbutton class="button" type="button" value="Run Count Down" name="ok_button"STYLE="font:8.75pt Palatino Linotype;color:#006c6c;font-weight:Bold-Italic;
"Title="This Is This Buttons Pop Up Text" onclick="RunTheTest"><TD width="55"></TD>
<!-- ;;;;; THE BUTTON THAT STOPS THE COUNTDOWN ;;;;; -->
<input id=runbutton class="button" type="button" value="Stop Count Down" name="ok_button"STYLE="font:8.75pt Palatino Linotype;color:#006c6c;font-weight:Bold-Italic;
"Title="This Is This Buttons Pop Up Text" onclick="StopTheTest">
</Table>
<BR><span id=DataArea1>
#4
Posted 16 August 2005 - 10:17 AM
thanks a lot, I've got 2 questions.
1. is it possible to invisible vertical scroll bar?
2. how can I put it into .vbs file
1. is it possible to invisible vertical scroll bar?
2. how can I put it into .vbs file
#5
Posted 17 August 2005 - 01:59 AM
Here Is A Updated Version Without Scroll Bars And No Min Button Or Max Button
I Have Also Added Another Hta App That Searches For WMA, MP3, User Selected
File type. If You Select Either Search For WMA Or MP3 It Will Make A New Hta
With A List Of Either WMA Or MP3, On Your DeskTop. The Any File Type Leave
A Log File On The Desktop. It Also Has 2 Drop Down List Box, With Some
Preselected Radio Station For Either Window Media Player Or Winamp.
Demo Start Stop A Script In A Hta No Scoll Bars No Min Or Max Button
Green Text Is What Makes The Changes To The HTA
I Have Also Added Another Hta App That Searches For WMA, MP3, User Selected
File type. If You Select Either Search For WMA Or MP3 It Will Make A New Hta
With A List Of Either WMA Or MP3, On Your DeskTop. The Any File Type Leave
A Log File On The Desktop. It Also Has 2 Drop Down List Box, With Some
Preselected Radio Station For Either Window Media Player Or Winamp.
Demo Start Stop A Script In A Hta No Scoll Bars No Min Or Max Button
Green Text Is What Makes The Changes To The HTA
Quote
<TITLE> CountDown</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- FOR MORE INFORMATION COPY AND PASTE THE FOLLOWING LINK BELOW IN YOUR BROWSER -->
<!-- http://msdn.microsoft.com/library/default...._node_entry.asp -->
<HTA:APPLICATION ID=CountDownAndStop
SYSMENU="yes"
SCROLL="No"
SCROLLFLAT ="No"
SingleInstance="Yes"
ShowInTaskbar="No"
SysMenu="Yes"
MaximizeButton="No"
MinimizeButton="No"
Border="Thin"
BORDERSTYLE ="complex"
INNERBORDER ="No"
Caption="Yes"
WindowState="Normal"
APPLICATIONname="DemoStartStop"
Icon="http://www3.telus.net/GSMJAK1E/AUABuilder/BgImgs/Hta2.ico"> <head>
<!-- ============ RESIZES THE WINDOW ============ -->
<script language="vbscript">
''''<!-- ============ PLACE THE VBS SCRIPTS HERE ============ -->
window.resizeTo 500,275
Dim Act : Set Act = CreateObject("Wscript.shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Sd : Sd = Act.ExpandEnvironmentStrings("%systemdrive%")
Dim UName : UName = Act.ExpandEnvironmentStrings("%UserName%")
Dim IntA
''''
Function Rst1 '''' <!-- ============ SCRIPT THIS IS THE AMOUNT OF TIME IT STOPS 1000 = 1 SECOND ============ -->
Dim Ts : Set Ts = Fso.OpenTextFile(SD & "\Rest1.vbs", 2, true)
Ts.WriteLine "Wscript.sleep 1000"
Ts.close
Act.run(SD & "\Rest1.vbs"), 1 , True
On Error Resume Next
Fso.DeleteFile(SD & "\Rest1.vbs")
End Function
''''
Function RunTheTest '''' <!-- ============ SCRIPT COUNT DOWN ============ -->
INTA = 11
Do
INTA = INTA -1
DataArea1.InnerHTML = Uname & ", This Is The Counter Number = " & INTA
Rst1
Loop Until INTA = 0
DataArea1.InnerHTML = "Completed The Count Down"
Rst1
DataArea1.InnerHTML = ""
exit Function
End Function
''''
Function StopTheTest
IntA = INTA - INTA
DataArea1.InnerHTML = Uname & ", Stopping The CountDown"
Rst1
Rst1
DataArea1.InnerHTML = ""
End Function
''''
Function ExitHta
Window.close
End Function
</script>
<!-- ============ MAIN BODY AND BACK GROUND ============ -->
<body SCROLL="no" Title="This Is The Main Body Pop Up Text" STYLE= "10.75pt Palatino Linotype; color:#006c6c;
filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#e8e4de', EndColorStr='#c7c3be')">
<!-- ============ THE TEXT LABEL ============ -->
<Center>Demo Start And Stop A Script</Center><Center>
<!-- ============ THE BUTTON THAT THE USER PUSHES ============ -->
<input id=runbutton class="button" type="button" value="Run Count Down" name="ok_button"STYLE="font:8.75pt Palatino Linotype;color:#006c6c;font-weight:Bold-Italic;
"Title="This Is This Buttons Pop Up Text" onclick="RunTheTest"><TD width="55"></TD>
<!-- ============ THE BUTTON THAT STOPS THE COUNTDOWN ============ -->
<input id=runbutton class="button" type="button" value="Stop Count Down" name="ok_button"STYLE="font:8.75pt Palatino Linotype;color:#006c6c;font-weight:Bold-Italic;
"Title="This Is This Buttons Pop Up Text" onclick="StopTheTest">
<!-- ============ THE BUTTON THAT EXITS THE SCRIPT ============ -->
<input id=runbutton class="button" type="button" value="Exit This" name="ok_button"STYLE="font:8.75pt Palatino Linotype;color:#006c6c;font-weight:Bold-Italic;
"Title="This Is This Buttons Pop Up Text" onclick="ExitHta">
<A Style="8.75pt Palatino Linotype; color:#000c6c;"
Title="This Opens Up A Page
In The MSDN Library, About Hta
Application Properties"
HREF="http://msdn.microsoft.com/library/default.asp?url=/workshop/author/hta/hta_node_entry.asp">More Info<A>
</Table>
<BR><span id=DataArea1>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- FOR MORE INFORMATION COPY AND PASTE THE FOLLOWING LINK BELOW IN YOUR BROWSER -->
<!-- http://msdn.microsoft.com/library/default...._node_entry.asp -->
<HTA:APPLICATION ID=CountDownAndStop
SYSMENU="yes"
SCROLL="No"
SCROLLFLAT ="No"
SingleInstance="Yes"
ShowInTaskbar="No"
SysMenu="Yes"
MaximizeButton="No"
MinimizeButton="No"
Border="Thin"
BORDERSTYLE ="complex"
INNERBORDER ="No"
Caption="Yes"
WindowState="Normal"
APPLICATIONname="DemoStartStop"
Icon="http://www3.telus.net/GSMJAK1E/AUABuilder/BgImgs/Hta2.ico"> <head>
<!-- ============ RESIZES THE WINDOW ============ -->
<script language="vbscript">
''''<!-- ============ PLACE THE VBS SCRIPTS HERE ============ -->
window.resizeTo 500,275
Dim Act : Set Act = CreateObject("Wscript.shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Sd : Sd = Act.ExpandEnvironmentStrings("%systemdrive%")
Dim UName : UName = Act.ExpandEnvironmentStrings("%UserName%")
Dim IntA
''''
Function Rst1 '''' <!-- ============ SCRIPT THIS IS THE AMOUNT OF TIME IT STOPS 1000 = 1 SECOND ============ -->
Dim Ts : Set Ts = Fso.OpenTextFile(SD & "\Rest1.vbs", 2, true)
Ts.WriteLine "Wscript.sleep 1000"
Ts.close
Act.run(SD & "\Rest1.vbs"), 1 , True
On Error Resume Next
Fso.DeleteFile(SD & "\Rest1.vbs")
End Function
''''
Function RunTheTest '''' <!-- ============ SCRIPT COUNT DOWN ============ -->
INTA = 11
Do
INTA = INTA -1
DataArea1.InnerHTML = Uname & ", This Is The Counter Number = " & INTA
Rst1
Loop Until INTA = 0
DataArea1.InnerHTML = "Completed The Count Down"
Rst1
DataArea1.InnerHTML = ""
exit Function
End Function
''''
Function StopTheTest
IntA = INTA - INTA
DataArea1.InnerHTML = Uname & ", Stopping The CountDown"
Rst1
Rst1
DataArea1.InnerHTML = ""
End Function
''''
Function ExitHta
Window.close
End Function
</script>
<!-- ============ MAIN BODY AND BACK GROUND ============ -->
<body SCROLL="no" Title="This Is The Main Body Pop Up Text" STYLE= "10.75pt Palatino Linotype; color:#006c6c;
filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#e8e4de', EndColorStr='#c7c3be')">
<!-- ============ THE TEXT LABEL ============ -->
<Center>Demo Start And Stop A Script</Center><Center>
<!-- ============ THE BUTTON THAT THE USER PUSHES ============ -->
<input id=runbutton class="button" type="button" value="Run Count Down" name="ok_button"STYLE="font:8.75pt Palatino Linotype;color:#006c6c;font-weight:Bold-Italic;
"Title="This Is This Buttons Pop Up Text" onclick="RunTheTest"><TD width="55"></TD>
<!-- ============ THE BUTTON THAT STOPS THE COUNTDOWN ============ -->
<input id=runbutton class="button" type="button" value="Stop Count Down" name="ok_button"STYLE="font:8.75pt Palatino Linotype;color:#006c6c;font-weight:Bold-Italic;
"Title="This Is This Buttons Pop Up Text" onclick="StopTheTest">
<!-- ============ THE BUTTON THAT EXITS THE SCRIPT ============ -->
<input id=runbutton class="button" type="button" value="Exit This" name="ok_button"STYLE="font:8.75pt Palatino Linotype;color:#006c6c;font-weight:Bold-Italic;
"Title="This Is This Buttons Pop Up Text" onclick="ExitHta">
<A Style="8.75pt Palatino Linotype; color:#000c6c;"
Title="This Opens Up A Page
In The MSDN Library, About Hta
Application Properties"
HREF="http://msdn.microsoft.com/library/default.asp?url=/workshop/author/hta/hta_node_entry.asp">More Info<A>
</Table>
<BR><span id=DataArea1>
This post has been edited by gunsmokingman: 28 December 2005 - 11:02 PM
#6
Posted 18 August 2005 - 02:09 PM
two ways:
1/ create a script file called "messagebox.vbs" with the code:
msgbox "YourMessage",,"YourTitle"
Then launch it using the wshell.run method
2/ if the message is always changing:
use a code in your script to CreateTextFile named "box.vbs" and to write the MsgBox line into it and to launch the "box.vbs" file with the same wshell.run method .
Then add a code to delete the "box.vbs" file if you don't need it anymore.
http://visualbasicsc.../m_24654/tm.htm
1/ create a script file called "messagebox.vbs" with the code:
msgbox "YourMessage",,"YourTitle"
Then launch it using the wshell.run method
2/ if the message is always changing:
use a code in your script to CreateTextFile named "box.vbs" and to write the MsgBox line into it and to launch the "box.vbs" file with the same wshell.run method .
Then add a code to delete the "box.vbs" file if you don't need it anymore.
http://visualbasicsc.../m_24654/tm.htm
- ← Running a msiexec command with a VB script file.
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- Algorithm for conversion to POS →
Share this topic:
Page 1 of 1



Help
Back to top









