|
|
|||||||
Hi. Env: Win 2000 SP4 Kixart 4.22 KixForms 2.3 Trying to adapt Inquisitor for my use, found some problems which I need some guide ness: $pc = $Windows.Items.Add("Apps") $pc.SubItems(1).text = WMIQuery("","Win32_Product",$TextBox4.Text)[0] $WindowsPBar.value = $WindowsPBar.value + 1 Want to use WMI Win32_Product to publish a list of installed softwares, Name, Version, identifynignumber and installed date, in a TabControl form. And also the Printer part is not working: $printers = WMIQuery("DriverName","Win32_Printer",$TextBox4.Text,"SystemName",$TextBox4.Text) For Each $p In $printer $pc = $Hardware.Items.Add("Printer") $pc.SubItems(1).text = $p Next My last wonder is if its possible to edit a readed value listed in a TabControl form: $pc = $IntExp.Items.Add("ProxyServer") $pc.SubItems(1).text = ReadValue('\\'+$TextBox4.Text+'\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings','ProxyServer') $IntExpPBar.Value = $IntExpPBar.Value + 1 Now when the "Proxy Server" value is readed from target registry and listded i Tab Control form, I want to change the "Proxy Server" value to something esle and make it write the new value on target registry. Is it possible to put this functionality into the TabControl? Grateful for any feedback! Not a scripter |
||||||||
|
|
|||||||
About the printer part, i'm not sure if it was just a typo when you posted, but shouldn't it be Code:
|
||||||||
|
|
|||||||
yeap ... it should be "printers" with "s". hummm, to much script lines and im getting dizzy... But what about other parts? any ideas? can u help? Still |
||||||||
|
|
|||||||
Can you restate what it is your trying to do. I get the impression you want to list some things in a ListView (embedded in a TabControl), and that once listed, you want to be able to let the "user" change a value, then have that value written back to the registry ? -Shawn |
||||||||
|
|
|||||||
Looking at the part for "Win32_Product". I think your WMI_Query call is not correct. You have a null first parameter. I think you should have something there. Also I think you need to process all products found, not just the first as signified by the [0] Code:
|
||||||||
|
|
|||||||
Yes, Shawn that is correct. Sorry my english (is like the scripting) at beginners' level! I tired to discribe 3 diffrent problems I have with above codes. - First (List of installed apps on target machine) I dont get any value listed in the TabControl listview when I run the WMI query state. WMIQuery("","Win32_Product",$TextBox4.Text)[0] - Second (List of installed Printers on target machine) The same, the list is empty. - Third (Edit a published value in the TabContol listview) Is it possible to edit a readed value in the TabControl listview and then push it out to overwrite the target registry value, while operating in same Tabcontrol listview. Normaly I dont have time (or opportunity for that matter!) to dig me deep in scripting issues,(but would like to do much more, if I had the brain and time). C is a simple helprunner! Thanks in advance |
||||||||
|
|
|||||||
Howard, yes that will work. if I use "?" But how do I list each pruduct line after line in the Form's TabControl listview? For each readed product, it has to create a line with the Name, version, installed date and identifynignumber. I think it must use the "Items.Add" for each pruduct, or? |
||||||||
|
|
|||||||
This is the code to get the data you want. I sadly have never written a Kixforms script so I can help you load the Tab control. I have provided you the KiXtart variables that you can feed into the Kixform control. You may know how to do that or someone else may be able to assist you. Code: $objWMI = GetObject("winmgmts:{impersonationlevel=impersonate}!//" + @WKSTA) |
||||||||
|
|
|||||||
ja, give me a few minutes to whip-up an example, be right back. |
||||||||
|
|
|||||||
Ok, using Howard's code as a base, here it is "wrapped-up" in a ListView, inside a TabControl, in a Form ... in the FILE menu, select "Load Products" to load the products into the ListView ... we can talk about updating the listview later, after you study this code ... Code:
|
||||||||
|
|
|||||||
Wow, thanks a lot guys, I will check it and get back to u. /C |
||||||||
|
|
|||||||
Oh yea I merged it to my script, some adaptation and it works! Thanx a lot. One thing: the "IndentifyingNumber" list is empty. Seems not to publish anything. Strange.... Now my last question: -Edit a published value in the TabContol listview Target is readed and listed: ReadValue('@WKST+'\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings','ProxyServer') Now I want to changed the "Proxy Server" value to something else, by clicking on readed value in the listview window, delete and enter new key value and then make it write the new value back to registry. Is it possible? /C |
||||||||
|
|
|||||||
IndentifyingNumber should be IdentifyingNumber ... just a typo. Here's a changed version of the above script if you want to change a value in the listview. If you need to actually remove and re-insert a record, thats a different story. Code:
|
||||||||
|
|
|||||||
Yes, see WRITEVALUE and monitor the text e.g. via OnLostfocus for changes ot the original value. You can then write the new value back to the registry. |
||||||||
|
|
|||||||
I'll tried to use your code and adapt it to mine, but no success :-( . I need to restate what im trying to do: I have a TabControl with 4 TabPage. "Hardware", "Software", "OS Details" and "Software" In the "OS Details" when the "OS Details Update" button is clicked it will read several registry key values and publish the 2 columns "Object" and "Value" in the ListView for "OS Details" . e.g. Object -------------------- Value ProxyServer -------------- www.proxy-server.com SystemPath --------------- %SystemRoot%\system32;%SystemRoot%;C:\Program Files\ATI Technologies\ATI Control Panel; and so on..... So far so good. Now I want to make some changes to readed values in the 2nd column "Value": e.g double click on "Value" column for "SystemPath", remove the part "C:\Program Files\ATI Technologies\ATI Control Panel;". Then Changes the "www.proxy-server.com" to "www.pserver.com". And when I have done all changes push a button and write back the changes to to targets regisrty keys. Here is the code i use: ;************* TABCONTROL1 ************** $TabControl1 = $Form.Controls.TabControl() $TabControl1.Bounds = 15,175,460,300 $TabControl1.FontSize = 8 $TabControl1.FlatStyle = 2 $TabPage3 = $TabControl1.TabPages.Add $TabPage3.Text = " OS Details" ;************* OS Details************** $OSD = $TabPage3.Controls.ListView $OSD.AllowColumnReorder = "True" $OSD.Anchor = 5 $OSD.AutoArrange = "False" $OSD.BackColor = 255,255,255 $OSD.BorderStyle = 2 $OSD.CheckBoxes = "False" $OSD.Enabled = "True" $OSD.FontBold = "False" $OSD.FontItalic = "False" $OSD.FontName = "Tahoma" $OSD.FontSize = 8 $OSD.FontUnderline = "False" $OSD.ForeColor = 0,0,0 $OSD.FullRowSelect = "True" $OSD.GridLines = "True" $OSD.Height = 225 $OSD.HeaderStyle = 2 $OSD.HideSelection = "True" $OSD.LabelEdit = "True" ; <---- If "True" I can change values for first column "Object". But it is not here the changes should be!!) $OSD.LabelWrap = "False" $OSD.Left = 12 $OSD.MultiSelect = "False" $OSD.TabStop = "False" $OSD.Tag = "" $OSD.ToolTipText = "" $OSD.Top = 15 $OSD.View = 1 $OSD.Visible = "True" $OSD.Width = 425 $=$OSD.Columns.Add("Object",150) ; <--------- First column, e.g. "ProxyServer" (Not to be changed!) $=$OSD.Columns.Add("Value",200) ; <--------- 2nd column, e.g. "www.proxy-server.com" (Here i want to changed listed value, after its published) ;************************************* ;************* OS Details Update ************** $OSDUpdate = $TabPage3.Controls.ToolButton $OSDUpdate.Anchor = 5 $OSDUpdate.TextAlign = 32 $OSDUpdate.Enabled = "False" $OSDUpdate.FlatStyle = 2 $OSDUpdate.FontBold = "False" $OSDUpdate.FontItalic = "False" $OSDUpdate.FontName = "Tahoma" $OSDUpdate.FontSize = 8 $OSDUpdate.FontUnderline = "False" $OSDUpdate.ForeColor = 0,0,0 $OSDUpdate.Height = 24 $OSDUpdate.icon = 5 $OSDUpdate.Left = 415 $OSDUpdate.Style = 1 $OSDUpdate.TabStop = "True" $OSDUpdate.Tag = "" $OSDUpdate.Text = "" $OSDUpdate.ToolTipText = "" $OSDUpdate.Top = 245 $OSDUpdate.Visible = "True" $OSDUpdate.Width = 22 $OSDUpdate.OnClick = "OSDC()" ;************************************* Function OSDC() $OSD.Items.Clear $pc = $OSD.Items.Add("ProxyServer") $pc.SubItems(1).text = ReadValue('\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings','ProxyServer') $pc = $OSD.Items.Add("SystemPath") $pc.SubItems(1).text = ReadValue('\HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment','Path') ;..... and so on $OSDUpdate.pushed = "False" EndFunction What 2 do? /C |
||||||||
|
|
|||||||
k, I had to reply as didn't at first glance see a single proper readline! you should decide would you like to go with local or remote but neither of your previous lines will work (like you know) so, for local readline: $ProxyServerValue=ReadValue('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings','ProxyServer') and for remote: $that_system="pcmypc" $ProxyServerValue=ReadValue('\\'+$that_system+'\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings','ProxyServer') |
||||||||
|
|
|||||||
oh, and if shawn hasn't done something behind my back, that editing you want is not supported by listview. |
||||||||
|
|
|||||||
Tahnx Jooel :-) since the editing I want is not supported by listview, we have to skip...However good enough for me. Thanx Shawn and other for your help. Case closed! :-) |