Advertisement

08.28.2008 at 09:06AM PDT, ID: 23686078
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

Help needed to add to a VB Script

Asked by TenaCoe in VB Script, Programming Languages, Visual Basic Programming

Tags: ,

I have a script that checks to see if the registry key for Office 2003 (11.0) exists and if so, it converts the DigitalProductId into they key you would type to install Office 2003.

I also have a similar script that does the same thing for Office 2000, Office 2007, SQL, Windows XP, etc.  They are all separate scripts.  I would like them to somehow be in one script that popped up a box that says something like:

Your XP key is: xxxx-xxxx-xxxx-xxxx
Your Office 2007 key is:  xxxx-xxxx-xxxx-xxxx
Office 2000 is not installed
Your SQL 2005 key is:  xxxx-xxxx-xxxx-xxxx

As I said, I have all of the scripts in a single function form, but I'd rather run one script and it pop up a nice box with all of the information.  I'm a VB n00b and only a vague idea of what I'm doing.

Attached is my script that gathers the Office 2003 key.  To make it work for Office 2000, I would change "11.0" in the registry key to "9.0", otherwise they are the same script.
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_CURRENT_USER = &H80000001
 
 
If keyExists("11.0","SOFTWARE\Microsoft\Office\", HKEY_CURRENT_USER) Then
    
Set WshShell = WScript.CreateObject("WScript.Shell")
HexBuf = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Office\11.0\Registration\{90110409-6000-11D3-8CFE-0150048383C9}\DigitalProductId")
For l = lBound(HexBuf) to uBound(HexBuf)
tmp=tmp & " "& Hex (HexBuf(l))
next
 
StartOffset = 52
EndOffset =67
Dim Digits (24)
 
Digits (0) = "B" : Digits (1) = "C": Digits (2) = "D": Digits (3) = "F":
Digits (4) = "G": Digits (5) = "H": Digits (6) = "J": Digits (7) = "K":
Digits (8) = "M": Digits (9) = "P": Digits (10) = "Q": Digits (11) = "R":
Digits (12) = "T": Digits (13) = "V": Digits (14) = "W": Digits (15) = "X":
Digits (16) = "Y": Digits (17) = "2": Digits (18) = "3": Digits (19) = "4":
Digits (20) = "6" : Digits (21) = "7" : Digits (22) = "8": Digits (23) = "9"
 
dLen = 29
sLen = 15
Dim HexDigitalPID (15)
Dim Des (30)
For i = StartOffset to EndOffset
HexDigitalPID (i-StartOffset) = HexBuf(i)
tmp2=tmp2 & " "& Hex (HexDigitalPID(i-StartOffset))
next
 
KEYSTRING =""
for i=dLen-1 to 0 step -1
if ((i + 1) mod 6) = 0 then
Des (i) = "-"
KEYSTRING =KEYSTRING & "-"
else
HN = 0
    For N = (sLen -1) to 0 step -1
      Value = ( (HN *2^8 ) Or HexDigitalPID (N))
       HexDigitalPID (N) = Value \ 24
       HN    = (Value mod 24)
 
    next
 
Des(i) = Digits(HN)
KEYSTRING =KEYSTRING & Digits(HN)
end if
next
KEYSTRING2 = StrReverse (KEYSTRING)
WScript.Echo "Your Office 2003 Product Key is:" & _
"" & _
" " & KEYSTRING2
 
Else
      MsgBox("Office 2003 is not installed")
End If
 
Function keyExists(strKeyName, strKeyPath, regCategory)
     retVal = false
     strComputer = "."
     Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
     strComputer & "\root\default:StdRegProv")
   
     oReg.EnumKey regCategory, strKeyPath, arrSubKeys
     
     For Each subkey In arrSubKeys
          If strKeyName = subkey Then
               retVal = true
               Exit For
          End If
     Next
     keyExists = retVal
End Function
[+][-]08.28.2008 at 11:27AM PDT, ID: 22338115

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.28.2008 at 11:32AM PDT, ID: 22338174

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: VB Script, Programming Languages, Visual Basic Programming
Tags: Microsoft, Visual Basic
Sign Up Now!
Solution Provided By: 512Thz
Participating Experts: 3
Solution Grade: A
 
 
[+][-]08.28.2008 at 11:38AM PDT, ID: 22338258

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08.28.2008 at 11:45AM PDT, ID: 22338321

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08.28.2008 at 12:16PM PDT, ID: 22338686

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.28.2008 at 12:55PM PDT, ID: 22339115

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628