tomikaaa Posted August 12, 2005 Posted August 12, 2005 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
dman Posted August 12, 2005 Posted August 12, 2005 (edited) search this forum for gunsmokingman's HTA scripts.like the one in this thread. http://www.msfn.org/board/index.php?showtopic=51517&hl= Edited August 12, 2005 by dman
gunsmokingman Posted August 12, 2005 Posted August 12, 2005 Added A Stop Button To The Script. Hope This Helps <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>
tomikaaa Posted August 16, 2005 Author Posted August 16, 2005 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
gunsmokingman Posted August 17, 2005 Posted August 17, 2005 (edited) Here Is A Updated Version Without Scroll Bars And No Min Button Or Max ButtonI Have Also Added Another Hta App That Searches For WMA, MP3, User SelectedFile 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 LeaveA 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 <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> Edited December 29, 2005 by gunsmokingman
Fredledingue Posted August 18, 2005 Posted August 18, 2005 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://visualbasicscript.com/m_24654/tm.htm
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now