tuvi123 Posted April 8, 2010 Posted April 8, 2010 I want to make a script that automatically change my office key. here is my script but it does not work:#RequireAdminIf @OSArch = "X64" Or "IA64" Then $key = "HKLM64"Else $key = "HKLM"EndIf$var = RegRead($key & "SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot", "Path")runWait('cscript.exe '$var & "ospp.vbs /inpkey:VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB"'', '', @SW_HIDE)Exitit does not work..if I open CMD and run cscript "%PROGRAMFILES%\Microsoft Office\Office14\ospp.vbs" //b /inpkey:VYBBJ-TRJPB-QFQRF-QFT4D-H3GVBit works.the "Path" value in the registry is "C:\Program Files\Microsoft Office\Office14\"(mods the KEY is microsoft betatrial key, so it's legit so don't remove this thread)I have also tried this:runWait(@COMSPEC & " /c " & ""$var"\ospp.vbs /inpkey:VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB", @SW_HIDE)runWait(@comSpec & ' /c cscript.exe '$var & "ospp.vbs /inpkey:VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB"'', '', @SW_HIDE)runWait('cscript.exe "'$var'\ospp.vbs" /inpkey:VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB', @SW_HIDE)ShellExecute($var & "ospp.vbs", "/inpkey:VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB", "", "", @SW_HIDE)but it does not work.I get "Error:Error in expression Line" in that line.please help me.
KaFu Posted April 8, 2010 Posted April 8, 2010 (edited) Maybe this works? #RequireAdmin $key = "HKLM" If StringInStr(@OSArch,"64") then $key = "HKLM64" $var = RegRead($key & "\SOFTWARE\Microsoft\Office\14.0\Common\InstallRoot", "Path") runWait("cscript.exe """ & $var & "\ospp.vbs"" //b /inpkey:KEY",$var, @SW_HIDE) Exit Edited April 8, 2010 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
MHz Posted April 8, 2010 Posted April 8, 2010 I get "Error:Error in expression Line" in that line.It is a (by your code) concatenate error i.e missing the char "&" which joins the parts of strings, variables etc. together.
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