Good Evening and Happy New Year to those still working... (Me Too) :)
I am having some trouble with an HTA Script. I have tried using
http://www.visualbasicscript.com/SOLVED-current-folder-amp-HTA-files-m33011.aspx and others with no fix unless im still doing it wrong. i have been working and troubleshooting/debugging this script for days. Right now i have it generating a results file to the desktop that later is deleted by another external batch file that uses the reply as a variable in determining if user accepted the agreement banner. i want the banner window to generate the result file into the same directory that the script itself is running from that way it's not appearing on the user desktop...
any ideas or help would be greatly appreciated. below is the actual HTA Script for a working banner window with a 60 second countdown before auto closing with a "NO" message. if yes is selected before the timer runs to "0" then it generates the result file as shown in line 65 under the scripting objects section of the script... Thanks for any help in advance.

This is a MODIFIED copy of the main Batch File that calls the Banner, waits for the anner to close then runs the CHECKBANNER RESULT Script section... This script is fine no issues calling and running...
@ECHO OFF title Host: %Computername% USER: %username% B Co 603rd ASB - MASTER IMO Utility
mode con:cols=100 lines=45
color F0
Set Cmd2=%cd%\banner.exe
start "Banner" "%cmd2%"
pause
cls :: **************************************************************DOD BANNER
:: ************************************************************DOD BANNER
:: **************************************************************DOD BANNER
:: ************************************************************DOD BANNER CLS
Mode 69,9
Color F9
Title Checking 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 PROCESSING..|Echo PROCESSING... DID USER ACCEPT BANNER: %reply%
pause
Del %Cmd1%
if not exist %cmd1% goto mainmenu
if exist %cmd1% echo Cannot Delete Banner Result File from Desktop...MANUAL DELETE REQUIRED!!!
pause
Exit
:BannerDenied
Color F5
CLS
Echo.
Echo Operation Was Cancelled By User or Banner Timed Out...
Echo.
Echo.
Echo.
pause
exit

This is the Banner Script... I need this script to execute the generate the
Dim Cmd :Cmd = Act.ExpandEnvironmentStrings("%userprofile%\desktop") & "\BannerResult.cmd"
to the Script folder where it is being called from ...instead of the user desktop... when i change to
Dim Cmd :Cmd = Act.ExpandEnvironmentStrings("%cd%") & "\BannerResult.cmd"
it errors out and calls line 152 with "PATH NOT FOUND"
'written by gunsmokingman at MSFN.ORG ' Modified by Robert Towler edited for B Co 603rd ASB IMO - ULLS-A Network Utility <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>
<message edited by DefaultScript on Saturday, December 31, 2011 12:56 PM>