?
Solved

Display INFO Like "About" Format.

Posted on 2012-08-23
20
Medium Priority
?
512 Views
Last Modified: 2012-09-13
I am looking for a best way to create a info. Windows like "about", place a button on the desktop so once user click on it to
Get …
> product Name
>Product version
>Driver Version
>Firmware version
From registry. The registry entries are in: HKLM>Software>CPOL
OS is Windows 7

Any HOW to DO idea, appreciated.

Thanks
0
Comment
Question by:NetRock6
  • 10
  • 9
20 Comments
 
LVL 59

Expert Comment

by:Bill Prew
ID: 38326077
Can you export that section of the registry to a file and post it up here.  It won't be super pretty, but a vbscript could certainly display that basic information in a small dialog box after getting the values from the registry.  You don't have fancy formatting like color, font, etc control, but if it doesn't have to be fancy that could work.

But I would need to know the exact structure of that registry section to work up a sample script, and to test it here.

~bp
0
 

Author Comment

by:NetRock6
ID: 38326397
Hi,
I sort of trying to figure out below works fine:

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
 strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\LookImage"
strValueName = "User1Driver.dll"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
wscript.echo "Current Version Installed Image: " & strValue

Open in new window


But what I really need to do is to read a file Reginfo.txt that is :  

---------------------------------------------------------------------
Name:                                          Value		init		TOP
---------------------------------------------------------------------`
		
User1Driver.dll	                       6.0.0.3
LUser1Driver.dll		        1.0.1.5
304User1Driver.dll	        1.0.1.15
235User1Driver.dll	        1.1.0.13
User1Driver.dll		        3.02.07
FUser1Driver.dll		       2.0.0.2
aUser1Driver.dll		     1.0.0.10
a20User1Driver.dll	    1.0.0.0
aopUser1Driver.dll	   1.0.1.3
a69cpUser1Driver.dll	  1.0.0.1
d3pUser1Driver.dll	    x.x.x.x		
d45sUser1Driver.dll	1.0.0.9
UUser1Driver.dll		1.85

Open in new window


After create string value in registry under Lookimage with Values in "Value"column in the registry.  And then displaying these values .
So the user get a windows popup with the contains in the registry.
I can not use only the file because it might be deleted. So registry is the safer place.

Thanks.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 38327540
Hi there, try this script.

Regards,

Rob.

Const HKEY_LOCAL_MACHINE = &H80000002
Const REG_SZ = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY = 3
Const REG_DWORD = 4
Const REG_MULTI_SZ = 7
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\LookImage"
oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames, arrValueTypes
strMessage = String(80, "-") & vbCrLf & Left("Name:" & String(30, " "), 30) & Left("Value:" & String(50, " "), 50) & vbCrLf & String(80, "-") & vbCrLf
For i=0 To UBound(arrValueNames)
    Select Case arrValueTypes(i)
        Case REG_SZ
            intReturn = oReg.GetStringValue(HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames(i), strValue)
        Case REG_EXPAND_SZ
            intReturn = oReg.GetExpandedStringValue(HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames(i), strValue)
        Case REG_BINARY
            intReturn = oReg.GetBinaryValue(HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames(i), strValue)
            strValue = Join(strValue, ",")
        Case REG_DWORD
            intReturn = oReg.GetDWORDValue(HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames(i), strValue)
        Case REG_MULTI_SZ
            intReturn = oReg.GetMultiStringValue(HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames(i), strValue)
            strValue = Join(strValue)
    End Select
    strMessage = strMessage & vbCrLf & Left(arrValueNames(i) & String(30, " "), 30) & Left(strValue & String(50, " "), 50)
Next
WScript.Echo strMessage

Open in new window

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:NetRock6
ID: 38330392
Thanks for your help. I think using vbscript is complicated. So I could do the first part in batch file and to popup msg use VBScript. I have done the two parts and I am able to create the registry keys reading from file Reginfo.txt  and popup to the users.  The real issue I have right now is to create Reginfo.txt  file.
Because I need to combine three text files (see below). I need to grab version numbers ( format x.x.x.x)in these files is there a way to get Numbers from every line in the 3 text files and output to a single file to create "Reginfo.txt. I am trying with findstr [0-9].[0-9].[0-9].[0-9] but not getting the right result.
So, basically what I am looking for is this:

[b]TextFile1:[/b]
This is the only version blah….blah…
This is the only version blah….blah…

Modem LinkS version   2.36.5.6
Modem firmware link      3.6.9.7
This is the only version blah….blah…
This is the only version blah….blah…
This is the only version blah….blah…

Open in new window


[b]TextFile2:[/b]
This is the only version blah….blah…
CPU Firmware      33.69.25.14
CPU Clock    20.5.5.9
This is the only version blah….blah…
This is the only version blah….blah…
This is the only version blah….blah…
This is the only version blah….blah…

Open in new window


[b]TextFile3:[/b]
This is the only version blah….blah…
This is the only version blah….blah…

Sound ink  1.6.5.6
Sound output to com port  2.3.5.6
Sound.sys                     2.36.9.8
Sound.cab                 2.3.6.9
This is the only version blah….blah…
This is the only version blah….blah…

Open in new window


[b][i]Combine 3 text files[/i] Into Reginfo.txt as follows[/b]:
Modem LinkS version,2.36.5.6
Modem firmware link ,3.6.9.7
CPU Firmware,33.69.25.14
CPU Clock, 20.5.5.9
Sound ink ,1.6.5.6
Sound output to com port,2.3.5.6
Sound.sys,2.36.9.8
Sound.cab,2.3.6.9

Open in new window


Thanks for your HELP!
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 38332335
I'm a bit confused....as far I can understand, you just want to read keys from the registry and display their values.  Have you tried the script I posted?  It will show the values from the key that you define in strKeyPath.  We can easily add an array to output values from multiple key paths, if that's what you want?

Otherwise, where do the three text files get generated from?

Rob.
0
 

Author Comment

by:NetRock6
ID: 38332461
Hi,
these files are coming from different users that i need to combine them into one file "Reginfo.txt". with format [KeyName],[Value]. as long as i can get the 3 files into this format i will be ok. I did not try the script you posted yet, because i was focusing on the new changes( combining 3 files into one). Once, i have the base file "Reginfo.txt" ready, then i could do the rest hopefully.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 38333948
OK, so of the three text files you have, what are the
"This is the only version blah….blah…"

lines?  Are they similar to the name and version lines, and do you want those lines included in the final output?

Also, are the name and version values tab delimited in the files?

Rob.
0
 

Author Comment

by:NetRock6
ID: 38335238
Thanks for the reply Rob,
I do not need those lines " This is .......blah..."

Please refer to my previous post i have explain clearly. All i need name and version and "," in between them. And there is space & tab delimited in the files. No just [TAB] only. it could be [space] or [TAB].

Thanks
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 38335372
OK, so with your three files in a folder, specify that folder with strFolder, then specify an output file with strOutputFile, and see how this code goes for you.

Regards,

Rob.

strFolder = "C:\Temp\Files"
strOutputFile = "C:\Temp\Files\Results.log"
strExceptionLine = "This is"

Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objOutput = objFSO.CreateTextFile(strOutputFile, True)
For Each objFile In objFSO.GetFolder(strFolder).Files
	If Right(LCase(objFile.Name), 4) = ".txt" Then
		Set objInput = objFSO.OpenTextFile(objFile.Path, ForReading, False)
		While Not objInput.AtEndOfStream
			strLine = Trim(objInput.ReadLine)
			If strLine <> "" Then
				If Left(strLine, Len(strExceptionLine)) <> strExceptionLine Then
					intPos = InStrRev(strLine, " ")
					If intPos > 0 Then
						strName = Trim(Left(strLine, intPos))
						strVersion = Trim(Mid(strLine, intPos + 1))
						If Left(strVersion, 1) = "," Then strVersion = Mid(strVersion, 2)
						WScript.Echo Left(strName & String(30, " "), 30) & Left(strVersion & String(50, " "), 50)
						objOutput.WriteLine Left(strName & String(30, " "), 30) & Left(strVersion & String(50, " "), 50)
					End If
				End If
			End If
		Wend
		objInput.Close
	End If
Next
objOutput.Close

Open in new window

0
 

Author Comment

by:NetRock6
ID: 38342714
Thank  you Rob for your assistance and patience.
Your last post, Certainly does not combine two txt files to one and it outputs the text file.  I managed this part. That's ok!
Since I need to make something presentable I thought of using hta. So I do not know how to output the ObjShell.popup strMessage from vbscript to hta, using your post dated:   Posted on 2012-08-23 at 19:47:13ID: 38327540
So, what I am trying to do is display WScript.Echo strMessage from VBScript in hta.
I started the following;

<head>
<title>About</title>
<HTA:APPLICATION 
     APPLICATIONNAME="About"
     BORDER="thin"
     SCROLL="no"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="normal"
>
</head>

<script language="VBScript">

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
 strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\LookImage"
.........
......

 

Open in new window


just need to display:

ObjShell.popup strMessage,vbOKOnly + vbInformation + vbApplicationModal + vbDefaultButton1,"About"

in hta instead of in VbScript.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 38343799
You can't use the shell object.  You can only use
MsgBox strMessage,vbOKOnly + vbInformation + vbApplicationModal + vbDefaultButton1,"About"

Or, you could add a <SPAN id=spanMessage> element to your page, and then use
spanMessage.InnerHTML = strMessage

Regards,

Rob.
0
 

Author Comment

by:NetRock6
ID: 38345215
Hi Rob,

I am not able to figure it out, since that's my first time doing this. Sorry for the trouble.
I was wondering if you can help me to output the text (msgbox) in hta instead of vbscript.
Thanks.
BTW, I have to use shell object, because MsgBox dose not display all the entries in registry.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 38348365
Hi, well here's a very simple HTA that will read the contents of a file and display it in a text area.  You should be able to adapt that to read in your required text file.

Regards,

Rob.

<html>
<head>
<title>Read Text File</title>
<HTA:APPLICATION 
     APPLICATIONNAME="Read_Text_File"
     BORDER="thick"
     SCROLL="yes"
     SINGLEINSTANCE="yes"
     ID="oHTA"
>
<APPLICATION:HTA>
</head>
<script language="VBScript">

Sub Window_OnLoad
End Sub

Sub ReadFile
		Set objFSO = CreateObject("scripting.filesystemobject")
		Set objReadFile = objFSO.OpenTextFile(txt_openfile.Value, 1, False)
		strContents = objReadFile.ReadAll
		objReadFile.Close
		txt_contents.value = strContents
End Sub

</script>
<body>
<p>Enter location of a file:</p>
<input type="file" value="Open File" id="txt_openfile">
<input type="button" id="btn_readfile" name="btn_readfile" value="Read File" onclick="ReadFile">
<p>The contents of the file is below:</p>
<textarea id="txt_contents" rows="10" cols="70"></textarea>
</body>
</html>

Open in new window

0
 

Author Comment

by:NetRock6
ID: 38351890
Hi Rob,
What I meant is how can I display the info. from registry  using  your first post (Posted on 2012-08-23 at 19:47:13ID: 38327540) in hta page, instead of VBScript, to have a small window with information from registry (17 lines of data),  with blue background and the version numbers under value column in bold. ( Is it Possible??)

Thanks.
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 2000 total points
ID: 38352575
OK, very simply, this would do it, after you change the registry paths in
arrKeyPaths = Array("Software\7-Zip","Software\Citrix")

to point to the registry keys you want to enumerate.

Regards,

Rob.

<html>
<head>
<title>Read Registry Values</title>
<HTA:APPLICATION 
     APPLICATIONNAME="Read_Registry_Values"
     BORDER="thick"
     SCROLL="yes"
     SINGLEINSTANCE="yes"
     ID="oHTA"
>
<APPLICATION:HTA>
</head>
<script language="VBScript">

Sub Window_OnLoad
	ReadFile
End Sub

Sub ReadFile
Const HKEY_LOCAL_MACHINE = &H80000002
Const REG_SZ = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY = 3
Const REG_DWORD = 4
Const REG_MULTI_SZ = 7

strComputer = "."
arrKeyPaths = Array("Software\7-Zip","Software\AVS4YOU")

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strMessage = "<table border=1><tr><th width='50%'>Name</th><th>Value</th></tr>"
For Each strKeyPath In arrKeyPaths
	oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames, arrValueTypes
	For i=0 To UBound(arrValueNames)
	    Select Case arrValueTypes(i)
	        Case REG_SZ
	            intReturn = oReg.GetStringValue(HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames(i), strValue)
	        Case REG_EXPAND_SZ
	            intReturn = oReg.GetExpandedStringValue(HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames(i), strValue)
	        Case REG_BINARY
	            intReturn = oReg.GetBinaryValue(HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames(i), strValue)
	            strValue = Join(strValue, ",")
	        Case REG_DWORD
	            intReturn = oReg.GetDWORDValue(HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames(i), strValue)
	        Case REG_MULTI_SZ
	            intReturn = oReg.GetMultiStringValue(HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames(i), strValue)
	            strValue = Join(strValue)
	    End Select
	    If strValue = "" Then strValue = "&nbsp;"
	    strMessage = strMessage & "<tr><td>" & arrValueNames(i) & "</td><td><b>" & strValue & "</b></td></tr>"
	Next
Next
strMessage = strMessage & "</table>"
txt_contents.innerHTML = strMessage
End Sub

</script>
<body bgcolor="#96B0FF">
<p>The contents of the registry is below:</p>
<span id="txt_contents"></span>
</body>
</html>

Open in new window

0
 

Author Comment

by:NetRock6
ID: 38353851
Thank you so much. It works Lovely!!
0
 

Author Closing Comment

by:NetRock6
ID: 38353862
Amazing Rob...!!
Thank you for your Passion....Keep up the Good Job!
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 38356509
Good to hear.  Thanks for the grade.

Regards,

Rob.
0
 

Author Comment

by:NetRock6
ID: 38394986
Good day Rob,
I have added more functions to the original code. One of them will search the whole PC for the current installed dll vesrions, and then update the registry with latest version numbers, it takes approximately 2.5-3.0 min. , I need to popup a message "please wait while retrieving information" so that users do not think it is frozen, or not working…etc. till the So i need to popup the message before:
<p>The contents of the registry is below:</p>
How I can do it….
Thanks.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 38397163
Before you begin the processing, add
txt_contents.InnerHTML = "<b>Please wait...</b>"

and that should be enough, because the text area would show Please wait..., then the processing would happen, and then when it's finished, this line will show the results:

txt_contents.innerHTML = strMessage

Regards,

Rob.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question