bsharath
asked on
Any way to get the users information to a excel
Hi,
I want a way to send a link,mail or any other way which once the user updates it would update the details to a excel file automatically.
A outlook form which once sent and edited by the user and sent to me has to be updated in a excel.
Or a script with all the boxes which once entered has to update in a excel file.
regards
Sharath
I want a way to send a link,mail or any other way which once the user updates it would update the details to a excel file automatically.
A outlook form which once sent and edited by the user and sent to me has to be updated in a excel.
Or a script with all the boxes which once entered has to update in a excel file.
regards
Sharath
ASKER
Thanks a lot Rob for giving me this idea.
I want a form for general information about the user.
Name
Emp Id
Seat No
Designation
Machine Name
Ext No
All are compulsory fieds.
Thanks...
I want a form for general information about the user.
Name
Emp Id
Seat No
Designation
Machine Name
Ext No
All are compulsory fieds.
Thanks...
ASKER
Rob..
I have another Q open with the same help
https://www.experts-exchange.com/questions/22788716/Any-scrip-to-popup-or-push-a-screen-with-all-information-tabs.html
This is also related to the same solution
I have another Q open with the same help
https://www.experts-exchange.com/questions/22788716/Any-scrip-to-popup-or-push-a-screen-with-all-information-tabs.html
This is also related to the same solution
This one is also related....
https://www.experts-exchange.com/questions/22757477/Any-help-with-a-web-page-creation-which-will-update-the-data-entered-to-a-excel-sheet.html
I suppose the solution posted here (when we get to it) can accomodate all of these questions?
Rob.
https://www.experts-exchange.com/questions/22757477/Any-help-with-a-web-page-creation-which-will-update-the-data-entered-to-a-excel-sheet.html
I suppose the solution posted here (when we get to it) can accomodate all of these questions?
Rob.
ASKER
Yes Rob....
ASKER
Rob...The information that i get on the screen... and which i get in the excel is not the full content...Can you even get these left data to the excel....
-------------------------- ---------- ----------
User Name: Sriram Venkataraman
Account: SriramV
Title: Quality Engineer
Manager: Shantikumar S
Mailbox Server: INEXCHANGE
Description: 07/04/2007
Last logged-on user account: DEVELOPMENT\SriramV
Last logoff time: 20070704050356.000491+***
Last logon time: 20070704033945.000621+***
Server name: INEXCHANGE
Size: 2895
Storage group name: First Storage Group
Store name: Mailbox Store (INEXCHANGE)
Total items: 18
/o=Group/ou=First Administrative Group/cn=Recipients/cn=Sri ramV
************************** ********** ****
These are the details that i get in excel..
Display Name Login Name Title Manager Mail Server Description LegacyExchangeDN
Size,total items all miss in excel sheet
--------------------------
User Name: Sriram Venkataraman
Account: SriramV
Title: Quality Engineer
Manager: Shantikumar S
Mailbox Server: INEXCHANGE
Description: 07/04/2007
Last logged-on user account: DEVELOPMENT\SriramV
Last logoff time: 20070704050356.000491+***
Last logon time: 20070704033945.000621+***
Server name: INEXCHANGE
Size: 2895
Storage group name: First Storage Group
Store name: Mailbox Store (INEXCHANGE)
Total items: 18
/o=Group/ou=First Administrative Group/cn=Recipients/cn=Sri
**************************
These are the details that i get in excel..
Display Name Login Name Title Manager Mail Server Description LegacyExchangeDN
Size,total items all miss in excel sheet
ASKER
Sorry postd the content here wrongly..
Its for the other Q....
Its for the other Q....
ASKER
Rob need help on these Q's too.After the HTA 3 posts are over.
https://www.experts-exchange.com/questions/22788654/Scan-all-the-machines-in-the-file-and-remove-the-user-from-administrator-group-and-add-him-to-power-users.html
https://www.experts-exchange.com/questions/22793650/Get-the-machines-total-ram-Size-to-a-file.html
https://www.experts-exchange.com/questions/22788654/Scan-all-the-machines-in-the-file-and-remove-the-user-from-administrator-group-and-add-him-to-power-users.html
https://www.experts-exchange.com/questions/22793650/Get-the-machines-total-ram-Size-to-a-file.html
Sharath, let's try this HTA.....paste the text into a file called "User_Information.hta" or something with an HTA extension, and change the line that stores the strTextLogPath value. This should be on about line 30. Make sure you modify the one inside the Window_OnLoad procedure, and NOT the empty one that is the global variable declaration.
The strLogFilePath will just be the path only, the file name will be the username + .txt (automatically appended).
'========================= =======
<head>
<title>User Information Form</title>
<HTA:APPLICATION
APPLICATIONNAME="User Information Form"
BORDER="thin"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<script language="VBScript">
' Global variable to hold the path to the text files
' they are defined here to be global, but are assigned
' values in the Window_OnLoad procedure
strTextLogPath = ""
strLogFile = ""
Sub Window_OnLoad
intWidth = 800
intHeight = 600
Me.ResizeTo intWidth, intHeight
Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
Set objNetwork = CreateObject("WScript.Netw ork")
txt_loginname.Value = objNetwork.UserName
txt_machinename.Value = objNetwork.ComputerName
' This line gets the path from the currently running directory of this HTA
strTextLogPath = Mid(Replace(Replace(docume nt.URL, "file://", ""), "%20", " "), 1, InStrRev(Replace(Replace(d ocument.UR L, "file://", ""), "%20", " "), "\"))
If Right(strTextLogPath, 1) <> "\" Then strTextLogPath = strTextLogPath & "\"
' This line appends username.txt to that path
strLogFile = strTextLogPath & txt_loginname.Value & ".txt"
' This retrieves the user name for the user
Set objADSysInfo = CreateObject("ADSystemInfo ")
txt_name.Value = Replace(Split(objADSysInfo .UserName, ",")(0), "CN=", "")
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
If objFSO.FileExists(strLogFi le) Then
MsgBox "Your information has already been submitted. Thank you."
window.Close
End If
Set objFSO = Nothing
End Sub
Sub Default_Buttons
If Window.Event.KeyCode = 13 Then
btn_submit.Click
End If
End Sub
Sub Submit_Form
If txt_name.Value = "" Then
MsgBox "Please enter your full name in the Name field."
txt_name.Focus
ElseIf txt_empid.Value = "" Then
MsgBox "Please enter your Employee ID in the Emp ID field."
txt_empid.Focus
ElseIf txt_seatno.Value = "" Then
MsgBox "Please enter your seat number in the Seat No field."
txt_seatno.Focus
ElseIf txt_designation.Value = "" Then
MsgBox "Please enter your designation in the Designation field."
txt_designation.Focus
ElseIf txt_extensionno.Value = "" Then
MsgBox "Please enter your extension number in the Extension No field."
txt_extensionno.Focus
Else
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
Set objOutputFile = objFSO.CreateTextFile(strL ogFile, True)
'objOutputFile.Write """Full Name;Login Name;Employee ID;Seat Number;Designation;Machine Name;Extension Number"""
'objOutputFile.Write VbCrLf & """" & txt_name.Value & ";" & txt_loginname.Value & ";" & txt_empid.Value & ";" & txt_seatno.Value & ";" & txt_designation.Value & ";" & txt_machinename.Value & ";" & txt_extensionno.Value & """"
objOutputFile.Write "Full Name;Login Name;Employee ID;Seat Number;Designation;Machine Name;Extension Number"
objOutputFile.Write VbCrLf & txt_name.Value & ";" & txt_loginname.Value & ";" & txt_empid.Value & ";" & txt_seatno.Value & ";" & txt_designation.Value & ";" & txt_machinename.Value & ";" & txt_extensionno.Value
objOutputFile.Close
Set objOutputFile = Nothing
Set objFSO = Nothing
MsgBox "Thank you for submitting your information."
window.Close
End If
End Sub
</script>
<body STYLE="font:14 pt arial; color:white;filter:progid: DXImageTra nsform.Mic rosoft.Gra dient
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Bu ttons'>
<table width='90%' height = '100%' align='center' border='0'>
<tr>
<td align='center'>
<h3>User Information Form</h3><br>
</td>
</tr
<tr>
<td align='center'>
<table>
<tr>
<td>
Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_name" name="txt_name">
</td>
</tr>
<tr>
<td>
Login Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_loginname" name="txt_loginname" readonly>
</td>
</tr>
<tr>
<td>
Emp ID:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_empid" name="txt_emptid">
</td>
</tr>
<tr>
<td>
Seat No:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_seatno" name="txt_seatno">
</td>
</tr>
<tr>
<td>
Designation:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_designation" name="txt_designation">
</td>
</tr>
<tr>
<td>
Machine Name:
</td>
<td>
<input type="text" maxlength="16" size="25" id="txt_machinname" name="txt_machinename" readonly>
</td>
</tr>
<tr>
<td>
Extension No:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_extensionno" name="txt_extensionno">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align='center'>
<br>Please note that all fields are required.
</td>
</tr>
<tr>
<td align='center'>
<input type="button" value="Submit" name="btn_submit" onClick="vbs:Submit_Form"> <br><br>
</td>
</tr>
</table>
</body>
'========================= =======
Regards,
Rob.
The strLogFilePath will just be the path only, the file name will be the username + .txt (automatically appended).
'=========================
<head>
<title>User Information Form</title>
<HTA:APPLICATION
APPLICATIONNAME="User Information Form"
BORDER="thin"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<script language="VBScript">
' Global variable to hold the path to the text files
' they are defined here to be global, but are assigned
' values in the Window_OnLoad procedure
strTextLogPath = ""
strLogFile = ""
Sub Window_OnLoad
intWidth = 800
intHeight = 600
Me.ResizeTo intWidth, intHeight
Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
Set objNetwork = CreateObject("WScript.Netw
txt_loginname.Value = objNetwork.UserName
txt_machinename.Value = objNetwork.ComputerName
' This line gets the path from the currently running directory of this HTA
strTextLogPath = Mid(Replace(Replace(docume
If Right(strTextLogPath, 1) <> "\" Then strTextLogPath = strTextLogPath & "\"
' This line appends username.txt to that path
strLogFile = strTextLogPath & txt_loginname.Value & ".txt"
' This retrieves the user name for the user
Set objADSysInfo = CreateObject("ADSystemInfo
txt_name.Value = Replace(Split(objADSysInfo
Set objFSO = CreateObject("Scripting.Fi
If objFSO.FileExists(strLogFi
MsgBox "Your information has already been submitted. Thank you."
window.Close
End If
Set objFSO = Nothing
End Sub
Sub Default_Buttons
If Window.Event.KeyCode = 13 Then
btn_submit.Click
End If
End Sub
Sub Submit_Form
If txt_name.Value = "" Then
MsgBox "Please enter your full name in the Name field."
txt_name.Focus
ElseIf txt_empid.Value = "" Then
MsgBox "Please enter your Employee ID in the Emp ID field."
txt_empid.Focus
ElseIf txt_seatno.Value = "" Then
MsgBox "Please enter your seat number in the Seat No field."
txt_seatno.Focus
ElseIf txt_designation.Value = "" Then
MsgBox "Please enter your designation in the Designation field."
txt_designation.Focus
ElseIf txt_extensionno.Value = "" Then
MsgBox "Please enter your extension number in the Extension No field."
txt_extensionno.Focus
Else
Set objFSO = CreateObject("Scripting.Fi
Set objOutputFile = objFSO.CreateTextFile(strL
'objOutputFile.Write """Full Name;Login Name;Employee ID;Seat Number;Designation;Machine
'objOutputFile.Write VbCrLf & """" & txt_name.Value & ";" & txt_loginname.Value & ";" & txt_empid.Value & ";" & txt_seatno.Value & ";" & txt_designation.Value & ";" & txt_machinename.Value & ";" & txt_extensionno.Value & """"
objOutputFile.Write "Full Name;Login Name;Employee ID;Seat Number;Designation;Machine
objOutputFile.Write VbCrLf & txt_name.Value & ";" & txt_loginname.Value & ";" & txt_empid.Value & ";" & txt_seatno.Value & ";" & txt_designation.Value & ";" & txt_machinename.Value & ";" & txt_extensionno.Value
objOutputFile.Close
Set objOutputFile = Nothing
Set objFSO = Nothing
MsgBox "Thank you for submitting your information."
window.Close
End If
End Sub
</script>
<body STYLE="font:14 pt arial; color:white;filter:progid:
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Bu
<table width='90%' height = '100%' align='center' border='0'>
<tr>
<td align='center'>
<h3>User Information Form</h3><br>
</td>
</tr
<tr>
<td align='center'>
<table>
<tr>
<td>
Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_name" name="txt_name">
</td>
</tr>
<tr>
<td>
Login Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_loginname" name="txt_loginname" readonly>
</td>
</tr>
<tr>
<td>
Emp ID:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_empid" name="txt_emptid">
</td>
</tr>
<tr>
<td>
Seat No:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_seatno" name="txt_seatno">
</td>
</tr>
<tr>
<td>
Designation:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_designation" name="txt_designation">
</td>
</tr>
<tr>
<td>
Machine Name:
</td>
<td>
<input type="text" maxlength="16" size="25" id="txt_machinname" name="txt_machinename" readonly>
</td>
</tr>
<tr>
<td>
Extension No:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_extensionno" name="txt_extensionno">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align='center'>
<br>Please note that all fields are required.
</td>
</tr>
<tr>
<td align='center'>
<input type="button" value="Submit" name="btn_submit" onClick="vbs:Submit_Form">
</td>
</tr>
</table>
</body>
'=========================
Regards,
Rob.
Then, after you've done that, and have a couple of different user's text files, use this VBS to combine the text into an XLS file.
In this one, there's two things to change:
strWorkBook = Replace(WScript.ScriptFull Name, WScript.ScriptName, "") & "User_Info.xls"
strUserInfoFolder = "."
where strWorkBook is the path to save the XLS file to, and strUserInfoFolder must match the path that the HTA writes the text files to.
'====================
Option Explicit
' Combine_User_Info_To_Excel .vbs
Dim strWorkBook, strUserInfoFolder, objFSO, objExcelApp, objFile, objOpenFile, arrSingleLine, intCount, intRow
Const intForReading = 1
Const xlCalculationManual = -4135
Const xlCalculationAutomatic = -4105
' Change the line below to the path where you would like the Excel spreadsheet to be saved.
strWorkBook = Replace(WScript.ScriptFull Name, WScript.ScriptName, "") & "User_Info.xls"
' Change the line below to the full UNC path to the share that the text files are written to.
strUserInfoFolder = "."
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
' Create Excel Spreadsheet
Set objExcelApp = CreateObject("Excel.Applic ation")
objExcelApp.Visible = False
objExcelApp.Workbooks.Add
objExcelApp.ScreenUpdating = False
objExcelApp.Calculation = xlCalculationManual
While objExcelApp.Sheets.Count > 1
objExcelApp.Sheets(objExce lApp.Sheet s.Count).D elete
Wend
objExcelApp.ActiveWorkbook .Sheets(1) .Activate
objExcelApp.ActiveSheet.Ro ws(1).Font .Bold = True
intRow = 1
For Each objFile In objFSO.GetFolder(strUserIn foFolder). Files
'Reset back to column A for each file
If LCase(Right(objFile.Name, 4)) = ".txt" Then
Set objOpenFile = objFSO.OpenTextFile(objFil e.Name, intForReading, False)
While Not objOpenFile.AtEndOfStream
arrSingleLine = Split(objOpenFile.ReadLine , ";")
If objExcelApp.ActiveSheet.Ra nge("A1"). FormulaR1C 1 <> arrSingleLine(0) Then
For intCount = LBound(arrSingleLine) To UBound(arrSingleLine)
objExcelApp.ActiveSheet.Ce lls(intRow , intCount + 1).FormulaR1C1 = arrSingleLine(intCount)
Next
intRow = intRow + 1
End If
Wend
End If
Next
'Autofit all columns
objExcelApp.ActiveSheet.Co lumns.Enti reColumn.A utoFit
' Save Excel File
objExcelApp.DisplayAlerts = False
objExcelApp.ActiveWorkbook .SaveAs strWorkBook
objExcelApp.DisplayAlerts = True
objExcelApp.ScreenUpdating = True
objExcelApp.Calculation = xlCalculationAutomatic
objExcelApp.ActiveWorkbook .Close False
objExcelApp.Quit
MsgBox "Done"
'====================
Regards,
Rob.
In this one, there's two things to change:
strWorkBook = Replace(WScript.ScriptFull
strUserInfoFolder = "."
where strWorkBook is the path to save the XLS file to, and strUserInfoFolder must match the path that the HTA writes the text files to.
'====================
Option Explicit
' Combine_User_Info_To_Excel
Dim strWorkBook, strUserInfoFolder, objFSO, objExcelApp, objFile, objOpenFile, arrSingleLine, intCount, intRow
Const intForReading = 1
Const xlCalculationManual = -4135
Const xlCalculationAutomatic = -4105
' Change the line below to the path where you would like the Excel spreadsheet to be saved.
strWorkBook = Replace(WScript.ScriptFull
' Change the line below to the full UNC path to the share that the text files are written to.
strUserInfoFolder = "."
Set objFSO = CreateObject("Scripting.Fi
' Create Excel Spreadsheet
Set objExcelApp = CreateObject("Excel.Applic
objExcelApp.Visible = False
objExcelApp.Workbooks.Add
objExcelApp.ScreenUpdating
objExcelApp.Calculation = xlCalculationManual
While objExcelApp.Sheets.Count > 1
objExcelApp.Sheets(objExce
Wend
objExcelApp.ActiveWorkbook
objExcelApp.ActiveSheet.Ro
intRow = 1
For Each objFile In objFSO.GetFolder(strUserIn
'Reset back to column A for each file
If LCase(Right(objFile.Name, 4)) = ".txt" Then
Set objOpenFile = objFSO.OpenTextFile(objFil
While Not objOpenFile.AtEndOfStream
arrSingleLine = Split(objOpenFile.ReadLine
If objExcelApp.ActiveSheet.Ra
For intCount = LBound(arrSingleLine) To UBound(arrSingleLine)
objExcelApp.ActiveSheet.Ce
Next
intRow = intRow + 1
End If
Wend
End If
Next
'Autofit all columns
objExcelApp.ActiveSheet.Co
' Save Excel File
objExcelApp.DisplayAlerts = False
objExcelApp.ActiveWorkbook
objExcelApp.DisplayAlerts = True
objExcelApp.ScreenUpdating
objExcelApp.Calculation = xlCalculationAutomatic
objExcelApp.ActiveWorkbook
objExcelApp.Quit
MsgBox "Done"
'====================
Regards,
Rob.
ASKER
Rob on the 30th and 31st line i have this.
' This line gets the path from the currently running directory of this HTA
strTextLogPath = Mid(Replace(Replace(docume nt.URL, "file://", ""), "%20", " "), 1, InStrRev(Replace(Replace(d ocument.UR L, "file://", ""), "%20", " "), "\"))
What is the data i need to change
' This line gets the path from the currently running directory of this HTA
strTextLogPath = Mid(Replace(Replace(docume
What is the data i need to change
You can leave that line as it is, if you want the files to be stored in the same folder as the HTA itself (although then it should be in a network shared folder), or you can change it to any UNC path, such as:
strTextLogPath = "\\server\sharedfolder"
Regards,
Rob.
strTextLogPath = "\\server\sharedfolder"
Regards,
Rob.
ASKER
Great colour Rob.
How should i send this to all users?
Can we push this file to all desktops in the file.Where i have the machine names in the file.
Or if i send it through mail will it get the details remotely?
How should i send this to all users?
Can we push this file to all desktops in the file.Where i have the machine names in the file.
Or if i send it through mail will it get the details remotely?
ASKER
Should it be like this?
strTextLogPath = "\\server\sharedfolder"Mid (Replace(R eplace(doc ument.URL, "file://", ""), "%20", " "), 1, InStrRev(Replace(Replace(d ocument.UR L, "file://", ""), "%20", " "), "\"))
strTextLogPath = "\\server\sharedfolder"Mid
Provided that the user has access to the HTA on a network share, you can email them a UNC path link to that HTA, and they should be able to open it, and fill it in. I think that would be the best way, so you don't have to worry about copying it to computers, then removing it again.
Please test that with a couple of users first, then test the combining VBS script as well.
As I said, as long as you have the HTA in a network share, and the LogFilePath points to a network share they can access, it should work fine.
Regards,
Rob.
Please test that with a couple of users first, then test the combining VBS script as well.
As I said, as long as you have the HTA in a network share, and the LogFilePath points to a network share they can access, it should work fine.
Regards,
Rob.
No, just
strTextLogPath = "\\server\sharedfolder"
is fine. The whole
Mid(Replace(Replace(docume nt.URL, "file://", ""), "%20", " "), 1, InStrRev(Replace(Replace(d ocument.UR L, "file://", ""), "%20", " "), "\"))
bit only gets the current path of the HTA, which is not required if you don't want the files there....
Regards,
Rob.
strTextLogPath = "\\server\sharedfolder"
is fine. The whole
Mid(Replace(Replace(docume
bit only gets the current path of the HTA, which is not required if you don't want the files there....
Regards,
Rob.
ASKER
Small additions Rob.
1. A drop down boxes with 2 locations as "Chennai" and "Hyderabad"
2. Below in the right corner a notes box.Showing this data " This information is required to keep your details upto date in our database"
3. Ext and emp id should not accept more than 4 no's and should not accept Alphabits.
4. Designation should not accept numbers..
1. A drop down boxes with 2 locations as "Chennai" and "Hyderabad"
2. Below in the right corner a notes box.Showing this data " This information is required to keep your details upto date in our database"
3. Ext and emp id should not accept more than 4 no's and should not accept Alphabits.
4. Designation should not accept numbers..
ASKER
Rob for the combining script i get this..
-------------------------- -
Windows Script Host
-------------------------- -
Script: C:\Documents and Settings\sharathr\Desktop\ Combinetxt file.vbs
Line: 38
Char: 19
Error: Subscript out of range: '[number: 0]'
Code: 800A0009
Source: Microsoft VBScript runtime error
-------------------------- -
OK
-------------------------- -
I have 2 txt files generated
--------------------------
Windows Script Host
--------------------------
Script: C:\Documents and Settings\sharathr\Desktop\
Line: 38
Char: 19
Error: Subscript out of range: '[number: 0]'
Code: 800A0009
Source: Microsoft VBScript runtime error
--------------------------
OK
--------------------------
I have 2 txt files generated
ASKER
In the HTA file 1 last addition
Building and should have a scroll down menu as" Shafika""Hafiz Court" GR Plaza" "Hafiz Fort" and "Titus Towers"
Building and should have a scroll down menu as" Shafika""Hafiz Court" GR Plaza" "Hafiz Fort" and "Titus Towers"
Do you have any empty lines in the Computers.txt file?
Also, now that it crashed, please go to Task Manager and kill Excel.exe
To see what's happening, change
objExcelApp.Visible = False
to
objExcelApp.Visible = True
Try this:
'=================
Option Explicit
' Combine_User_Info_To_Excel .vbs
Dim strWorkBook, strUserInfoFolder, objFSO, objExcelApp, objFile, objOpenFile, arrSingleLine, intCount, intRow
Const intForReading = 1
Const xlCalculationManual = -4135
Const xlCalculationAutomatic = -4105
' Change the line below to the path where you would like the Excel spreadsheet to be saved.
strWorkBook = Replace(WScript.ScriptFull Name, WScript.ScriptName, "") & "User_Info.xls"
' Change the line below to the full UNC path to the share that the text files are written to.
strUserInfoFolder = "."
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
' Create Excel Spreadsheet
Set objExcelApp = CreateObject("Excel.Applic ation")
objExcelApp.Visible = False
objExcelApp.Workbooks.Add
objExcelApp.ScreenUpdating = False
objExcelApp.Calculation = xlCalculationManual
While objExcelApp.Sheets.Count > 1
objExcelApp.Sheets(objExce lApp.Sheet s.Count).D elete
Wend
objExcelApp.ActiveWorkbook .Sheets(1) .Activate
objExcelApp.ActiveSheet.Ro ws(1).Font .Bold = True
intRow = 1
For Each objFile In objFSO.GetFolder(strUserIn foFolder). Files
'Reset back to column A for each file
If LCase(Right(objFile.Name, 4)) = ".txt" Then
Set objOpenFile = objFSO.OpenTextFile(objFil e.Name, intForReading, False)
While Not objOpenFile.AtEndOfStream
strLine = objOpenFile.ReadLine
If Len(strLine) > 0 Then
arrSingleLine = Split(objOpenFile.ReadLine , ";")
If objExcelApp.ActiveSheet.Ra nge("A1"). FormulaR1C 1 <> arrSingleLine(0) Then
For intCount = LBound(arrSingleLine) To UBound(arrSingleLine)
objExcelApp.ActiveSheet.Ce lls(intRow , intCount + 1).FormulaR1C1 = arrSingleLine(intCount)
Next
intRow = intRow + 1
End If
End If
Wend
End If
Next
'Autofit all columns
objExcelApp.ActiveSheet.Co lumns.Enti reColumn.A utoFit
' Save Excel File
objExcelApp.DisplayAlerts = False
objExcelApp.ActiveWorkbook .SaveAs strWorkBook
objExcelApp.DisplayAlerts = True
objExcelApp.ScreenUpdating = True
objExcelApp.Calculation = xlCalculationAutomatic
objExcelApp.ActiveWorkbook .Close False
objExcelApp.Quit
MsgBox "Done"
'=================
Regards,
Rob.
Also, now that it crashed, please go to Task Manager and kill Excel.exe
To see what's happening, change
objExcelApp.Visible = False
to
objExcelApp.Visible = True
Try this:
'=================
Option Explicit
' Combine_User_Info_To_Excel
Dim strWorkBook, strUserInfoFolder, objFSO, objExcelApp, objFile, objOpenFile, arrSingleLine, intCount, intRow
Const intForReading = 1
Const xlCalculationManual = -4135
Const xlCalculationAutomatic = -4105
' Change the line below to the path where you would like the Excel spreadsheet to be saved.
strWorkBook = Replace(WScript.ScriptFull
' Change the line below to the full UNC path to the share that the text files are written to.
strUserInfoFolder = "."
Set objFSO = CreateObject("Scripting.Fi
' Create Excel Spreadsheet
Set objExcelApp = CreateObject("Excel.Applic
objExcelApp.Visible = False
objExcelApp.Workbooks.Add
objExcelApp.ScreenUpdating
objExcelApp.Calculation = xlCalculationManual
While objExcelApp.Sheets.Count > 1
objExcelApp.Sheets(objExce
Wend
objExcelApp.ActiveWorkbook
objExcelApp.ActiveSheet.Ro
intRow = 1
For Each objFile In objFSO.GetFolder(strUserIn
'Reset back to column A for each file
If LCase(Right(objFile.Name, 4)) = ".txt" Then
Set objOpenFile = objFSO.OpenTextFile(objFil
While Not objOpenFile.AtEndOfStream
strLine = objOpenFile.ReadLine
If Len(strLine) > 0 Then
arrSingleLine = Split(objOpenFile.ReadLine
If objExcelApp.ActiveSheet.Ra
For intCount = LBound(arrSingleLine) To UBound(arrSingleLine)
objExcelApp.ActiveSheet.Ce
Next
intRow = intRow + 1
End If
End If
Wend
End If
Next
'Autofit all columns
objExcelApp.ActiveSheet.Co
' Save Excel File
objExcelApp.DisplayAlerts = False
objExcelApp.ActiveWorkbook
objExcelApp.DisplayAlerts = True
objExcelApp.ScreenUpdating
objExcelApp.Calculation = xlCalculationAutomatic
objExcelApp.ActiveWorkbook
objExcelApp.Quit
MsgBox "Done"
'=================
Regards,
Rob.
ASKER
Rob i get this.
-------------------------- -
Windows Script Host
-------------------------- -
Script: C:\Documents and Settings\sharathr\Desktop\ Combinetxt file.vbs
Line: 37
Char: 19
Error: Variable is undefined: 'strLine'
Code: 800A01F4
Source: Microsoft VBScript runtime error
-------------------------- -
OK
-------------------------- -
It opens a excel sheet and then gives the above error.
Should i change any thing in the script.I fjust changed the false to True and still got the same error.
--------------------------
Windows Script Host
--------------------------
Script: C:\Documents and Settings\sharathr\Desktop\
Line: 37
Char: 19
Error: Variable is undefined: 'strLine'
Code: 800A01F4
Source: Microsoft VBScript runtime error
--------------------------
OK
--------------------------
It opens a excel sheet and then gives the above error.
Should i change any thing in the script.I fjust changed the false to True and still got the same error.
Sorry, please also add
, strLine
to the end of the Dim line at the top of the XLS writing VBS file.
Regards,
Rob.
, strLine
to the end of the Dim line at the top of the XLS writing VBS file.
Regards,
Rob.
Oh, another bit I forgot, this should work for the VBS:
'=================
Option Explicit
' Combine_User_Info_To_Excel .vbs
Dim strWorkBook, strUserInfoFolder, objFSO, objExcelApp, objFile, objOpenFile, arrSingleLine, intCount, intRow, strLine
Const intForReading = 1
Const xlCalculationManual = -4135
Const xlCalculationAutomatic = -4105
' Change the line below to the path where you would like the Excel spreadsheet to be saved.
strWorkBook = Replace(WScript.ScriptFull Name, WScript.ScriptName, "") & "User_Info.xls"
' Change the line below to the full UNC path to the share that the text files are written to.
strUserInfoFolder = "."
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
' Create Excel Spreadsheet
Set objExcelApp = CreateObject("Excel.Applic ation")
objExcelApp.Visible = False
objExcelApp.Workbooks.Add
objExcelApp.ScreenUpdating = False
objExcelApp.Calculation = xlCalculationManual
While objExcelApp.Sheets.Count > 1
objExcelApp.Sheets(objExce lApp.Sheet s.Count).D elete
Wend
objExcelApp.ActiveWorkbook .Sheets(1) .Activate
objExcelApp.ActiveSheet.Ro ws(1).Font .Bold = True
intRow = 1
For Each objFile In objFSO.GetFolder(strUserIn foFolder). Files
'Reset back to column A for each file
If LCase(Right(objFile.Name, 4)) = ".txt" Then
Set objOpenFile = objFSO.OpenTextFile(objFil e.Name, intForReading, False)
While Not objOpenFile.AtEndOfStream
strLine = objOpenFile.ReadLine
If Len(strLine) > 0 Then
arrSingleLine = Split(strLine, ";")
If objExcelApp.ActiveSheet.Ra nge("A1"). FormulaR1C 1 <> arrSingleLine(0) Then
For intCount = LBound(arrSingleLine) To UBound(arrSingleLine)
objExcelApp.ActiveSheet.Ce lls(intRow , intCount + 1).FormulaR1C1 = arrSingleLine(intCount)
Next
intRow = intRow + 1
End If
End If
Wend
End If
Next
'Autofit all columns
objExcelApp.ActiveSheet.Co lumns.Enti reColumn.A utoFit
' Save Excel File
objExcelApp.DisplayAlerts = False
objExcelApp.ActiveWorkbook .SaveAs strWorkBook
objExcelApp.DisplayAlerts = True
objExcelApp.ScreenUpdating = True
objExcelApp.Calculation = xlCalculationAutomatic
objExcelApp.ActiveWorkbook .Close False
objExcelApp.Quit
MsgBox "Done"
'================
Regards,
Rob.
'=================
Option Explicit
' Combine_User_Info_To_Excel
Dim strWorkBook, strUserInfoFolder, objFSO, objExcelApp, objFile, objOpenFile, arrSingleLine, intCount, intRow, strLine
Const intForReading = 1
Const xlCalculationManual = -4135
Const xlCalculationAutomatic = -4105
' Change the line below to the path where you would like the Excel spreadsheet to be saved.
strWorkBook = Replace(WScript.ScriptFull
' Change the line below to the full UNC path to the share that the text files are written to.
strUserInfoFolder = "."
Set objFSO = CreateObject("Scripting.Fi
' Create Excel Spreadsheet
Set objExcelApp = CreateObject("Excel.Applic
objExcelApp.Visible = False
objExcelApp.Workbooks.Add
objExcelApp.ScreenUpdating
objExcelApp.Calculation = xlCalculationManual
While objExcelApp.Sheets.Count > 1
objExcelApp.Sheets(objExce
Wend
objExcelApp.ActiveWorkbook
objExcelApp.ActiveSheet.Ro
intRow = 1
For Each objFile In objFSO.GetFolder(strUserIn
'Reset back to column A for each file
If LCase(Right(objFile.Name, 4)) = ".txt" Then
Set objOpenFile = objFSO.OpenTextFile(objFil
While Not objOpenFile.AtEndOfStream
strLine = objOpenFile.ReadLine
If Len(strLine) > 0 Then
arrSingleLine = Split(strLine, ";")
If objExcelApp.ActiveSheet.Ra
For intCount = LBound(arrSingleLine) To UBound(arrSingleLine)
objExcelApp.ActiveSheet.Ce
Next
intRow = intRow + 1
End If
End If
Wend
End If
Next
'Autofit all columns
objExcelApp.ActiveSheet.Co
' Save Excel File
objExcelApp.DisplayAlerts = False
objExcelApp.ActiveWorkbook
objExcelApp.DisplayAlerts = True
objExcelApp.ScreenUpdating
objExcelApp.Calculation = xlCalculationAutomatic
objExcelApp.ActiveWorkbook
objExcelApp.Quit
MsgBox "Done"
'================
Regards,
Rob.
ASKER
Sorry Rob i am not able to understand where.
Is it here
Option Explicit
' Combine_User_Info_To_Excel .vbs
Dim strWorkBook, strUserInfoFolder, objFSO, objExcelApp, objFile, objOpenFile, arrSingleLine, intCount, intRow
Is it here
Option Explicit
' Combine_User_Info_To_Excel
Dim strWorkBook, strUserInfoFolder, objFSO, objExcelApp, objFile, objOpenFile, arrSingleLine, intCount, intRow
Never mind the strLine thing, it should be fixed in the latest code I posted....
ASKER
Yes Rob this worked..Thanks...
Can you make the changes for the Hta file...
Can you make the changes for the Hta file...
Try this:
'=============
<head>
<title>User Information Form</title>
<HTA:APPLICATION
APPLICATIONNAME="User Information Form"
BORDER="thin"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<script language="VBScript">
' Global variable to hold the path to the text files
' they are defined here to be global, but are assigned
' values in the Window_OnLoad procedure
strTextLogPath = ""
strLogFile = ""
Sub Window_OnLoad
intWidth = 800
intHeight = 600
Me.ResizeTo intWidth, intHeight
Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
cbo_building.Style.Width = 150
Set objNetwork = CreateObject("WScript.Netw ork")
txt_loginname.Value = objNetwork.UserName
txt_machinename.Value = objNetwork.ComputerName
' This line gets the path from the currently running directory of this HTA
strTextLogPath = Mid(Replace(Replace(docume nt.URL, "file://", ""), "%20", " "), 1, InStrRev(Replace(Replace(d ocument.UR L, "file://", ""), "%20", " "), "\"))
If Right(strTextLogPath, 1) <> "\" Then strTextLogPath = strTextLogPath & "\"
' This line appends username.txt to that path
strLogFile = strTextLogPath & txt_loginname.Value & ".txt"
' This retrieves the user name for the user
Set objADSysInfo = CreateObject("ADSystemInfo ")
txt_name.Value = Replace(Split(objADSysInfo .UserName, ",")(0), "CN=", "")
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
If objFSO.FileExists(strLogFi le) Then
MsgBox "Your information has already been submitted. Thank you."
window.Close
End If
Set objFSO = Nothing
End Sub
Sub Default_Buttons
If Window.Event.KeyCode = 13 Then
btn_submit.Click
End If
End Sub
Sub Submit_Form
If txt_name.Value = "" Then
MsgBox "Please enter your full name in the Name field."
txt_name.Focus
ElseIf txt_empid.Value = "" Then
MsgBox "Please enter your Employee ID in the Emp ID field."
txt_empid.Focus
ElseIf txt_seatno.Value = "" Then
MsgBox "Please enter your seat number in the Seat No field."
txt_seatno.Focus
ElseIf txt_designation.Value = "" Then
MsgBox "Please enter your designation in the Designation field."
txt_designation.Focus
ElseIf cbo_building.Value = "opt_none" Then
MsgBox "Please select your building from the Building drop down box."
cbo_building.Focus
ElseIf txt_extensionno.Value = "" Then
MsgBox "Please enter your extension number in the Extension No field."
txt_extensionno.Focus
Else
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
Set objOutputFile = objFSO.CreateTextFile(strL ogFile, True)
'objOutputFile.Write """Full Name;Login Name;Employee ID;Seat Number;Designation;Machine Name;Extension Number"""
'objOutputFile.Write VbCrLf & """" & txt_name.Value & ";" & txt_loginname.Value & ";" & txt_empid.Value & ";" & txt_seatno.Value & ";" & txt_designation.Value & ";" & txt_machinename.Value & ";" & txt_extensionno.Value & """"
objOutputFile.Write "Full Name;Login Name;Employee ID;Seat Number;Designation;Buildin g;Machine Name;Extension Number"
objOutputFile.Write VbCrLf & txt_name.Value & ";" & txt_loginname.Value & ";" & txt_empid.Value & ";" & txt_seatno.Value & ";" & txt_designation.Value & ";" & cbo_Building.Value & ";" & txt_machinename.Value & ";" & txt_extensionno.Value
objOutputFile.Close
Set objOutputFile = Nothing
Set objFSO = Nothing
MsgBox "Thank you for submitting your information."
window.Close
End If
End Sub
</script>
<body STYLE="font:14 pt arial; color:white;filter:progid: DXImageTra nsform.Mic rosoft.Gra dient
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Bu ttons'>
<table width='90%' height = '100%' align='center' border='0'>
<tr>
<td align='center'>
<h3>User Information Form</h3><br>
</td>
</tr
<tr>
<td align='center'>
<table>
<tr>
<td>
Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_name" name="txt_name">
</td>
</tr>
<tr>
<td>
Login Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_loginname" name="txt_loginname" readonly>
</td>
</tr>
<tr>
<td>
Emp ID:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_empid" name="txt_emptid">
</td>
</tr>
<tr>
<td>
Seat No:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_seatno" name="txt_seatno">
</td>
</tr>
<tr>
<td>
Designation:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_designation" name="txt_designation">
</td>
</tr>
<tr>
<td>
Building:
</td>
<td>
<select size="1" id="cbo_building" name="cbo_building">
<option id="opt_none" value="opt_none" selected> --- Select Building --- </option>
<option id="opt_shafika" value="Shafika">Shafika</o ption>
<option id="opt_hafizcourt" value="Hafiz Court">Hafiz Court</option>
<option id="opt_grplaza" value="GR Plaza">GR Plaza</option>
<option id="opt_hafizfort" value="Hafiz Fort">Hafiz Fort</option>
<option id="opt_titustowers" value="Titus Towers">Titus Towers</option>
</select>
</td>
</tr>
<tr>
<td>
Machine Name:
</td>
<td>
<input type="text" maxlength="16" size="25" id="txt_machinname" name="txt_machinename" readonly>
</td>
</tr>
<tr>
<td>
Extension No:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_extensionno" name="txt_extensionno">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align='center'>
<br>Please note that all fields are required.
</td>
</tr>
<tr>
<td align='center'>
<input type="button" value="Submit" name="btn_submit" onClick="vbs:Submit_Form"> <br><br>
</td>
</tr>
</table>
</body>
'=============
Regards,
Rob.
'=============
<head>
<title>User Information Form</title>
<HTA:APPLICATION
APPLICATIONNAME="User Information Form"
BORDER="thin"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<script language="VBScript">
' Global variable to hold the path to the text files
' they are defined here to be global, but are assigned
' values in the Window_OnLoad procedure
strTextLogPath = ""
strLogFile = ""
Sub Window_OnLoad
intWidth = 800
intHeight = 600
Me.ResizeTo intWidth, intHeight
Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
cbo_building.Style.Width = 150
Set objNetwork = CreateObject("WScript.Netw
txt_loginname.Value = objNetwork.UserName
txt_machinename.Value = objNetwork.ComputerName
' This line gets the path from the currently running directory of this HTA
strTextLogPath = Mid(Replace(Replace(docume
If Right(strTextLogPath, 1) <> "\" Then strTextLogPath = strTextLogPath & "\"
' This line appends username.txt to that path
strLogFile = strTextLogPath & txt_loginname.Value & ".txt"
' This retrieves the user name for the user
Set objADSysInfo = CreateObject("ADSystemInfo
txt_name.Value = Replace(Split(objADSysInfo
Set objFSO = CreateObject("Scripting.Fi
If objFSO.FileExists(strLogFi
MsgBox "Your information has already been submitted. Thank you."
window.Close
End If
Set objFSO = Nothing
End Sub
Sub Default_Buttons
If Window.Event.KeyCode = 13 Then
btn_submit.Click
End If
End Sub
Sub Submit_Form
If txt_name.Value = "" Then
MsgBox "Please enter your full name in the Name field."
txt_name.Focus
ElseIf txt_empid.Value = "" Then
MsgBox "Please enter your Employee ID in the Emp ID field."
txt_empid.Focus
ElseIf txt_seatno.Value = "" Then
MsgBox "Please enter your seat number in the Seat No field."
txt_seatno.Focus
ElseIf txt_designation.Value = "" Then
MsgBox "Please enter your designation in the Designation field."
txt_designation.Focus
ElseIf cbo_building.Value = "opt_none" Then
MsgBox "Please select your building from the Building drop down box."
cbo_building.Focus
ElseIf txt_extensionno.Value = "" Then
MsgBox "Please enter your extension number in the Extension No field."
txt_extensionno.Focus
Else
Set objFSO = CreateObject("Scripting.Fi
Set objOutputFile = objFSO.CreateTextFile(strL
'objOutputFile.Write """Full Name;Login Name;Employee ID;Seat Number;Designation;Machine
'objOutputFile.Write VbCrLf & """" & txt_name.Value & ";" & txt_loginname.Value & ";" & txt_empid.Value & ";" & txt_seatno.Value & ";" & txt_designation.Value & ";" & txt_machinename.Value & ";" & txt_extensionno.Value & """"
objOutputFile.Write "Full Name;Login Name;Employee ID;Seat Number;Designation;Buildin
objOutputFile.Write VbCrLf & txt_name.Value & ";" & txt_loginname.Value & ";" & txt_empid.Value & ";" & txt_seatno.Value & ";" & txt_designation.Value & ";" & cbo_Building.Value & ";" & txt_machinename.Value & ";" & txt_extensionno.Value
objOutputFile.Close
Set objOutputFile = Nothing
Set objFSO = Nothing
MsgBox "Thank you for submitting your information."
window.Close
End If
End Sub
</script>
<body STYLE="font:14 pt arial; color:white;filter:progid:
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Bu
<table width='90%' height = '100%' align='center' border='0'>
<tr>
<td align='center'>
<h3>User Information Form</h3><br>
</td>
</tr
<tr>
<td align='center'>
<table>
<tr>
<td>
Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_name" name="txt_name">
</td>
</tr>
<tr>
<td>
Login Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_loginname" name="txt_loginname" readonly>
</td>
</tr>
<tr>
<td>
Emp ID:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_empid" name="txt_emptid">
</td>
</tr>
<tr>
<td>
Seat No:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_seatno" name="txt_seatno">
</td>
</tr>
<tr>
<td>
Designation:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_designation" name="txt_designation">
</td>
</tr>
<tr>
<td>
Building:
</td>
<td>
<select size="1" id="cbo_building" name="cbo_building">
<option id="opt_none" value="opt_none" selected> --- Select Building --- </option>
<option id="opt_shafika" value="Shafika">Shafika</o
<option id="opt_hafizcourt" value="Hafiz Court">Hafiz Court</option>
<option id="opt_grplaza" value="GR Plaza">GR Plaza</option>
<option id="opt_hafizfort" value="Hafiz Fort">Hafiz Fort</option>
<option id="opt_titustowers" value="Titus Towers">Titus Towers</option>
</select>
</td>
</tr>
<tr>
<td>
Machine Name:
</td>
<td>
<input type="text" maxlength="16" size="25" id="txt_machinname" name="txt_machinename" readonly>
</td>
</tr>
<tr>
<td>
Extension No:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_extensionno" name="txt_extensionno">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align='center'>
<br>Please note that all fields are required.
</td>
</tr>
<tr>
<td align='center'>
<input type="button" value="Submit" name="btn_submit" onClick="vbs:Submit_Form">
</td>
</tr>
</table>
</body>
'=============
Regards,
Rob.
ASKER
1. A drop down boxes with 2 locations as "Chennai" and "Hyderabad"
2. Below in the right corner a notes box.Showing this data " This information is required to keep your details upto date in our database"
3. Designation should not accept numbers..
4.The Hta file still accepts Alphabits in Ext No Can you min it to 4 from 5
ASKER
Rob can you put the Building above the Seat No.
Please increase the characters in Seat No to 10 as it does not accept more that 5 characters
Sorry final changes...
Please increase the characters in Seat No to 10 as it does not accept more that 5 characters
Sorry final changes...
ASKER
Rob by keeping this in ashared folder and sending everyone a mail to update this seems as not secure.As every one who opens the shared folder can see others data.
Can we make the Hta file not to open the code or be copied by others....
Can we make the Hta file not to open the code or be copied by others....
ASKER
If i even change the file path to some other path the Hta file is open so others can open the code and see the location..
As all are software engineers with whome i need to deal with....
As all are software engineers with whome i need to deal with....
OK, here's the changes on the HTA:
'================
<head>
<title>User Information Form</title>
<HTA:APPLICATION
APPLICATIONNAME="User Information Form"
BORDER="thin"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<script language="VBScript">
' Global variable to hold the path to the text files
' they are defined here to be global, but are assigned
' values in the Window_OnLoad procedure
strTextLogPath = ""
strLogFile = ""
Sub Window_OnLoad
intWidth = 800
intHeight = 600
Me.ResizeTo intWidth, intHeight
Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
cbo_building.Style.Width = 150
Set objNetwork = CreateObject("WScript.Netw ork")
txt_loginname.Value = objNetwork.UserName
txt_machinename.Value = objNetwork.ComputerName
' This line gets the path from the currently running directory of this HTA
strTextLogPath = Mid(Replace(Replace(docume nt.URL, "file://", ""), "%20", " "), 1, InStrRev(Replace(Replace(d ocument.UR L, "file://", ""), "%20", " "), "\"))
If Right(strTextLogPath, 1) <> "\" Then strTextLogPath = strTextLogPath & "\"
' This line appends username.txt to that path
strLogFile = strTextLogPath & txt_loginname.Value & ".txt"
' This retrieves the user name for the user
Set objADSysInfo = CreateObject("ADSystemInfo ")
txt_name.Value = Replace(Split(objADSysInfo .UserName, ",")(0), "CN=", "")
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
If objFSO.FileExists(strLogFi le) Then
MsgBox "Your information has already been submitted. Thank you."
window.Close
End If
Set objFSO = Nothing
End Sub
Sub Default_Buttons
If Window.Event.KeyCode = 13 Then
btn_submit.Click
End If
End Sub
Sub Submit_Form
If txt_name.Value = "" Then
MsgBox "Please enter your full name in the Name field."
txt_name.Focus
ElseIf txt_empid.Value = "" Then
MsgBox "Please enter your Employee ID in the Emp ID field."
txt_empid.Focus
ElseIf cbo_building.Value = "opt_none" Then
MsgBox "Please select your building from the Building drop down box."
cbo_building.Focus
ElseIf txt_seatno.Value = "" Then
MsgBox "Please enter your seat number in the Seat No field."
txt_seatno.Focus
ElseIf txt_designation.Value = "" Then
MsgBox "Please enter your designation in the Designation field."
txt_designation.Focus
ElseIf cbo_location.Value = "opt_none" Then
MsgBox "Please select your location from the Location drop down box."
cbo_location.Focus
ElseIf txt_extensionno.Value = "" Then
MsgBox "Please enter your extension number in the Extension No field."
txt_extensionno.Focus
Else
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
Set objOutputFile = objFSO.CreateTextFile(strL ogFile, True)
'objOutputFile.Write """Full Name;Login Name;Employee ID;Seat Number;Designation;Machine Name;Extension Number"""
'objOutputFile.Write VbCrLf & """" & txt_name.Value & ";" & txt_loginname.Value & ";" & txt_empid.Value & ";" & txt_seatno.Value & ";" & txt_designation.Value & ";" & txt_machinename.Value & ";" & txt_extensionno.Value & """"
objOutputFile.Write "Full Name;Login Name;Employee ID;Building;Seat Number;Designation;Locatio n;Machine Name;Extension Number"
objOutputFile.Write VbCrLf & txt_name.Value & ";" & txt_loginname.Value & ";" & txt_empid.Value & ";" & cbo_Building.Value & ";" & txt_seatno.Value & ";" & txt_designation.Value & ";" & cbo_Location.Value & ";" & txt_machinename.Value & ";" & txt_extensionno.Value
objOutputFile.Close
Set objOutputFile = Nothing
Set objFSO = Nothing
MsgBox "Thank you for submitting your information."
window.Close
End If
End Sub
Sub Validate_Keys(strField)
If LCase(strField) = "designation" Then
If Window.Event.KeyCode >= 48 And Window.Event.KeyCode <= 57 Then Window.Event.KeyCode = Null
ElseIf LCase(strField) = "extensionno" Then
If Window.Event.KeyCode < 48 Or Window.Event.KeyCode > 57 Then Window.Event.KeyCode = Null
End If
End Sub
</script>
<body STYLE="font:14 pt arial; color:white;filter:progid: DXImageTra nsform.Mic rosoft.Gra dient
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Bu ttons'>
<table width='90%' height = '100%' align='center' border='0'>
<tr>
<td align='center'>
<h3>User Information Form</h3><br>
</td>
</tr
<tr>
<td align='center'>
<table>
<tr>
<td>
Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_name" name="txt_name">
</td>
</tr>
<tr>
<td>
Login Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_loginname" name="txt_loginname" readonly>
</td>
</tr>
<tr>
<td>
Emp ID:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_empid" name="txt_emptid">
</td>
</tr>
<tr>
<td>
Building:
</td>
<td>
<select size="1" id="cbo_building" name="cbo_building">
<option id="opt_none" value="opt_none" selected> --- Select Building --- </option>
<option id="opt_shafika" value="Shafika">Shafika</o ption>
<option id="opt_hafizcourt" value="Hafiz Court">Hafiz Court</option>
<option id="opt_grplaza" value="GR Plaza">GR Plaza</option>
<option id="opt_hafizfort" value="Hafiz Fort">Hafiz Fort</option>
<option id="opt_titustowers" value="Titus Towers">Titus Towers</option>
</select>
</td>
</tr>
<tr>
<td>
Seat No:
</td>
<td>
<input type="text" maxlength="10" size="15" id="txt_seatno" name="txt_seatno">
</td>
</tr>
<tr>
<td>
Designation:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_designation" name="txt_designation" onkeypress="vbs:Validate_K eys('desig nation')">
</td>
</tr>
<tr>
<td>
Location:
</td>
<td>
<select size="1" id="cbo_location" name="cbo_location">
<option id="opt_none" value="opt_none" selected> --- Select Location --- </option>
<option id="opt_chennai" value="Chennai">Chennai</o ption>
<option id="opt_hyderabad" value="Hyderabad">Hyderaba d</option>
</select>
</td>
</tr>
<tr>
<td>
Machine Name:
</td>
<td>
<input type="text" maxlength="16" size="25" id="txt_machinname" name="txt_machinename" readonly>
</td>
</tr>
<tr>
<td>
Extension No:
</td>
<td>
<input type="text" maxlength="4" size="10" id="txt_extensionno" name="txt_extensionno" onkeypress="vbs:Validate_K eys('exten sionno')">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align='center'>
<br>Please note that all fields are required.
</td>
</tr>
<tr>
<td align='center'>
<input type="button" value="Submit" name="btn_submit" onClick="vbs:Submit_Form"> <br><br>
</td>
</tr>
<tr>
<td align="right">
This information is required to keep<br>
your details up to date in our database
</td>
</tr>
</table>
</body>
'================
Now, as far as security goes.....check this article out:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/mar06/hey0309.mspx
It tells you how to "encode" the VBScript elements inside the HTA, which will scramble the script inside it, and should not be viewable via any editor.
Regards,
Rob.
'================
<head>
<title>User Information Form</title>
<HTA:APPLICATION
APPLICATIONNAME="User Information Form"
BORDER="thin"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<script language="VBScript">
' Global variable to hold the path to the text files
' they are defined here to be global, but are assigned
' values in the Window_OnLoad procedure
strTextLogPath = ""
strLogFile = ""
Sub Window_OnLoad
intWidth = 800
intHeight = 600
Me.ResizeTo intWidth, intHeight
Me.MoveTo ((Screen.Width / 2) - (intWidth / 2)),((Screen.Height / 2) - (intHeight / 2))
cbo_building.Style.Width = 150
Set objNetwork = CreateObject("WScript.Netw
txt_loginname.Value = objNetwork.UserName
txt_machinename.Value = objNetwork.ComputerName
' This line gets the path from the currently running directory of this HTA
strTextLogPath = Mid(Replace(Replace(docume
If Right(strTextLogPath, 1) <> "\" Then strTextLogPath = strTextLogPath & "\"
' This line appends username.txt to that path
strLogFile = strTextLogPath & txt_loginname.Value & ".txt"
' This retrieves the user name for the user
Set objADSysInfo = CreateObject("ADSystemInfo
txt_name.Value = Replace(Split(objADSysInfo
Set objFSO = CreateObject("Scripting.Fi
If objFSO.FileExists(strLogFi
MsgBox "Your information has already been submitted. Thank you."
window.Close
End If
Set objFSO = Nothing
End Sub
Sub Default_Buttons
If Window.Event.KeyCode = 13 Then
btn_submit.Click
End If
End Sub
Sub Submit_Form
If txt_name.Value = "" Then
MsgBox "Please enter your full name in the Name field."
txt_name.Focus
ElseIf txt_empid.Value = "" Then
MsgBox "Please enter your Employee ID in the Emp ID field."
txt_empid.Focus
ElseIf cbo_building.Value = "opt_none" Then
MsgBox "Please select your building from the Building drop down box."
cbo_building.Focus
ElseIf txt_seatno.Value = "" Then
MsgBox "Please enter your seat number in the Seat No field."
txt_seatno.Focus
ElseIf txt_designation.Value = "" Then
MsgBox "Please enter your designation in the Designation field."
txt_designation.Focus
ElseIf cbo_location.Value = "opt_none" Then
MsgBox "Please select your location from the Location drop down box."
cbo_location.Focus
ElseIf txt_extensionno.Value = "" Then
MsgBox "Please enter your extension number in the Extension No field."
txt_extensionno.Focus
Else
Set objFSO = CreateObject("Scripting.Fi
Set objOutputFile = objFSO.CreateTextFile(strL
'objOutputFile.Write """Full Name;Login Name;Employee ID;Seat Number;Designation;Machine
'objOutputFile.Write VbCrLf & """" & txt_name.Value & ";" & txt_loginname.Value & ";" & txt_empid.Value & ";" & txt_seatno.Value & ";" & txt_designation.Value & ";" & txt_machinename.Value & ";" & txt_extensionno.Value & """"
objOutputFile.Write "Full Name;Login Name;Employee ID;Building;Seat Number;Designation;Locatio
objOutputFile.Write VbCrLf & txt_name.Value & ";" & txt_loginname.Value & ";" & txt_empid.Value & ";" & cbo_Building.Value & ";" & txt_seatno.Value & ";" & txt_designation.Value & ";" & cbo_Location.Value & ";" & txt_machinename.Value & ";" & txt_extensionno.Value
objOutputFile.Close
Set objOutputFile = Nothing
Set objFSO = Nothing
MsgBox "Thank you for submitting your information."
window.Close
End If
End Sub
Sub Validate_Keys(strField)
If LCase(strField) = "designation" Then
If Window.Event.KeyCode >= 48 And Window.Event.KeyCode <= 57 Then Window.Event.KeyCode = Null
ElseIf LCase(strField) = "extensionno" Then
If Window.Event.KeyCode < 48 Or Window.Event.KeyCode > 57 Then Window.Event.KeyCode = Null
End If
End Sub
</script>
<body STYLE="font:14 pt arial; color:white;filter:progid:
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Bu
<table width='90%' height = '100%' align='center' border='0'>
<tr>
<td align='center'>
<h3>User Information Form</h3><br>
</td>
</tr
<tr>
<td align='center'>
<table>
<tr>
<td>
Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_name" name="txt_name">
</td>
</tr>
<tr>
<td>
Login Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_loginname" name="txt_loginname" readonly>
</td>
</tr>
<tr>
<td>
Emp ID:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_empid" name="txt_emptid">
</td>
</tr>
<tr>
<td>
Building:
</td>
<td>
<select size="1" id="cbo_building" name="cbo_building">
<option id="opt_none" value="opt_none" selected> --- Select Building --- </option>
<option id="opt_shafika" value="Shafika">Shafika</o
<option id="opt_hafizcourt" value="Hafiz Court">Hafiz Court</option>
<option id="opt_grplaza" value="GR Plaza">GR Plaza</option>
<option id="opt_hafizfort" value="Hafiz Fort">Hafiz Fort</option>
<option id="opt_titustowers" value="Titus Towers">Titus Towers</option>
</select>
</td>
</tr>
<tr>
<td>
Seat No:
</td>
<td>
<input type="text" maxlength="10" size="15" id="txt_seatno" name="txt_seatno">
</td>
</tr>
<tr>
<td>
Designation:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_designation" name="txt_designation" onkeypress="vbs:Validate_K
</td>
</tr>
<tr>
<td>
Location:
</td>
<td>
<select size="1" id="cbo_location" name="cbo_location">
<option id="opt_none" value="opt_none" selected> --- Select Location --- </option>
<option id="opt_chennai" value="Chennai">Chennai</o
<option id="opt_hyderabad" value="Hyderabad">Hyderaba
</select>
</td>
</tr>
<tr>
<td>
Machine Name:
</td>
<td>
<input type="text" maxlength="16" size="25" id="txt_machinname" name="txt_machinename" readonly>
</td>
</tr>
<tr>
<td>
Extension No:
</td>
<td>
<input type="text" maxlength="4" size="10" id="txt_extensionno" name="txt_extensionno" onkeypress="vbs:Validate_K
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align='center'>
<br>Please note that all fields are required.
</td>
</tr>
<tr>
<td align='center'>
<input type="button" value="Submit" name="btn_submit" onClick="vbs:Submit_Form">
</td>
</tr>
<tr>
<td align="right">
This information is required to keep<br>
your details up to date in our database
</td>
</tr>
</table>
</body>
'================
Now, as far as security goes.....check this article out:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/mar06/hey0309.mspx
It tells you how to "encode" the VBScript elements inside the HTA, which will scramble the script inside it, and should not be viewable via any editor.
Regards,
Rob.
And then, as I think you have done, change the text file location to somewhere they are not aware of.
Rob.
Rob.
ASKER
Rob should i change this part to change the location of the outputs
' Global variable to hold the path to the text files
' they are defined here to be global, but are assigned
' values in the Window_OnLoad procedure
strTextLogPath = "\\servername\foldername"
strLogFile = "" (Should i change this also.)
' Global variable to hold the path to the text files
' they are defined here to be global, but are assigned
' values in the Window_OnLoad procedure
strTextLogPath = "\\servername\foldername"
strLogFile = "" (Should i change this also.)
No, sorry, just the strTextLogPath that is inside the Window_OnLoad procedure, as you did before, on about line 30 or 31.
The two at the top that are global variables should remain empty.
Regards,
Rob.
The two at the top that are global variables should remain empty.
Regards,
Rob.
ASKER
Ok thanks Rob got it.
Last help the encoding of the script can you put it in short here please...
Last help the encoding of the script can you put it in short here please...
OK, download the Microsoft Script Encoder and install it from here:
http://www.microsoft.com/downloads/details.aspx?FamilyId=E7877F67-C447-4873-B1B0-21F0626A6329
Then put this line:
'**Start Encode**
underneath this line
<script language="VBScript">
so it looks like this:
<script language="VBScript">
'**Start Encode**
Then, rename the HTA extension to HTM, and run this command:
C:\Program Files\Windows Script Encoder>screnc <filename>.htm <filename>.hta
where <filename> is replaced with the full path your file.
Then, the HTA that gets created should be encoded.
Please bear in mind though, this is not entirely secure (from that MS website):
"the important thing to keep in mind is that the script is simply encoded (or obfuscated); it is definitely not encrypted. What does that mean? That means the encoder will hide your script from most people; however, a truly determined hacker - armed with a knowledge of codes or armed with a utility downloaded from the Internet - could crack the code. Among other things, that means that you should never do something like hide an Administrator password in a script and assume that the Script Encoder will keep it safe from prying eyes. It wont. Its an encoder, not an encrypter, and theres definitely a difference"
Regards,
Rob.
http://www.microsoft.com/downloads/details.aspx?FamilyId=E7877F67-C447-4873-B1B0-21F0626A6329
Then put this line:
'**Start Encode**
underneath this line
<script language="VBScript">
so it looks like this:
<script language="VBScript">
'**Start Encode**
Then, rename the HTA extension to HTM, and run this command:
C:\Program Files\Windows Script Encoder>screnc <filename>.htm <filename>.hta
where <filename> is replaced with the full path your file.
Then, the HTA that gets created should be encoded.
Please bear in mind though, this is not entirely secure (from that MS website):
"the important thing to keep in mind is that the script is simply encoded (or obfuscated); it is definitely not encrypted. What does that mean? That means the encoder will hide your script from most people; however, a truly determined hacker - armed with a knowledge of codes or armed with a utility downloaded from the Internet - could crack the code. Among other things, that means that you should never do something like hide an Administrator password in a script and assume that the Script Encoder will keep it safe from prying eyes. It wont. Its an encoder, not an encrypter, and theres definitely a difference"
Regards,
Rob.
ASKER
Rob any way to fetch Email id automatically
ASKER
Rob you have great Patients....:)
Email ID? As in their email address from Exchange>
ASKER
Rob the code looks like this.
<head>
<title>User Information Form</title>
<HTA:APPLICATION
APPLICATIONNAME="User Information Form"
BORDER="thin"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<script language="VBScript.Encode" >#@~^yhAAA A==@#@&@#@ &EPVVW(l^~ \mDrl(Vn~D WP4GV9PY4n ~wmY4POW~O 4+~YaY,0r s/@#@&v,Y 4+H~mDn,N 0k +9~tDnPDW~8Po^G4mV~,8;Y, lM+~lddboU +9@#@&EP-C ^E+d~bx~Y4 n,r NKh{}xdGl9P2DKmn[!D+@#@&/D DKaOSKohl Ot~x,JE@#@ &dYMSGLwkV n~{PEJ@#@& @#@&j!4,k NKA{}xJWmN@#@&,PP,~PbxYqr[ Y4P{P0!T@# @&P~P,~Pbx Ouko4O,'~ vZT@#@&~,P ,PPt+c]+kk "+:W~r Yb[Y4~PbUOCkTtO@#@&~,P~H HK\nPKP`cj1Dn+ qk[Dt,zPy#,RPvkUYqk[O4Pz,+ #*~`vj^D+ Ru+rL4Y~z,+#,O~cbxYunbo4Y, &, b*@#@&PP,P18W|4;k^NrUTR?Dz VRb[Ot,' ,FX!@#@&,P ~P,~?Y~G( L1nOSW.3,x ,Z.lD+r(L ^YvJ ?1Dr2DR1OhKD3rb@#@&,P,P~P OaD{sWTrx lhnc.ls;PxPK8N1nDhKD3cjkn Dglh+@#@&~ ~,PP,O6D{: m^4k + lh+ #mV;+,xPK4%HYhG.0R/Ws2!Yn M1m:+@#@&@ #@&P,P~P,B ~P4k/,sk +PTnO/,Y4+~wCO4PWDKhPDtn~1 ED.n YsX,.!xUbxTPNbD^YKDzPK0~O 4k/,uKz@#@ &,~~P,PkY. KnaDSGohCY 4Px~r--[n7 O^tU :.9FZ!-GlDCJ@#@&~P,P~~@#@& P,~P,Pq6~] kTtD`dY.P 6OSKLnmY4S ,F#~@!@*PE -r~:tn PkYD:+XOSKoKlDt~x,/YMP+XYS KLKlDt,[~J wE@#@&~P,~ P,B~P4k/~s bxnPm2a+U9 /,E/D C:RO6DPOG,YtmOPalY4@#@&P, P,P~/O.dWL sbs+,'~~kY DPnXYJWTKm Y4,[,Y6D{^ GobxUls+ #mVE~[,JRDaOJ@#@&,P~P~~EP PtbdPM+O.b +\nd,Y4+,; k+.,xm:+,0 K.PDtnP!/n .@#@&P,~P, P?O~W(Lzf jXd( 0GP{~ZM+COr4%n1YcJz9UXdD+ sqx6Wrb@#@ &P~P,P~OXY { C:R.ms;+,',InwsC1+c?askD` G8NbfjzkqU 0K `/nM1m:+BPrSJ*`T#BPE/g'JB~ Jr#@#@&~~P ,P,?nY~G(L o?}~',Z.nm Y+68N+^YvE Um.bwDkxTR wrV?z/D+h 6(L+1OJ*@# @&,~~P,P&0 ~W8%w?6Rwr V2arkY/cd DDJWTobVn* P:t+ @#@&~P,P~P,P~~,PHkLAK6PreG EMPbxWW.hm YrW ~tm/~C^D+C[HP8+U,/;(:bYY Nc~P:tCx0P zG!RJ@#@&P ,PP,~~P,P, PAkU[Kh Z^G/@#@&~,PP~~Ax[P&W@#@&~ ,P,PPU+D~W (Lo?}Px~gW Y4rxT@#@&A U[PUE(@#@& @#@&j!4~f Wl!VOm~EYO G /@#@&,~,P~,q6Pbx9Ghc2-+ Y FXZK[+,'P8f~K4+ @#@&P~~,P~P,~P,P8O {/;8skOR;sbmV@#@&,PP,P,3x9 P(0@#@&3U9 P?!8@#@&@# @&U;8PUE(: rYmoKDh@#@ &~P,P~~&0P OaD{Ulsnc. C^EP',Jr~ K4+U@#@&P~ ~,PP,~P,PP tdLAK6,JKV nCk+~+ O+MPzG!DPW;^V~xmhPr PDt+,1mh+,0r+^N E@#@&P,~P,PP,~~P,YXYmxChR oW1;/@#@&~ ~,PP~3^/nq 6~D6O|+swk 9RjCV!+~', JE~:t+ @#@&,PP,~~P,P,P~HdL~WaPrKV ldn,+xOnM PzW!.,2haV KX+P&9Pbx ~Y4+~3swP& 9P6k+^[ J@#@&,P~P~~,P~P,~YXYmnswk[ wW^Ek@#@&P~,P,P2^/(0,m8W| 4;r^Nk LRjlV!n~',JKwO{UG +EP:4+ @#@&~,PP~~,P~P,~t/L~WXPJhV C/Pd+^+^ O,XW!.P(Ek ^[rxTP6DG: ~O4+~A!rV9 kUL,NDG2,N Gh ~(WacJ@#@&P,P,~P,P~P,P^8K{ 4!rV9kxT oW1Ek@#@&P~~,P~2^d+&0~OXY{ dnmYUWc#mV ;P{PJrP:4 + @#@&P,P~~,PP,~P,H/T$G6,JhV nldn,+UY. PHW;.,/+CO ,x;:(nMPr PDt+,?CY,1GP6kns9RJ@#@&P, PP,~~P,P,P O6Omk+CY GRwW^;k@#@&~~,P~PAsk+(6PD6 Y|NdkTxCY bWU jlV!nP{PJr~Ptx@#@&~P~~,P~ P,~P,HdL~W 6~EhVnlkn, +UD+MPXKEM ~N/ro lOrKxPbUPDt+,9n/bo lOkGU,0r+^[Rr@#@&~,PP~~,P~ P,~D6O|N/ kTxmOkKx sKm;d@#@&P,~P,P2^dnq6P14G{ sG1lOkKURj ls;P'~EKw O{ G +E,K4+x@#@&,~P,P~P,P~~,H/T $WXPJhsnlk +,/nVn^DPz W!.P^W^CDk WU~6DG:,O4 +~dW1lYbW ~NMW2P9WAU,4WX J@#@&P,~~P,P,P~P~^(WmVK^lD kGUcsW^;k@ #@&P,~,P~A Vk+q6PDaY| +aYxdrKxx K .mVE~xPrJ,K4+U@#@&P~P,~P, P~~,PHdL~W aPrK^+Ck+, +xD+M~XKE. P6On /kKUP E:(n.Pbx,Y4+~3XYnxkrW PHG,0kns9RE@#@&~,P~,P,PP,P ,O6D{n6D+U dbWx GRwWm!d@#@&,P,P~P3sk+@#@&, ~P,P~~,PP~ ~U+OPK8Nsj }P{PZM+mO+ }4%+1YcEUm Db2Ybxocor V?H/O+h6( LnmDE#@#@& ~~,PP~~,P~ P,jY~K4Nr EDw!OsbVnP {PG8Ns?} ZM+lDnP+XYwks+cdDDJWTok^+S ~:DEnb@#@& ~P,~,P~,P, PPEW(%r!Y2 EDsrsRMr YPJrEoE^V ,1C:nIdWLk ~1m:nIA:wsGH+nP&9p?nmY,1Es 4.iG+dkTx CObWxp\l1t k n~1m:i36On /rW ~1!:8nMJJE@#@&P~P,~,P~,P,P BK4N6EDw;Y wksncDbO+ ,.4;.J0,[, JEJE~LPO6D mxm:n jlV;n,[~JpE,[~D6D{VKobUxm: nRjls;P[, EirP[,OaY| +swrN #mV;+,'PriE~LPYaO|/nlDUKR# mV!+PLPrIJ ,[~YXYm[/ kTUlDkW #l^EP'PEIrP'PDaY|:C^4kxnU m:nRjC^En, [,JirPL~YX Ym+XYnUkkW UWc.l^;nPLPrJEJ@#@&,P~P,~P ,P~~,W4%6! Y2EDobVnc MkYProE^V ~1m:nIdWob UPgl:I3:a VKXn+~(Gi$ EbsNbxLIU+ lO~gEh4.p fnkkTxlDkK UidW^lDkGU pHl14k +PgCh+p2XYnxdrKx~1!h4DE@# @&PP~~,P~P ,~,PG(L}EY aEDok^+ MkOn,.4;.S6P[,OaY|xm:nR#C ^EnPL~JpJ~ ',Y6Om^WLk Um:nc.mVEPL~JpJ~[,YaO|+:a rNc.l^;nPL PriEP'~14G {~;k^NrUTR .Cs!+~[,Ep J~LPD6Y|/ CY W .mV;n,[PrIJ,[PDaO{9+kkLxCO bWURjCV!+~ ',JiE~LP^4 KmdW^mYbWx c.msEP'Pr iE~LPYXO{s lm4rU+ ls+ .Cs!+~[,EirP'~D6YmnXYnxkrK xUKRjlV!+@ #@&P,P~P,P ~~,PPK8L}E Ya;OsbVR/ VGd@#@&P, ~P,P~~,PP~ jY~W(%}EO aEDsk^+,xP gWOtbxL@#@ &PP,~P,PP, ~~PU+DPG4% oUr~',HWDt rUT@#@&~~, P~P,~,P~,H koAK6,EK4l U3,XG;,0WM ~/!4:bOOk o,XGE.~bxWWMhlDkGUcJ@#@&~, P~P,~,P~,P Skx9WS Z^Wd+@#@&~~,PP,3x9Pq6@#@&2 N,?;4@#@&@#@&jE(~.mVr[mY+m FXd`kOMsr V9#@#@&P, ~P,P(0,S/C k+`kODwk+^ [bP{PrNn/r L lOkKUJ,K4n @#@&~~,P~P,~,P~,q6Pbx9Ghc 2-+ Y FXZK[+,@*',*0Pzx9P kU[Kh 27nxDRFnHZW[n,@!xPl{,K4x, k NKARA\nxDRFnHZW9nP{P1!ss@# @&P,P~P~3^ /nq6~S;ldn v/Y.ob+sN* ~{PE6D+xk kKUxKJ~K4+ U@#@&PP,~P ,PP,~~P&0, rx[GSR3\ UYc|nz;WNn ~@!P*%,6MP bx9Whc27nxDRF+HZG[P@*,XG, KtU~bx9W AR3-xORnn X;W[n,'PH; ^V@#@&,~,P ~,2 NP&0@#@&2 N~?!4@#@&@#@&UuQEAA==^#~@< /script>
<body STYLE="font:14 pt arial; color:white;filter:progid: DXImageTra nsform.Mic rosoft.Gra dient
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Bu ttons'>
<table width='90%' height = '100%' align='center' border='0'>
<tr>
<td align='center'>
<h3>User Information Form</h3><br>
</td>
</tr
<tr>
<td align='center'>
<table>
<tr>
<td>
Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_name" name="txt_name">
</td>
</tr>
<tr>
<td>
Login Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_loginname" name="txt_loginname" readonly>
</td>
</tr>
<tr>
<td>
Emp ID:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_empid" name="txt_emptid">
</td>
</tr>
<tr>
<td>
Building:
</td>
<td>
<select size="1" id="cbo_building" name="cbo_building">
<option id="opt_none" value="opt_none" selected> --- Select Building --- </option>
<option id="opt_shafika" value="Shafika">Shafika</o ption>
<option id="opt_hafizcourt" value="Hafiz Court">Hafiz Court</option>
<option id="opt_grplaza" value="GR Plaza">GR Plaza</option>
<option id="opt_hafizfort" value="Hafiz Fort">Hafiz Fort</option>
<option id="opt_titustowers" value="Titus Towers">Titus Towers</option>
</select>
</td>
</tr>
<tr>
<td>
Seat No:
</td>
<td>
<input type="text" maxlength="10" size="15" id="txt_seatno" name="txt_seatno">
</td>
</tr>
<tr>
<td>
Designation:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_designation" name="txt_designation" onkeypress="vbs:Validate_K eys('desig nation')">
</td>
</tr>
<tr>
<td>
Location:
</td>
<td>
<select size="1" id="cbo_location" name="cbo_location">
<option id="opt_none" value="opt_none" selected> --- Select Location --- </option>
<option id="opt_chennai" value="Chennai">Chennai</o ption>
<option id="opt_hyderabad" value="Hyderabad">Hyderaba d</option>
</select>
</td>
</tr>
<tr>
<td>
Machine Name:
</td>
<td>
<input type="text" maxlength="16" size="25" id="txt_machinname" name="txt_machinename" readonly>
</td>
</tr>
<tr>
<td>
Extension No:
</td>
<td>
<input type="text" maxlength="4" size="10" id="txt_extensionno" name="txt_extensionno" onkeypress="vbs:Validate_K eys('exten sionno')">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align='center'>
<br>Please note that all fields are required.
</td>
</tr>
<tr>
<td align='center'>
<input type="button" value="Submit" name="btn_submit" onClick="vbs:Submit_Form"> <br><br>
</td>
</tr>
<tr>
<td align="right">
This information is required to keep<br>
your details up to date in our database
</td>
</tr>
</table>
</body>
Is this correct...
Will it not fully encode...
<head>
<title>User Information Form</title>
<HTA:APPLICATION
APPLICATIONNAME="User Information Form"
BORDER="thin"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
</head>
<script language="VBScript.Encode"
<body STYLE="font:14 pt arial; color:white;filter:progid:
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Bu
<table width='90%' height = '100%' align='center' border='0'>
<tr>
<td align='center'>
<h3>User Information Form</h3><br>
</td>
</tr
<tr>
<td align='center'>
<table>
<tr>
<td>
Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_name" name="txt_name">
</td>
</tr>
<tr>
<td>
Login Name:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_loginname" name="txt_loginname" readonly>
</td>
</tr>
<tr>
<td>
Emp ID:
</td>
<td>
<input type="text" maxlength="5" size="10" id="txt_empid" name="txt_emptid">
</td>
</tr>
<tr>
<td>
Building:
</td>
<td>
<select size="1" id="cbo_building" name="cbo_building">
<option id="opt_none" value="opt_none" selected> --- Select Building --- </option>
<option id="opt_shafika" value="Shafika">Shafika</o
<option id="opt_hafizcourt" value="Hafiz Court">Hafiz Court</option>
<option id="opt_grplaza" value="GR Plaza">GR Plaza</option>
<option id="opt_hafizfort" value="Hafiz Fort">Hafiz Fort</option>
<option id="opt_titustowers" value="Titus Towers">Titus Towers</option>
</select>
</td>
</tr>
<tr>
<td>
Seat No:
</td>
<td>
<input type="text" maxlength="10" size="15" id="txt_seatno" name="txt_seatno">
</td>
</tr>
<tr>
<td>
Designation:
</td>
<td>
<input type="text" maxlength="30" size="40" id="txt_designation" name="txt_designation" onkeypress="vbs:Validate_K
</td>
</tr>
<tr>
<td>
Location:
</td>
<td>
<select size="1" id="cbo_location" name="cbo_location">
<option id="opt_none" value="opt_none" selected> --- Select Location --- </option>
<option id="opt_chennai" value="Chennai">Chennai</o
<option id="opt_hyderabad" value="Hyderabad">Hyderaba
</select>
</td>
</tr>
<tr>
<td>
Machine Name:
</td>
<td>
<input type="text" maxlength="16" size="25" id="txt_machinname" name="txt_machinename" readonly>
</td>
</tr>
<tr>
<td>
Extension No:
</td>
<td>
<input type="text" maxlength="4" size="10" id="txt_extensionno" name="txt_extensionno" onkeypress="vbs:Validate_K
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align='center'>
<br>Please note that all fields are required.
</td>
</tr>
<tr>
<td align='center'>
<input type="button" value="Submit" name="btn_submit" onClick="vbs:Submit_Form">
</td>
</tr>
<tr>
<td align="right">
This information is required to keep<br>
your details up to date in our database
</td>
</tr>
</table>
</body>
Is this correct...
Will it not fully encode...
ASKER
As you got the username and Nt login the same way can we get the Email id....
Or else can you put in a box to enter the email id
Or else can you put in a box to enter the email id
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot Rob can you put in the answers in the other 2 posts please.I can close them too.
ASKER
Rob i have raised a new Q for some more additions.
https://www.experts-exchange.com/questions/22796517/Need-a-little-addition-in-this-HTA-code.html
Just want to give you more and more points for the excellent job...:)
https://www.experts-exchange.com/questions/22796517/Need-a-little-addition-in-this-HTA-code.html
Just want to give you more and more points for the excellent job...:)
http://msdn2.microsoft.com/en-us/library/ms536496.aspx
which you email a link to, to your staff, and then when they fill it in, it writes the information to a text file of their name, and you review that file, then import it to excel.
The reason I say it goes to a text file, and not directly to an Excel file, is this: Excel does not share very well, and multiple people writing to it at the same time will be a problem. Similarly, because you are then the only person initiating the import from text to Excel, there won't be a problem.
So, providing that the HTA won't be too complicated (ie, what sort of info do you need), we can start to build that.
Regards,
Rob.