Jump to content

Comparing values from a listbox in Add & Remove programs


Recommended Posts

I am trying to automatic install a Terminal Server in a Windows 2003 Enviroment.

To do this i need the first part to install some components in Add & Remove programs. But you cant read the values from a listbox.

I have found a script wich does it in the same way BUT.

#include <GUIConstants.au3>

GUICreate("My GUICtrlRead"); will create a dialog box that when displayed is centered

$n1=GUICtrlCreateList ("", 10,10,-1,100 )

GUICtrlSetData(-1,"item1|item2|item3", "item2")

$n2=GUICtrlCreateButton ("button",0,100)
GUICtrlSetState(-1,$GUI_FOCUS)      ; the focus is on this button

GUISetState ()   ; will display an empty dialog box
; Run the GUI until the dialog is closed
Do
    $msg = GUIGetMsg()
    if $msg = $n2 then
        msgbox(0,"list=", GUICtrlRead($n1)); display the value
    endif
Until $msg = $GUI_EVENT_CLOSE

But how do i adjust this script to read the values from a other gui.

When you click the button in reads the value from $n1, $n1=GUICtrlCreateList ("", 10,10,-1,100 ).

How can $n1 become the value of Add & Remove programs GUI.

Can you guys kick me in the good direction :D

Edited by Iznogoud
Link to comment
Share on other sites

I'm not exactly sure what you mean by "But you cant read the values from a listbox." Are you trying to read what programs are installed from the Add/Remove Programs window?

If you are, I'd look at http://support.microsoft.com/kb/314481 for how you can get a listing through the registry.

If you aren't, could you try to explain it again?

Ok i have made a screenshot:

-images deleted-

What i wanna try to accomplish is, that i can read out the description so if the discription is Includes Windows Acc.... the spacebar is pressed, for an example.

I have found the script wich i posted above wich does the trick in his own GUI wich is created by the script. But how can i do this on this Windows Components Wizard window?

If i can read out the discription i can enable some options wich i need to install terminal server.

Hope its clear now :D

Edited by Iznogoud
Link to comment
Share on other sites

What i wanna try to accomplish is, that i can read out the description so if the discription is Includes Windows Acc.... the spacebar is pressed, for an example.

I have found the script wich i posted above wich does the trick in his own GUI wich is created by the script. But how can i do this on this Windows Components Wizard window?

If i can read out the discription i can enable some options wich i need to install terminal server.

Hope its clear now :D

I think this is something along the lines of what you're looking for, let me know if it's not... First open that Windows Components window, then run this.

WinWait ( "Windows Components" )
WinActivate ( "Windows Components" )
WinWaitActive ( "Windows Components" )
ControlCommand ( "Windows Components", "", "ListBox1", "SelectString", 'Accessories and Utilities' )

WinWait ( "Accessories and Utilities" )
WinActivate ( "Accessories and Utilities" )
WinWaitActive ( "Accessories and Utilities" )
ControlCommand ( "Accessories and Utilities", "", "ListBox1", "SelectString", 'Games' )

WinWait ( "Games" )
WinActivate ( "Games" )
WinWaitActive ( "Games" )
ControlCommand ( "Games", "", "ListBox1", "SelectString", 'Minesweeper' )
ControlSend ( "Games", "", "ListBox1", "{Space}")
Edited by exodius
Link to comment
Share on other sites

I think this is something along the lines of what you're looking for, let me know if it's not... First open that Windows Components window, then run this.

WinWait ( "Windows Components" )
WinActivate ( "Windows Components" )
WinWaitActive ( "Windows Components" )
ControlCommand ( "Windows Components", "", "ListBox1", "SelectString", 'Accessories and Utilities' )

WinWait ( "Accessories and Utilities" )
WinActivate ( "Accessories and Utilities" )
WinWaitActive ( "Accessories and Utilities" )
ControlCommand ( "Accessories and Utilities", "", "ListBox1", "SelectString", 'Games' )

WinWait ( "Games" )
WinActivate ( "Games" )
WinWaitActive ( "Games" )
ControlCommand ( "Games", "", "ListBox1", "SelectString", 'Minesweeper' )
ControlSend ( "Games", "", "ListBox1", "{Space}")
Yep the ControlCommand function does the job. A screenshot speaks for 1000 words :D

Thx this makes alot of things much easier.

Link to comment
Share on other sites

Yep the ControlCommand function does the job. A screenshot speaks for 1000 words :D

Thx this makes alot of things much easier.

It sure got me on track with what you were talking about in particular... I didn't even think about the Windows Components list when you started talking about Add/Remove Programs.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...