PDA

View Full Version : HTA Create Form (WXP-Pro)



Mosaic1
03-06-2003, 12:00 PM
I am trying to create an HTA which allows a person to change the menuext key in the registry. VBS cannot enumerate a registry key. I solved that. I now have a folder created by a set of scripts executed by the hta which contains a registry file for each subkey(I only had to go one layer deep) under menuext. Also, it seems when you have a registry file created using regedit /e in XP ,WSH cannot read it correctly. I was not able to use any string manipulation to get the subkey names from the original menuext key when exported in its entirety. I resolved that problem by putting a copy of the Win98SE regedit.exe in the same folder as the script. The file is exported in "Classic" format and I can then use String Manipulation on it. The point is to let the script get the files. I wish there were a switch available to export a reg file in XP using REGEDIT4.

My problem is I am very new to scripting and am not sure if this next part can be done.
I want to create a form. Possibly an array of Checkboxes? Each checkbox would represent one of the files in the folder.

Here's the code for an hta which enumerates each file name in the folder and returns a messagebox for each filename.

<script Language = "vbscript">
Dim fso, f, f1, fc, s ,X, Y,key, Z, B, Q
Set WshShell =CreateObject("Wscript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("Regfiles")
Set fc = f.Files
For Each f1 in fc
X = f1.name
MsgBox f1.name
Next
</script>


In the end, when the submit button is pressed, a file executes to remove the current menuext key and recreate it by importing the selected registry files.

Could someone point me to a tutorial please? Either JavaScript or VBS. I have been looking but so far have not found a way to create the form. I need to write a function to do it, but am stumped.
I am such a Newbie!


Thanks in Advance,

Mo

Mosaic1
03-06-2003, 06:17 PM
From what I am reading, I need to create a recordset from the information I want to enter into the form. I have an example of how to do this with a Pulldown for the WMI Classes, but am not sure how or if I can do it with a set of filenames in a folder. I have to learn how to create the recordset. And how to create something other than a Pulldown.

Mosaic1
03-06-2003, 06:58 PM
No Recordset was needed. I just had to write the strHtml correctly. I now have the pulldown populated with the names of the registry files in the folder.

Next step will be to write a function to retrieve the information and execute the files. Maybe tomorrow.

LOL

Mosaic1
03-08-2003, 10:41 AM
I am almost there. I have an array of checkboxes in place and a javascript function which returns the information regarding which are checked when you press the Create Menu Button.

The final step will be to change that function to write a batch which will first remove the key and then import the registry files to create the new key silently.

I could have the onclick of each check do that, and actually. if I were to write something like having it check the state of the checkbox and then either import the subkey file or remove it. But if there was a lot of mind changing, the poor registry might start to smoke!

I think I'll stay with this one, at least for now.

Mosaic1
03-08-2003, 02:11 PM
Even better. I created my own Sub in vbs and it will import each chosen file into the registry after first clearing the menuext key. It checks the checkbox array and finds the checked checkboxes. LOL That's a tongue twister.

I have to put a few finishing touches on this, but I think it is going to work. I wrote it for a particular person with a particular problem.

It's been an exercise in frustration. I can honestly say, I will never do this again!

Mosaic1
03-19-2003, 06:39 PM
I came back to add that it works. But more importantly, I have found out since that there is a switch XP users can use to export a registry file in Ansi Format.

regedit /e /a

will do it. I wish I had known about it before.