Sign in to follow this  
Followers 0
Outbreaker

[VBScript] MsgBox with auto select countdown and Batch Script input.

19 posts in this topic

HI :)

I need help to make a VBScript that i can call with a Batch Script file and schould show then a MsgBox with a Yes/No option and a 30 seconds countdown. If a user has not selected a option and the time is up then the VBScript should automatically select the option Yes and also go to the Batch Script line XY1 and if No is selected then it should go to the Batch Script line XY2.

I google for over 3 hours but i could finde only a simple Yes/No MsgBox VBScript and only one that had also a countdown option but this script was bugy and had also not the Batch Script GoTo line XY option. :(

Hope someone can help me. :hello:

Edited by Outbreaker
0

Share this post


Link to post
Share on other sites

Something like this?

Batch file:

@echo off

:: batch code

::Prompt here
cscript //nologo question.vbs

if errorlevel 1 goto XY2
goto XY1

:XY1
echo You have chosen yes.
goto :eof

:XY2
echo You have chosen no.
goto :eof

VBScript file:

Option Explicit
Dim oShell, retCode
Set oShell = WScript.CreateObject("WScript.Shell")

retCode = oShell.Popup("Place your question here?", 30, "Title", 4 + 32)

Select Case retCode
case 6, -1
WScript.quit(0) 'Yes or time-out was chosen
case 7
WScript.quit(1) 'No was chosen
End Select

This assumes both files are located in the same directory.

Change the text you want displayed to the user.

The vb script uses the quit method of wscript to provide an exit code that the batch

file can use with an errorlevel check to determine what was chosen.

0

Share this post


Link to post
Share on other sites

Yes that's it now only a countdown to show that if the user is not selecting a option then the script will auto select the option Yes in X seconds.

0

Share this post


Link to post
Share on other sites

This will do what you want it to do, but the box flashes as it count down

Option Explicit
Dim A1, oShell, retCode
Set oShell = WScript.CreateObject("WScript.Shell")

A1 = 30

Do Until A1 = 0
A1 = A1 - 1
retCode = oShell.Popup("Place your question here?" & _
vbCrlf & "Time Left : " & A1, 1, "Title", 4 + 32)
Loop

Select Case retCode
case 6, -1
WScript.quit(0) 'Yes or time-out was chosen

case 7
WScript.quit(1) 'No was chosen
End Select

Another way to do this would be a HTA, this HTA will close in 30 seconds and show the yes diplay text before closing.

There are 2 buttons a Yes and a No button press either one to see how the script works.

Save as DemoMsgBox.hta

  <Title>My Demo Message Box</Title>
<HTA:APPLICATION ID="MainApplication"
SCROLL="No"
SCROLLFLAT ="No"
SingleInstance="Yes"
ShowInTaskbar="Yes"
SysMenu="Yes"
MaximizeButton="No"
MinimizeButton="No"
Border="Thin"
BORDERSTYLE ="complex"
INNERBORDER ="No"
Caption="Yes"
WindowState="Normal"
APPLICATIONNAME="MainApp"
Icon="%SystemRoot%\explorer.exe">
<STYLE type="text/css">
BODY
{
Font-Size:8.25pt;
Font-Weight:Bold;
Font-Family:helvetica,verdana,arial;
Color:#008040;
BackGround-Color:Transparent;
filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#E2E2E2',EndColorStr='#6e6e6e);
Margin-Top:5;
Margin-Bottom:5;
Margin-Left:5;
Margin-Right:5;
Padding-Top:3;
Padding-Bottom:3;
Padding-Left:5;
Padding-Right:5;
Text-Align:Left;
Vertical-Align:Top;
}
TD.Type1
{
Margin-Left:21;
Padding-Left:15;
}
BUTTON
{
Height:18pt;
width:61pt;
Cursor:Hand;
Font:8.05pt;
Font-weight:bold;
Font-family:helvetica,verdana,arial;
Color:#404040;
Text-Align:Center;
Vertical-Align:Middle;
filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#E5E5E5',EndColorStr='#7D7D7D');
Margin:1;
Padding:2;
Border-Left: 1px Transparent;
Border-Right: 2px Transparent;
Border-Top: 1px Transparent;
Border-Bottom: 2px Transparent;
}
</STYLE>
<script Language='VBSCRIPT'>
'-> Resize And Move Window
Dim Wth :Wth = int(425)
Dim Hht :Hht = int(175)
window.ResizeTo Wth, Hht
MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))
'-> Text Display Varible
Dim F1 :F1 = "<FONT STYLE='Font:8.25pt;Color:#002060;Font-Weight:Bold;'>"
'-> Count Down Display Varibles
Dim idTimer
Dim C1 :C1 = 10
Dim D1 :D1 = 1
'-> Yes Varibles
Dim Y_DoIt
'-> OnLoad Action
Function Window_OnLoad()
Counter()
txt1.innerHTML = F1 & "Ask Your Question About What You Want Done</FONT>"
txt2.innerHTML = F1 & "Here Is Some More Text Space For You If Needed</FONT>"
End Function
'-> Count Down Function
Function Counter()
Do
D1 = D1 -1
C1 = C1 -1
document.focus()
' Makes 1 Threw 9 Look like 01, 02 ETC
If Len(C1) = 1 Then C1 = "0" & C1
If Len(C1) = 2 Then C1 = C1
txt3.innerHTML = F1 & "Remaining Time Before Auto Select Yes " & C1 & "</FONT>"
Loop Until D1 = 0
D1 = 1
If C1 = 0 Then
Y_DoIt = True
HtaExit()
Exit Function
End if
idTimer = window.setTimeout("Counter", 1000, "VBScript")
If Y_DoIt = True Then
Yes_Work()
End If
End Function
'-> No Button Action
Function No_Action()
txt3.innerHTML = Replace(F1,"002060","AD0101") & "No Was Selected Cancel All Operation</FONT>"
window.clearTimeout(idTimer)
idTimer = window.setTimeout("MyTimer2", 5000, "VBScript")
Exit Function
End Function
'-> Yes Button Action
Function Yes_Action()
Y_DoIt = True
Exit Function
End Function
'-> Yes Button Worker
Function Yes_Work()
txt3.innerHTML = Replace(F1,"002060","006020") & "Processing Yes Selection</FONT>"
'Scripted Action Here
window.clearTimeout(idTimer)
idTimer = window.setTimeout("MyTimer1", 3000, "VBScript")
Exit Function
End Function
'-> Close The HTA Window
Function HtaExit()
window.clearTimeout(idTimer)
If Y_DoIt = True Then
Yes_Work()
End If
End Function
'-> Timer1
Function MyTimer1()
txt3.innerHTML = ""
window.close()
window.clearTimeout(idTimer)
Exit Function
End Function
'-> Timer2
Function MyTimer2()
txt3.innerHTML = ""
window.close()
window.clearTimeout(idTimer)
Exit Function
End Function
</SCRIPT>
<BODY Scroll='No'>
<!-- txt1 Display -->
<Table><TD Class='Type1'><Span ID='txt1'></Span></TD></Table>
<!-- txt2 Display -->
<Table><TD Class='Type1'><Span ID='txt2'></Span></TD></Table>
<!-- txt3 Display -->
<Table><TD Class='Type1'><Span ID='txt3'></Span></TD></Table>
<!-- Button Display -->
<Table Style='Margin-Top:7pt;' Align='Center'>
<!-- Button 01 -->
<TD><BUTTON ID='Bttn_N' OnClick='No_Action()'>No</BUTTON></TD>
<!-- Button 02 -->
<TD><BUTTON ID='Bttn_Y' OnClick='Yes_Action()'>Yes</BUTTON></TD>
</Table>
</BODY>

0

Share this post


Link to post
Share on other sites

Nice :w00t: MsgBox popup never heard about this HTA before.

But would this also work with the Batch file like with the VBScript ?

Like if the DemoMsgBox.hta is started by the Batch file and the option Yes is selected then got to Batch Script line XY1 and if the option No is selected then go to Batch Script line XY2.

If this would works this would be the best Yes/No prompt Script for a Batch file. :)

Edited by Outbreaker
0

Share this post


Link to post
Share on other sites

You would not need to have any batch files around, you could run the cmd directly from the HTA either yes or no button.

Could you post the cmds you need to run for yes and no button reply, I will add them to the HTA for you.

0

Share this post


Link to post
Share on other sites

Oh to put the batch script in the HTA file would be not so good it's a big Batch file and i have also separat all Script languag for each other like that it is not so confusion because the whole Scripts config files that i use to configure Windows are like 200KB together.

If this is not working like in the VBScript then i could also make 2 more Batch files so if Yes is then selected it will Start the Batch file XY1 and if No it will Start the Batch file XY2.

Edited by Outbreaker
0

Share this post


Link to post
Share on other sites

I'd suggest you take a look at a GUI scripting tool such as AutoIt for this task.

In the meantime I suppose I could take a shot at creating a YES | NO box with 30 second countdown specifically for this task. You'd probably end up running it as an executable from the batch and have it return the result back to the batch. It'd be no real use for anything else hence my reason for not doing so unless it's required.

Also if it is required, then you'll need to let me know exactly what data you'd want it to return.

i.e. I was thinking 1 for YES, 2 for NO; meaning that your batch could probably use the return data as:

GOTO XY<RETURNED DATA>

0

Share this post


Link to post
Share on other sites

I like the idee to use Scripts that i can open with the text edtor and edit it without a program if the next step will not work then AutoIt would be the only way.

So it looks like the HTA could not be used like the VBScript to output a command to the Batch file.

But what if i would select Yes and the HTA Script would make a Batch file in the Temp folder with the text "Yes" in it and then the main Batch file would then call the Batch file in the Temp folder and look if "Yes" or "No" is written in it and if like "Yes" is written in then the main Batch file gose to the line XY1 and if "No" is written it will go to the Batch line XY2.

Im sure it would work but i don't no how to write the code for that :}

Edited by Outbreaker
0

Share this post


Link to post
Share on other sites

Here is a updated HTA, it produces a MyReturn.cmd in the users temp folder

Cmd I used to see read the varibles

@Echo Off
CLS
Mode 69,9
Color F9
Title Test Return

Set Cmd1="%Temp%\MyReturn.cmd"


If Exist %Cmd1% GoTO Work1
If Not Exist %Cmd1% GoTO Ops1


:Work1
call %Cmd1%
CLS
Echo.
Echo %Reply%
Del %Cmd1%
pause
Exit


:Ops1
Color F5
CLS
Echo.
Echo Missing %Cmd1%
Echo Contact The System Admin For More Information!
pause
Exit

Updated HTA code

  <Title>My Demo Message Box</Title>
<HTA:APPLICATION ID="MyMessageBox"
SCROLL="No"
SCROLLFLAT ="No"
SingleInstance="Yes"
ShowInTaskbar="Yes"
SysMenu="Yes"
MaximizeButton="No"
MinimizeButton="No"
Border="Thin"
BORDERSTYLE ="complex"
INNERBORDER ="No"
Caption="Yes"
WindowState="Normal"
APPLICATIONNAME="MainApp"
Icon="%SystemRoot%\explorer.exe">
<STYLE type="text/css">
BODY
{
Font-Size:8.25pt;
Font-Weight:Bold;
Font-Family:helvetica,verdana,arial;
Color:#008040;
BackGround-Color:Transparent;
filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#E2E2E2',EndColorStr='#6e6e6e);
Margin-Top:5;
Margin-Bottom:5;
Margin-Left:5;
Margin-Right:5;
Padding-Top:3;
Padding-Bottom:3;
Padding-Left:5;
Padding-Right:5;
Text-Align:Left;
Vertical-Align:Top;
}
TD.Type1
{
Margin-Left:21;
Padding-Left:15;
}
BUTTON
{
Height:18pt;
width:61pt;
Cursor:Hand;
Font:8.05pt;
Font-weight:bold;
Font-family:helvetica,verdana,arial;
Color:#404040;
Text-Align:Center;
Vertical-Align:Middle;
filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#E5E5E5',EndColorStr='#7D7D7D');
Margin:1;
Padding:2;
Border-Left: 1px Transparent;
Border-Right: 2px Transparent;
Border-Top: 1px Transparent;
Border-Bottom: 2px Transparent;
}
</STYLE>
<script Language='VBSCRIPT'>
'-> Scripting Objects
Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Cmd :Cmd = Act.ExpandEnvironmentStrings("%Temp%") & "\MyReturn.cmd"
'-> Varibles
Dim Ts
'-> Resize And Move Window
Dim Wth :Wth = int(425)
Dim Hht :Hht = int(175)
window.ResizeTo Wth, Hht
MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))
'-> Text Display Varible
Dim F1 :F1 = "<FONT STYLE='Font:8.25pt;Color:#002060;Font-Weight:Bold;'>"
'-> Count Down Display Varibles
Dim idTimer
Dim C1 :C1 = 30
Dim D1 :D1 = 1
'-> Yes Varibles
Dim Y_DoIt
'-> OnLoad Action
Function Window_OnLoad()
Counter()
txt1.innerHTML = F1 & "Ask Your Question About What You Want Done</FONT>"
txt2.innerHTML = F1 & "Here Is Some More Text Space For You If Needed</FONT>"
End Function
'-> Count Down Function
Function Counter()
Do
D1 = D1 -1
C1 = C1 -1
document.focus()
' Makes 1 Threw 9 Look like 01, 02 ETC
If Len(C1) = 1 Then C1 = "0" & C1
If Len(C1) = 2 Then C1 = C1
txt3.innerHTML = F1 & "Remaining Time Before Auto Select Yes    " & C1 & "</FONT>"
Loop Until D1 = 0
D1 = 1
If C1 = 0 Then
Y_DoIt = True
HtaExit()
Exit Function
End if
idTimer = window.setTimeout("Counter", 1000, "VBScript")
If Y_DoIt = True Then
Yes_Work()
End If
End Function
'-> No Button Action
Function No_Action()
Bttn_Y.disabled = True
txt3.innerHTML = Replace(F1,"002060","AD0101") & "No Was Selected Cancel All Operation</FONT>"
'-> Create The Temp Cmd File For Yes
Set Ts = Fso.CreateTextFile(Cmd)
Ts.WriteLine "@Echo && CLS && MODE 55,5 && COLOR F9"
Ts.WriteLine "Set Reply=No"
Ts.Close
window.clearTimeout(idTimer)
idTimer = window.setTimeout("MyTimer2", 5000, "VBScript")
Exit Function
End Function
'-> Yes Button Action
Function Yes_Action()
Y_DoIt = True
Exit Function
End Function
'-> Yes Button Worker
Function Yes_Work()
Bttn_N.disabled = True
txt3.innerHTML = Replace(F1,"002060","006020") & "Processing Yes Selection</FONT>"
'-> Create The Temp Cmd File For Yes
Set Ts = Fso.CreateTextFile(Cmd)
Ts.WriteLine "@Echo && CLS && MODE 55,5 && COLOR F9"
Ts.WriteLine "Set Reply=Yes"
Ts.Close
window.clearTimeout(idTimer)
idTimer = window.setTimeout("MyTimer1", 3000, "VBScript")
Exit Function
End Function
'-> Close The HTA Window
Function HtaExit()
window.clearTimeout(idTimer)
If Y_DoIt = True Then
Yes_Work()
End If
End Function
'-> Timer1
Function MyTimer1()
txt3.innerHTML = ""
window.close()
window.clearTimeout(idTimer)
Exit Function
End Function
'-> Timer2
Function MyTimer2()
txt3.innerHTML = ""
window.close()
window.clearTimeout(idTimer)
Exit Function
End Function
</SCRIPT>
<BODY Scroll='No'>
<!-- txt1 Display -->
<Table><TD Class='Type1'><Span ID='txt1'></Span></TD></Table>
<!-- txt2 Display -->
<Table><TD Class='Type1'><Span ID='txt2'></Span></TD></Table>
<!-- txt3 Display -->
<Table><TD Class='Type1'><Span ID='txt3'></Span></TD></Table>
<!-- Button Display -->
<Table Style='Margin-Top:7pt;' Align='Center'>
<!-- Button 01 -->
<TD><BUTTON ID='Bttn_N' OnClick='No_Action()'>No</BUTTON></TD>
<!-- Button 02 -->
<TD><BUTTON ID='Bttn_Y' OnClick='Yes_Action()'>Yes</BUTTON></TD>
</Table>
</BODY>

0

Share this post


Link to post
Share on other sites

Perfect this works excellent THX. :w00t:

You saver me a lot of needed sleep time. :boring:

Edited by Outbreaker
0

Share this post


Link to post
Share on other sites

I am trying to do a simular job and i like what you have put together. I have one request if you are able to help it would be appreciated. Thanks

Is it possible for the cmd to read the results of the hta and if reply = yes lauch a specific .cmd (lets say c:\test.cmd) and if reply = no do nothing.

0

Share this post


Link to post
Share on other sites

Gunsmokingman, Thank You immensley for this script as it has done almost everything i needed....

However (of course lol) i am having trouble with the location of the output file... i need it to be generated within the script folder that is calling it... i have tried changing line 65 location from %temp% to

Dim Cmd :Cmd = Act.ExpandEnvironmentStrings("%cd%") & "\BannerResult.cmd"

it errors and states "PATH NOT FOUND"

however when i use ...

Dim Cmd :Cmd = Act.ExpandEnvironmentStrings("%userprofile%\desktop") & "\BannerResult.cmd"

it runs fine however it puts the file to the users desktop then i have another script that deletes the generated file once it reads the reply answer. what am i missing with getting it to generate within the called script folder.

Any takers on this question, i would be forever greatful. been smacking my head on the table for days trying to figure it out, i must have reloded this script about 500 times.... :realmad: lol Great Script though overall :thumbup

thanks in advance for anyone that is looking it over. attached below is the window script modified from what Gunsmoking man originally wrote.

Also i changed it so the script closes automatically at the timer "0" generating no file. Only Generates output file if yes button is clicked.

This is the (Edited for Public) Check Banner Result Script (Batch File)


@Echo Off
CLS
Mode 69,9
Color F9
Title Check Banner Result

Set Cmd1="%userprofile%\desktop\BannerResult.cmd"


If Exist %Cmd1% GoTO BannerAccepted
If Not Exist %Cmd1% GoTO BannerDenied


:BannerAccepted
call %Cmd1%
CLS
Echo.
Echo PROCESSING
Echo Did User Accept Banner: %reply%
pause
Del %Cmd1%
if not exist %cmd1% goto end
if exist %cmd1% echo Cannot Delete Banner Result File from Desktop...
pause
Exit


:BannerDenied
Color F5
CLS
Echo.
Echo Timed Out or User Selected NO. Operation Cancelled
Echo.
Echo.
Echo.
pause
goto end

:end
exit

This is the Banner Script (HTA File)


<Title>DOD BANNER</Title>
<HTA:APPLICATION
APPLICATIONNAME="MainApp"
ID="BannerBox"
BORDER="thin"
BORDERSTYLE="complex"
INNERBORDER="no"
MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="no"
ICON="%SystemRoot%\explorer.exe"
SCROLL="no"
SINGLEINSTANCE="yes"
SHOWINTASKBAR="no"
CONTEXTMENU="no"
SELECTION="no"/>
<STYLE type="text/css">
BODY
{
Font-Size:8.25pt;
Font-Weight:Bold;
Font-Family:helvetica,verdana,arial;
Color:#008040;
BackGround-Color:Transparent;
filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#6e6e6e',EndColorStr='#011111);
Margin-Top:5;
Margin-Bottom:5;
Margin-Left:5;
Margin-Right:5;
Padding-Top:3;
Padding-Bottom:3;
Padding-Left:5;
Padding-Right:5;
Text-Align:Center;
Vertical-Align:Top;
}
TD.Type1
{
Margin-Left:21;
Padding-Left:15;
}
BUTTON
{
Height:18pt;
width:61pt;
Cursor:Hand;
Font:8.05pt;
Font-weight:bold;
Font-family:helvetica,verdana,arial;
Color:#404040;
Text-Align:Center;
Vertical-Align:Middle;
filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#E5E5E5',EndColorStr='#7D7D7D');
Margin:1;
Padding:2;
Border-Left: 1px Transparent;
Border-Right: 2px Transparent;
Border-Top: 1px Transparent;
Border-Bottom: 2px Transparent;
}
</STYLE>
<script Language='VBSCRIPT'>
'-> Scripting Objects
Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Cmd :Cmd = Act.ExpandEnvironmentStrings("%userprofile%\desktop") & "\BannerResult.cmd"
'-> Varibles
Dim Ts
'-> Resize And Move Window
Dim Wth :Wth = int(625)
Dim Hht :Hht = int(675)
window.ResizeTo Wth, Hht
MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))
'-> Text Display Varible
Dim F1 :F1 = "<FONT STYLE='Font:8.25pt;Color:#099099;Font-Weight:Bold;'>"
Dim F2 :F2 = "<FONT STYLE='Font:10.25pt;Color:#FFFFF9;Font-Weight:Bold;'>"
Dim F3 :F3 = "<FONT STYLE='Font:14.25pt;Color:#FFFF00;Font-Weight:Bold;'>"
'-> Count Down Display Varibles
Dim idTimer
Dim C1 :C1 = 62
Dim D1 :D1 = 1
'-> Yes Varibles
Dim Y_DoIt
'-> OnLoad Action
Function Window_OnLoad()
Counter()
txt1.innerHTML = F3 & "DOD NOTICE AND CONSENT BANNER</FONT>"
txt2.innerHTML = F2 & "You are accessing a U.S. Government (USG) Information System (IS)</FONT>"
txt3.innerHTML = F2 & "that is provided for USG-authorized use only. </FONT>"
txt4.innerHTML = F1 & "</FONT>"
txt5.innerHTML = F1 & "By using this IS(which includes any device attached to this IS),</FONT>"
txt6.innerHTML = F1 & "you consent to the following conditions: </FONT>"
txt7.innerHTML = F1 & "</FONT>"
txt8.innerHTML = F1 & "-The USG routinely intercepts and monitors communications on this IS</FONT>"
txt9.innerHTML = F1 & " for purposes including, but not limited to, penetration testing, COMSEC</FONT>"
txt10.innerHTML = F1 & " monitoring, network operations and defense, personnel misconduct (PM),</FONT>"
txt11.innerHTML = F1 & " law enforcement (LE), and counterintelligence investigations (CI). </FONT>"
txt12.innerHTML = F1 & "-At any time, the USG may inspect and seize data stored on this IS. </FONT>"
txt13.innerHTML = F1 & "-Communications using, or data stored on, this IS are not private, are</FONT>"
txt14.innerHTML = F1 & " subject to routine monitoring, interception and search, and may be disclosed</FONT>"
txt15.innerHTML = F1 & " or used for any USG-authorized purpose. </FONT>"
txt16.innerHTML = F1 & "-This IS includes security measures (e.g., authentication and access controls)</FONT>"
txt17.innerHTML = F1 & " to protect USG interests--not for your personal benefit or privacy.</FONT>"
txt18.innerHTML = F1 & "-Notwithstanding the above, using this IS does not constitute consent to PM, LE,</FONT>"
txt19.innerHTML = F1 & " or CI investigative searching or monitoring of the content of privileged</FONT>"
txt20.innerHTML = F1 & " communications, or work product, related to personal representation or services</FONT>"
txt21.innerHTML = F1 & " by attorneys, psychotherapists, or clergy, and their assistants. Such communication</FONT>"
txt22.innerHTML = F1 & " and work product are private and confidential. See User Agreement for details.</FONT>"
txt23.innerHTML = F1 & "</FONT>"
txt24.innerHTML = F2 & "I have read and consent to the terms of the IS User Agreement</FONT>"
txt25.innerHTML = F1 & "</FONT>"
End Function
'-> Count Down Function
Function Counter()
Do
D1 = D1 -1
C1 = C1 -1
document.focus()
' Makes 1 Threw 9 Look like 01, 02 ETC
If Len(C1) = 1 Then C1 = "0" & C1
If Len(C1) = 2 Then C1 = C1
txt25.innerHTML = F3 & "Remaining Time Before Auto Select NO " & C1 & "</FONT>"
Loop Until D1 = 0
D1 = 1
If C1 = 0 Then
Y_DoIt = True
No_Action()
Exit Function
End if
idTimer = window.setTimeout("Counter", 1000, "VBScript")
If Y_DoIt = True Then
No_Action()
End If
End Function
'-> No Button Action
Function No_Action()
Bttn_Y.disabled = True
txt25.innerHTML = Replace(F3,"002060","AD0101") & "No Was Selected Cancel Operation</FONT>"
window.clearTimeout(idTimer)
idTimer = window.setTimeout("MyTimer2", 1000, "VBScript")
Exit Function
End Function
'-> Yes Button Action
Function Yes_Action()
Y_DoIt = True
HtaExit()
Exit Function
End Function
'-> Yes Button Worker
Function Yes_Work()
Bttn_N.disabled = True
txt25.innerHTML = Replace(F3,"002060","006020") & "Processing Yes Selection</FONT>"
'-> Create The Temp Cmd File For Yes
Set Ts = Fso.CreateTextFile(Cmd)
Ts.WriteLine "@Echo && CLS && MODE 55,5 && COLOR F9"
Ts.WriteLine "Set Reply=Yes"
Ts.Close
window.clearTimeout(idTimer)
idTimer = window.setTimeout("MyTimer1", 1000, "VBScript")
Exit Function
End Function
'-> Close The HTA Window
Function HtaExit()
window.clearTimeout(idTimer)
If Y_DoIt = True Then
Yes_Work()
End If
End Function
'-> Timer1
Function MyTimer1()
txt25.innerHTML = ""
window.close()
window.clearTimeout(idTimer)
Exit Function
End Function
'-> Timer2
Function MyTimer2()
txt25.innerHTML = ""
window.close()
window.clearTimeout(idTimer)
Exit Function
End Function
</SCRIPT>
<BODY Scroll='No'>
<!-- txt1 Display -->
<Table><TD Class='Type1'><Span ID='txt1'></Span></TD></Table>
<!-- txt2 Display -->
<Table><TD Class='Type1'><Span ID='txt2'></Span></TD></Table>
<!-- txt3 Display -->
<Table><TD Class='Type1'><Span ID='txt3'></Span></TD></Table>
<!-- txt4 Display -->
<Table><TD Class='Type1'><Span ID='txt4'></Span></TD></Table>
<!-- txt5 Display -->
<Table><TD Class='Type1'><Span ID='txt5'></Span></TD></Table>
<!-- txt6 Display -->
<Table><TD Class='Type1'><Span ID='txt6'></Span></TD></Table>
<!-- txt7 Display -->
<Table><TD Class='Type1'><Span ID='txt7'></Span></TD></Table>
<!-- txt8 Display -->
<Table><TD Class='Type1'><Span ID='txt8'></Span></TD></Table>
<!-- txt9 Display -->
<Table><TD Class='Type1'><Span ID='txt9'></Span></TD></Table>
<!-- txt10 Display -->
<Table><TD Class='Type1'><Span ID='txt10'></Span></TD></Table>
<!-- txt11 Display -->
<Table><TD Class='Type1'><Span ID='txt11'></Span></TD></Table>
<!-- txt12 Display -->
<Table><TD Class='Type1'><Span ID='txt12'></Span></TD></Table>
<!-- txt13 Display -->
<Table><TD Class='Type1'><Span ID='txt13'></Span></TD></Table>
<!-- txt14 Display -->
<Table><TD Class='Type1'><Span ID='txt14'></Span></TD></Table>
<!-- txt15 Display -->
<Table><TD Class='Type1'><Span ID='txt15'></Span></TD></Table>
<!-- txt16 Display -->
<Table><TD Class='Type1'><Span ID='txt16'></Span></TD></Table>
<!-- txt17 Display -->
<Table><TD Class='Type1'><Span ID='txt17'></Span></TD></Table>
<!-- txt18 Display -->
<Table><TD Class='Type1'><Span ID='txt18'></Span></TD></Table>
<!-- txt19 Display -->
<Table><TD Class='Type1'><Span ID='txt19'></Span></TD></Table>
<!-- txt20 Display -->
<Table><TD Class='Type1'><Span ID='txt20'></Span></TD></Table>
<!-- txt21 Display -->
<Table><TD Class='Type1'><Span ID='txt21'></Span></TD></Table>
<!-- txt22 Display -->
<Table><TD Class='Type1'><Span ID='txt22'></Span></TD></Table>
<!-- txt23 Display -->
<Table><TD Class='Type1'><Span ID='txt23'></Span></TD></Table>
<!-- txt24 Display -->
<Table><TD Class='Type1'><Span ID='txt24'></Span></TD></Table>
<!-- txt25 Display -->
<Table><TD Class='Type1'><Span ID='txt25'></Span></TD></Table>

<!-- Button Display -->
<Table Style='Margin-Top:7pt;' Align='Center'>
<!-- Button 01 -->
<TD><BUTTON ID='Bttn_N' OnClick='No_Action()'>No</BUTTON></TD>
<!-- Button 02 -->
<TD><BUTTON ID='Bttn_Y' OnClick='Yes_Action()'>Yes</BUTTON></TD>
</Table>
</BODY>

Edited by DefaultScript
0

Share this post


Link to post
Share on other sites

Change This

Dim Cmd :Cmd = Act.ExpandEnvironmentStrings("%userprofile%\desktop") & "\BannerResult.cmd" 

To this to get the output in the Current Directory

Dim Cmd :Cmd = Act.CurrentDirectory & "\BannerResult.cmd" 

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.