Mike88 Posted April 1, 2014 Share Posted April 1, 2014 (edited) HI,I found a VBScript that can change the Windows registration owner and organisation but i want to tweak this script so that it would be possible to enter this two entries in one window instead of 2 popups, like:Change Registrated Owner:<user_input>Change Registrated Organisation:<user_input>Option ExplicitSet ws = WScript.CreateObject("WScript.Shell")Dim ws, t, p1, p2, n, g, cn, cgDim itemtypep1 = "HKLM\Software\Microsoft\Windows NT\CurrentVersion\"n = ws.RegRead(p1 & "RegisteredOwner")g = ws.RegRead(p1 & "RegisteredOrganization")t = "Change Owner and Organization Utility"cn = InputBox("Type new Owner and click OK", t, n)If cn <> "" Then ws.RegWrite p1 & "RegisteredOwner", cnEnd Ifcg = InputBox("Type new Organization and click OK.", t, g)If cg <> "" Then ws.RegWrite p1 & "RegisteredOrganization", cgEnd IfWScript.Quit Edited April 1, 2014 by Mike88 Link to comment Share on other sites More sharing options...
gunsmokingman Posted April 2, 2014 Share Posted April 2, 2014 The only way you can do what you want is to use a HTA like this<!-- Hta And Script By Gunsmokingman AKA Jake1Eye This HTA And Or Any Code Is The Property Of Gunsmokingman Or Jake1Eye, Except Where Acknowledgement Comments Exists for Code Written By Other Coders. If Any Part Of This Code Is Used In Other Coding Project, There Must Be An Acknowledgement Comments To The Original Coder Must Be Included In Any Other Coding Project. --><TITLE>Registration Changer</TITLE> <HTA:APPLICATION ID="Registration Changer" APPLICATIONNAME="RegChngr" SCROLL="No" SCROLLFLAT ="No" SingleInstance="Yes" ShowInTaskbar="Yes" SysMenu="Yes" MaximizeButton="No" MinimizeButton="No" Border="Thin" BORDERSTYLE ="complex" INNERBORDER ="Yes" Caption="Yes" WindowState="Normal" Icon="%SystemRoot%\explorer.exe"><STYLE Type='text/css'> Body{ Text-Align:Center;Vertical-Align:Top; Font-Size:9.25pt;Font-Weight:Bold;Color:Black; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; BackGround-Color:#EFE9E3; Margin-Top:21;Margin-Bottom:1; Margin-Left:4;Margin-Right:4; Padding-Top:1;Padding-Bottom:1; Padding-Left:4;Padding-Right:4; Border-Top:0px Transparent;Border-Bottom:0px Transparent; Border-Left:0px Transparent;Border-Right:0px Transparent; } TD{ Text-Align:Left; Font-Size:8.25pt;Font-Weight:Bold;Color:Black; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; Padding-Top:1;Padding-Bottom:1; Padding-Left:3;Padding-Right:3; } Button{ Cursor:Hand; Height:17pt;Width:49pt; Text-Align:Center;Vertical-Align:Middle; Font-Size:8.75pt;Font-Weight:Bold;Color:DarkSlateGray; Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS; BackGround-Color:#DED8D2; filter:progid:DXImageTransform.Microsoft.Gradient (StartColorStr='#E5E5E5',EndColorStr='#7D7D7D'); Margin-Top:-1;Margin-Bottom:1; Margin-Left:-1;Margin-Right:1; }</STYLE><SCRIPT LANGUAGE='JScript'>//-> Resize And Place In Approx center var W = 355, H = 221; window.resizeTo(W,H) window.moveTo(screen.availWidth/2-(W/2),screen.availHeight/2-(H/2))</SCRIPT><SCRIPT Language="VBScript"> Dim Act :Set Act = Createobject("Wscript.Shell") Dim Reg :Reg ="HKLM\Software\Microsoft\Windows NT\CurrentVersion\" Function Window_onLoad() Dim V1, V2, V3 :V3= "No Information Found" V1 = Act.RegRead(Reg & "RegisteredOwner") V2 = Act.RegRead(Reg & "RegisteredOrganization") If V1 = "" Then V1 = V3 If V2 = "" Then V2 = V3 Owner.innerHTML= v1 Organ.innerHTML= V2 End Function Function TheSubmit() Dim V1 :V1="Please make sure both fields are filled in" If NewOwner.value <> "" And NewOrgan.value <> "" Then Act.RegWrite Reg & "RegisteredOwner", NewOwner.value Act.RegWrite Reg & "RegisteredOrganization", NewOrgan.value ElseIf NewOwner.value <> "" And NewOrgan.value = "" Then alert(V1) ElseIf NewOwner.value = "" And NewOrgan.value <> "" Then alert(V1) ElseIf NewOwner.value = "" And NewOrgan.value = "" Then alert(V1) End If End Function</SCRIPT><BODY><TABLE> <TD Style='Width:83;'>Owner</TD><TD Style='Width:179;'><DIV ID='Owner'> </DIV></TD></TABLE><TABLE> <TD Style='Width:83;'>Organization</TD><TD Style='Width:179;'><DIV ID='Organ'> </DIV></TD></TABLE> <TABLE Style='Margin-Top:5pt;'> <TABLE> <TD Style='Width:83;'>Owner</TD> <TD><Input Type='Text' ID='NewOwner' Size='26'></TD></TABLE> <TABLE> <TD Style='Width:83;'>Organization</TD> <TD><Input Type='Text' ID='NewOrgan' Size='26'></TD></TABLE> </TABLE><TABLE Style='Margin-Top:5pt;'> <BUTTON ID='Bn1' OnClick='TheSubmit()'>Submit</BUTTON> <BUTTON ID='Bn2' OnClick='window.close()'>Close</BUTTON></TABLE></BODY> Link to comment Share on other sites More sharing options...
Mike88 Posted April 2, 2014 Author Share Posted April 2, 2014 (edited) Oh i didn't know this wouldn't be possible with VBS. You HTA Script works nicely i only found a little typo "RegisteredOrganizatio" = "RegisteredOrganization" ('n' was missing) Thanks for this Scripty. Edited April 2, 2014 by Mike88 Link to comment Share on other sites More sharing options...
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