DefaultScript
Content Type
Profiles
Forums
Events
Posts posted by DefaultScript
-
-
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.... lol Great Script though overall
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
exitThis 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>0
[VBScript] MsgBox with auto select countdown and Batch Script input.
in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Posted
Thanks very much.... after looking at what you had above i figured it out lol. i did try the Act.CurrentDirectory however it wasn't generating the output to the folder. it was actually placing the output in the next higher folder and renaming the file appending the lower directory name as a prefix on the filename, hence not being able to find it caus it no longer carried the requested filename.
this was all because of the darn \ before the filename. in my code i had not put the \ before the filename and same with using your original script , i needed to remove the env variable.
now....i have read more on this act.currentdirectory and feel a bit more "trained" lol, thanks again oh and also my original script was fine as well once i removed the \ and just placed the filename itself in the line as such
use this as the output into same directory as calling scripts... Just Remove the ("%userprofile%\desktop") & from the line....
that created the file in the same folder as the called script.