MadBoy Posted January 26, 2006 Posted January 26, 2006 Is there a way to get Office / Windows key with autoit code from already installed software? I know there are quite few programs to use as standalone just i was wondering about autoit if it can be done. Tnx My little company: Evotec (PL version: Evotec)
herewasplato Posted January 26, 2006 Posted January 26, 2006 (edited) http://www.autoitscript.com/forum/index.ph...9537entry9537Edit:$Bin = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\10.0\Registration\{90280409-6000-11D3-8CFE-0050048383C9}","DigitalProductID") InputBox("Product Key", "Your OfficeXP product key is:", DecodeProductKey($bin), "", -1, 100, -1, -1)$Bin = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Registration\{90110409-6000-11D3-8CFE-0150048383C9}","DigitalProductID") InputBox("Product Key", "Your Office2003 product key is:", DecodeProductKey($bin), "", -1, 100, -1, -1)...you get the picture... Edited January 26, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
MadBoy Posted January 26, 2006 Author Posted January 26, 2006 (edited) Ye tnx muchos. I guess as soon as my time will let me my apps are gonna get a lot of new funcitonalities I'll share with it as soon as i am done, i doubt it will be soon but still maybe someone will have some use of it (except of course IT Department here at my company ;p) Edited January 26, 2006 by MadBoy My little company: Evotec (PL version: Evotec)
MadBoy Posted January 26, 2006 Author Posted January 26, 2006 (edited) hrms, seems like the codes from office give me errors.. well not errors just the key it displays is always BBBBB-BBBBBB..... I am sure the problem is in that {90280409-6000-11D3-8CFE-0050048383C9} value since it's diffrent on my computer.. is there a way to make it ignore the name of that key and just search for the line ? Edited January 26, 2006 by MadBoy My little company: Evotec (PL version: Evotec)
herewasplato Posted January 26, 2006 Posted January 26, 2006 ...is there a way to make it ignore the name of that key and just search for the line ?I would not know how.What office product do you have? [size="1"][font="Arial"].[u].[/u][/font][/size]
MadBoy Posted January 26, 2006 Author Posted January 26, 2006 Office 2003, on my system it's {90110415-6000-11D3-8CFE-0150048383C9}, i can install also Visio / Project and other microsoft stuff but i am sure that key varies from computer to computer. My little company: Evotec (PL version: Evotec)
herewasplato Posted January 26, 2006 Posted January 26, 2006 Office 2003, on my system it's {90110415-6000-11D3-8CFE-0150048383C9}, i can install also Visio / Project and other microsoft stuff but i am sure that key varies from computer to computer.A search at microsoft for 90110409-6000-11D3-8CFE-0150048383C9 gives several returns dealing with Office 2003. Including this link: http://support.microsoft.com/kb/885876 which states:For example, {90110409-6000-11D3-8CFE-0150048383C9} is the GUID for US English Microsoft Office 2003 Professional Enterprise Edition.So perhaps you have a different "edition".got to run... [size="1"][font="Arial"].[u].[/u][/font][/size]
MadBoy Posted January 26, 2006 Author Posted January 26, 2006 Well, yeah. I have Office 2003 Profesional but POLISH version. Would be nice thou for the code to work on any language version My little company: Evotec (PL version: Evotec)
Moderators big_daddy Posted January 26, 2006 Moderators Posted January 26, 2006 (edited) It's not the cleanest script, but it works. expandcollapse popup$ver = InputBox("Office Version", "What version of office do you have?" & @LF & @LF & "Office 2000 = 9.0" & @LF & "Office XP = 10.0" & @LF & "Office 2003 = 11.0") If $ver == "9.0" Then $product = "2000" If $ver == "10.0" Then $product = "XP" If $ver == "11.0" Then $product = "2003" Dim $Key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\" & $ver & "\Registration" Dim $List[1] Dim $i = 1 $var = RegEnumKey($Key, $i) $List[$i - 1] = RegRead($Key & "\" & $var, "DigitalProductID") If $List[$i - 1] = "" Then MsgBox(0, "Error", "Unable to find key") Else $bin = $List[$i - 1] InputBox("Product Key", "Your Office " & $product & " product key is: ", DecodeProductKey($bin), "", -1, 100, -1, -1) EndIf Func DecodeProductKey($BinaryDPID) Local $bKey[15] Local $sKey[29] Local $Digits[24] Local $Value = 0 Local $hi = 0 Local $n = 0 Local $i = 0 Local $dlen = 29 Local $slen = 15 Local $Result $Digits = StringSplit("BCDFGHJKMPQRTVWXY2346789", "") $BinaryDPID = StringMid($BinaryDPID, 105, 30) For $i = 1 To 29 Step 2 $bKey[Int($i / 2) ] = Dec(StringMid($BinaryDPID, $i, 2)) Next For $i = $dlen - 1 To 0 Step - 1 If Mod(($i + 1), 6) = 0 Then $sKey[$i] = "-" Else $hi = 0 For $n = $slen - 1 To 0 Step - 1 $Value = BitOR(BitShift($hi, -8), $bKey[$n]) $bKey[$n] = Int($Value / 24) $hi = Mod($Value, 24) Next $sKey[$i] = $Digits[$hi + 1] EndIf Next For $i = 0 To 28 $Result = $Result & $sKey[$i] Next Return $Result EndFunc;==>DecodeProductKey Edited January 27, 2006 by big_daddy
MadBoy Posted January 27, 2006 Author Posted January 27, 2006 (edited) ERROR: 'ExitLoop' not allowed outside loop. If @error <> 0 Then ExitLoop (line 10). WHen i change it to just Exit it works fine. I think for other purposes script could just check if Program Files\...\Office10 (etc) exists so there would be no end-user requirement to type it in Edited January 27, 2006 by MadBoy My little company: Evotec (PL version: Evotec)
MHz Posted January 27, 2006 Posted January 27, 2006 You may want to have a look at this. Will need AutoIt Beta for the Com used.
MadBoy Posted January 27, 2006 Author Posted January 27, 2006 You may want to have a look at this. Will need AutoIt Beta for the Com used.Sure, Windows code works but as before Office 2003 code doesn't. BigDaddys code on the other hand works without problems. My little company: Evotec (PL version: Evotec)
Moderators big_daddy Posted January 27, 2006 Moderators Posted January 27, 2006 ERROR: 'ExitLoop' not allowed outside loop.If @error <> 0 Then ExitLoop(line 10). WHen i change it to just Exit it works fine. I think for other purposes script could just check if Program Files\...\Office10 (etc) exists so there would be no end-user requirement to type it inYeah I'm not sure why that even got put in there? You can remove that whole line and it will function properly. As for checking the directories that would work unless someone installs office in a different location. It could be made a lot more user friendly, but I just threw it together with the time I had.
MadBoy Posted January 27, 2006 Author Posted January 27, 2006 (edited) Yeah I'm not sure why that even got put in there? You can remove that whole line and it will function properly. As for checking the directories that would work unless someone installs office in a different location. It could be made a lot more user friendly, but I just threw it together with the time I had.Yeah i will think about something. Just i am wondering now if Uninstalling for example Office XP and installing Office 2003 removes "Office10" directory (xp) and/or eventually registry key related to it. I am planning to make Microsoft Office Updater for Administrative instalation (Windows/office update doesn't work on such version, nor does WUS i think) of Microsoft Office. I've been asking around some time ago for an app, or way to force users to update their office XP or 2003 that has been installed from \\server (my company has couple of locations so there will be few servers) but had no luck (since i need the less administrative work from user). So i thought about making an app that will1. Check for local connection and ping all the servers. The one that will have response 1ms will be the one that is LAN (rest on WAN is like 5-8ms+). Choice is made here.2. Check if computer is in domain and user is logged in with domain account .. if yes continue3. Check for Office version (most users have Office XP but around 50+ has Office2003. (so that's why i need to know how to make sure what office version is on computer).4. Execution of msiexec with command like: (not yet tested if it updates correctly) msiexec \\server\Install\Microsoft_Office2003 PRO11.MSI /fo /qb! I'm sure some of administrators with 'similar' configuration could benefit that and i'll make sure to post it if/when i am done (have a lot of work thou at work and with uni so prolly will take some time especially that i have few more projects in AutoIT open ;p) Edited January 27, 2006 by MadBoy My little company: Evotec (PL version: Evotec)
Moderators big_daddy Posted January 27, 2006 Moderators Posted January 27, 2006 (edited) A few questions... 1) Do the servers at different locations have different ip schemes? Like for instance I work at a bank, each branch has a different ip scheme. Example: Location 1 = 10.1.1.1, Location 2 = 10.1.2.1, Location 3 = 10.1.3.1 and so on.2) If I understand you correctly you want to uninstall office xp and install office 2003?3) Did you know that you can create Administrative Installation Points? This allows you to create an automated install. From an office cd you run setup.exe /a this runs a setup wizard that configures all the settings for the automated installs. Check this page for more information. Edited January 27, 2006 by big_daddy
MadBoy Posted January 30, 2006 Author Posted January 30, 2006 A few questions... 1) Do the servers at different locations have different ip schemes? Like for instance I work at a bank, each branch has a different ip scheme. Example: Location 1 = 10.1.1.1, Location 2 = 10.1.2.1, Location 3 = 10.1.3.1 and so on. 2) If I understand you correctly you want to uninstall office xp and install office 2003? 3) Did you know that you can create Administrative Installation Points? This allows you to create an automated install. From an office cd you run setup.exe /a this runs a setup wizard that configures all the settings for the automated installs. Check this page for more information. 1) Servers are named like WAW1, KRA1, KAT1, LOD1. Only waw1 so far has Instalation point done by me. Rest will be done when i finish Office Updater (which i am posting at the end of msg). 2) Nopes. I have prepared Unattended Office XP and Office 2003 thru administrative instalation (with all patches and keys). What i want to achieve is that after once installed on some computer with My program (in autoit) the computer doesnt come back to us for longer time. So the user has the version of office updated to that date. Now i couldn't find a simple way to UPDATE Office products without need to going to user and 'clicking' setup.exe (and then if Administrative point had newer version i was asked If i want to update to newest version). But as you can imagine this isn't working good for company with 2000 ppl where half would probably fuckup something. As you probably know WWW - Office Update says to go f... yourself if you have administrative version installed so users trying to do that were sent back to home. Another problem was that some of ppl has Office XP, Some Office 2003 and some Project/Visio 2003. I also had hard time finding how to update the rls just from command line till today ;p So now i made an application that can be uploaded to computer with office (with link next to Microsoft word so the user will see it easly) and so he can start it himself if he wants to. I'm posting the code. It works so far.. i commented out the 'RunWait()' commands so it wouldn't start anything if you run it But it will give you idea how/what Of course this is 0.2 version so it only has simple checks which i need to 'change' but since i had to do it fast... here it goes. And since i often use this forum and i respect other ppl posting their code i don't feel problem with sharing what i made so far.. If it will reach version 1.0 maybe more ppl will want to use it expandcollapse popup; OfficeUpdater.au3 #include <GUIConstants.au3> #include <File.au3> #NoTrayIcon ; Variables Dim $autor = "MadBoy's / LameCompany I work for 2006" Dim $version = "0.2" Dim $settings = @ScriptDir & "\OfficeUpdater.ini" Dim $a, $b Dim $ping_error Dim $server_to_use, $logged_to_domain Dim $office_version, $project_version, $visio_version Dim $nr_of_servers = 4; Number of server Global $server_locations[$nr_of_servers]; Setting array for servers Global $ping_value[$nr_of_servers]; Setting arrar for ping_value $server_locations[0] = "WAW1" $server_locations[1] = "KRA1" $server_locations[2] = "WRO1" $server_locations[3] = "KAT1" ; Dim $position1 = 5, $position2 = 10; First "check" Dim $lenght1 = 300, $height1 = 15 Dim $lenght2 = 399, $height2 = 50 Dim $position3 = 310 Dim $position10 = 60, $position11 = 180; Autor's positioning Dim $position5 = 5 ;===================================================== ; CODE - SETTING UP GUI Opt("GUICoordMode", 1) GUICreate("MadBoy's Office Updater " & $version, 405,200) ; Setting UP $autor label $label50 = GUICtrlCreateLabel ("", $position10, $position11, 300, 15) GUICtrlSetData( $Label50, "Program made by: " & $autor,$GUI_SHOW ) GUICtrlSetState(-1,$GUI_DISABLE) ;===================== LABELS $label1 = GUICtrlCreateLabel ("", $position1, $position2, $lenght1, 15) $label2 = GUICtrlCreateLabel ("", $position1, $position2+15, $lenght1, 15) $label3 = GUICtrlCreateLabel ("", $position1, $position2+30, $lenght1, 15) $label4 = GUICtrlCreateLabel ("", $position1, $position2+45, $lenght1, 15) $label5 = GUICtrlCreateLabel ("", $position1, $position2+60, $lenght1, 15) GUICtrlSetData( $Label1, "Computer has Microsoft Office?" ,$GUI_SHOW ) GUICtrlSetData( $Label2, "Computer has Microsoft Project?", $GUI_SHOW ) GUICtrlSetData( $Label3, "Computer has Microsoft Visio?" ,$GUI_SHOW ) GUICtrlSetData( $Label4, "User is logged in to MyLittleDomain?" ,$GUI_SHOW ) GUICtrlSetData( $Label5, "Computer has contact with local server?" ,$GUI_SHOW ) ;===================== $label11 = GUICtrlCreateLabel ("", $position3, $position2, $lenght1, 15) $label12 = GUICtrlCreateLabel ("", $position3, $position2+15, $lenght1, 15) $label13 = GUICtrlCreateLabel ("", $position3, $position2+30, $lenght1, 15) $label14 = GUICtrlCreateLabel ("", $position3, $position2+45, $lenght1, 15) $label15 = GUICtrlCreateLabel ("", $position3, $position2+60, $lenght1, 15) ;===================== $label61 = GUICtrlCreateLabel ("", $position5, $position2+100, $lenght2, 15) $label62 = GUICtrlCreateLabel ("", $position5, $position2+115, $lenght2, 15) $label63 = GUICtrlCreateLabel ("", $position5, $position2+130, $lenght2, 15) $label64 = GUICtrlCreateLabel ("", $position5, $position2+145, $lenght2, 15) $label65 = GUICtrlCreateLabel ("", $position5, $position2+160, $lenght2, 15) $label66 = GUICtrlCreateLabel ("", $position5, $position2+175, $lenght2, 15) ;===================== GUISetState () While 1 office_check() If $office_version = "2003" Then GUICtrlSetData( $Label11, "Yes, " & $office_version ,$GUI_SHOW ) EndIf If $office_version = "XP" Then GUICtrlSetData( $Label11, "Yes, " & $office_version ,$GUI_SHOW ) EndIf If $office_version = "NOPE" Then GUICtrlSetData( $Label11, "Nope",$GUI_SHOW ) EndIf project_check() If $project_version = "2003" Then GUICtrlSetData( $Label12, "Yes, " & $project_version ,$GUI_SHOW ) EndIf If $project_version = "XP" Then GUICtrlSetData( $Label12, "Yes, " & $project_version ,$GUI_SHOW ) EndIf If $project_version = "NOPE" Then GUICtrlSetData( $Label12, "Nope",$GUI_SHOW ) EndIf visio_check() If $visio_version = "2003" Then GUICtrlSetData( $Label13, "Yes, " & $visio_version ,$GUI_SHOW ) EndIf If $visio_version = "XP" Then GUICtrlSetData( $Label13, "Yes, " & $visio_version ,$GUI_SHOW ) EndIf If $visio_version = "NOPE" Then GUICtrlSetData( $Label13, "Nope",$GUI_SHOW ) EndIf ; Checking for DOMAIN status domain_check() If $logged_to_domain = "Yes" Then GUICtrlSetData( $Label14, "Yes",$GUI_SHOW ) Else GUICtrlSetData( $Label14, "No",$GUI_SHOW ) EndIf ; Checking for Lan connection and best server - own function! server_check() If $ping_error = "No" Then GUICtrlSetData( $Label15, "Yes, " & $server_to_use,$GUI_SHOW ) ExitLoop Else GUICtrlSetData( $Label15, "No" ) ExitLoop EndIf $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd While 2 If $office_version = "2003" OR $office_version = "XP" OR $project_version = "2003" OR $visio_version = "2003" Then If $logged_to_domain = "Yes" Then If $ping_error = "Yes" Then ; BRAK KONTAKTU Z SERWEREM! GUICtrlSetData( $Label61, "No contact with server. Check your connection to following servers: " ,$GUI_SHOW ) GUICtrlSetData( $Label62, "WAW1, KRA1, KAT1 or WRO1.",$GUI_SHOW ) ExitLoop Else ; WSZYSTKO OKEJ --> CO ROBIC!!!! GUICtrlSetData( $Label61, "MadBoy's Office Updater is working. Please Wait...",$GUI_SHOW ) If $office_version = "2003" Then ;RunWait("msiexec.exe /i \\" & $server_to_use & "\Install\Advanced\Microsoft_Office2003\PRO11.MSI REINSTALL=ALL REINSTALLMODE=vomu /qb!") EndIf If $office_version = "XP" Then ;RunWait("msiexec.exe /i \\" & $server_to_use & "\Install\Main\Microsoft_OfficeXP\STD.MSI REINSTALL=ALL REINSTALLMODE=vomu /qb!") EndIf If $project_version = "2003" Then ;RunWait("msiexec.exe /i \\" & $server_to_use & "\Install\Advanced\Microsoft_Project2003\PRJPROE.MSI REINSTALL=ALL REINSTALLMODE=vomu /qb!") EndIf If $visio_version = "2003" Then ;RunWait("msiexec.exe /i \\" & $server_to_use & "\Install\Advanced\Microsoft_Visio2003\VISPRO.MSI REINSTALL=ALL REINSTALLMODE=vomu /qb!") EndIf GUICtrlSetData( $Label61, "Office products were updated to newest version! Enjoy",$GUI_SHOW ) ExitLoop EndIf Else ; User isn't logged to domain! GUICtrlSetData( $Label61, "Some of the tests needed for this app to work failed. Please check if you are",$GUI_SHOW ) GUICtrlSetData( $Label62, "logged to domain and you have contact with one of the servers",$GUI_SHOW ) GUICtrlSetData( $Label63, "Updates are available on one of servers; WAW1,KRA1,KAT1 or WRO1",$GUI_SHOW ) ExitLoop EndIf Else ; None of the products is installed! GUICtrlSetData( $Label61, "None of the Office products is installed. Why do you need Office Updater?!",$GUI_SHOW ) ExitLoop EndIf $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd While 3 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd ;=============FUNCTIONS========================================== Func domain_check(); Response: $logged_to_domain = Yes/No If @LogonDomain = "MyLittleDomain" Then $logged_to_domain = "Yes" Else $logged_to_domain = "No" EndIf EndFunc Func office_check(); Response: $office_version = XP/2003/2007/NOPE $office_version = "NOPE" If FileExists(@ProgramFilesDir & "\Microsoft Office\OFFICE12") Then $office_version = "2007" EndIf If FileExists(@ProgramFilesDir & "\Microsoft Office\OFFICE11\WINWORD.EXE") OR FileExists(@ProgramFilesDir & "\Microsoft Office\OFFICE11\EXCEL.EXE") Then $office_version = "2003" EndIf If FileExists(@ProgramFilesDir & "\Microsoft Office\OFFICE10") Then $office_version = "XP" EndIf EndFunc Func project_check(); Response: $project_version = XP/2003/2007/NOPE $project_version = "NOPE" If FileExists(@ProgramFilesDir & "\Microsoft Office\PROJECT12") Then $project_version = "2007" EndIf If FileExists(@ProgramFilesDir & "\Microsoft Office\OFFICE11\WINPROJ.EXE") Then $project_version = "2003" EndIf If FileExists(@ProgramFilesDir & "\Microsoft Office\PROJECT10") Then $project_version = "XP" EndIf EndFunc Func visio_check(); Response: $visio_version = XP/2003/2007/NOPE $visio_version = "NOPE" If FileExists(@ProgramFilesDir & "\Microsoft Office\VISIO12") Then $visio_version = "2007" EndIf If FileExists(@ProgramFilesDir & "\Microsoft Office\VISIO11\VISIO.EXE") Then $visio_version = "2003" EndIf If FileExists(@ProgramFilesDir & "\Microsoft Office\VISIO10") Then $visio_version = "XP" EndIf EndFunc Func server_check(); Response: $ping_error = Yes/No $server_to_use = name of server For $a = 0 To $nr_of_servers-1 Step +1 $ping_value[$a] = Ping($server_locations[$a],250) If $ping_value[$a] = 1 Then $server_to_use = $server_locations[$a] $ping_error = "No" ExitLoop Else $ping_error = "Yes" EndIf Next EndFunc Things to do: 1. Additional registry check (with product ID comparasion) so the app would only work on "COMPANY OFFICE". 2. Option to start program "OfficeUpdater.exe Install" which would search for 'office instalation' check in registry if it's right office and would add itself to 'start menu' so the user could use it (a lot of users have already Office version outdated so they must get the program somehow). Will be pushed by logon script or so. 3. Will come up wiht more ideas later on ;p My little company: Evotec (PL version: Evotec)
MadBoy Posted January 30, 2006 Author Posted January 30, 2006 I asked if uninstalation of OfficeXp or Office2003 removes product id key from registry and other keys there because the app will do checks in registry. I wouldn't like to have false positive answers that application is installed (based on key in registry) when actually it's long gone My little company: Evotec (PL version: Evotec)
MadBoy Posted January 30, 2006 Author Posted January 30, 2006 Forgot to add.. Disadvantage of that administrative point and forcing the updates is that the command acctually REINSTALL's whole apps so if you get 50 users to do it at once it might be a killer for a server My little company: Evotec (PL version: Evotec)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now