Jump to content

How to set focus to items


 Share

Recommended Posts

Hi Mates

I am trying to automate profile creations on win 2000 environment. Under system properties, User Profiels tab, I want to set my focus(Highlight) to a particular profile under the box, profiles stored on this computer. I have tried to use various options like setfocus etc. but no luck any one has any idea how this can be achieved.

I have attached the screen shots and I want to have the focus set on one of them

Any help on this would be greatly appreciated.

Regards

PGV

post-48074-1238583102_thumb.jpg

Link to comment
Share on other sites

You need to get a handle to the SysListView32 control on the dialog using ControlGetHandle(). Once you've got it, you can use the _GUICtrlListView* functions to examine the contents of the view and select a particular profile.

AutoIt Window Info is your friend here.

WBD

Edited by WideBoyDixon
Link to comment
Share on other sites

Thanks a lot WBD for guiding me to the right direction

Cheer

pgv

You need to get a handle to the SysListView32 control on the dialog using ControlGetHandle(). Once you've got it, you can use the _GUICtrlListView* functions to examine the contents of the view and select a particular profile.

AutoIt Window Info is your friend here.

WBD

Link to comment
Share on other sites

Hi mate

This is the code I am using

$c=ControlGetHandle("System Properties","Profiles stored on this computer:",1000)

if not ControlGetHandle("System Properties","Profiles stored on this computer:",1000) Then

msgbox(1, "","NF")

Else

Msgbox(1,"",$c)

EndIf

The handler given by Autoit window info is different to what the msg box give me

In Autoit window info the classNameNN is SysListview32 and Advance Class :[CLASS:SysList32:INSTANCE:1] and ID is 1000. I am not able to proceed further any help is much appreciated.

Cheers

pgv

Thanks a lot WBD for guiding me to the right direction

Cheer

pgv

Link to comment
Share on other sites

#include <GuiListView.au3>
#include <Array.au3>

Local $wText = "User Profiles"
Switch @OSVersion
    Case "WIN_2000"
        $wText = "System Properties"
    Case "WIN_XP"
        $wText = "User Profiles"
EndSwitch
$hListView = ControlGetHandle($wText, "", "[CLASS:SysListView32; INSTANCE:1]")
If @error = 1 Then
    MsgBox(1, "", "Not Found")
Else
    $itemCount = _GUICtrlListView_GetItemCount($hListView)
    For $i = 0 To $itemCount - 1
        $itemText = _GUICtrlListView_GetItemTextArray($hListView, $i)
        MsgBox(1, "", _ArrayToString($itemText, " --> ", 1))
    Next
EndIf

Edited by WideBoyDixon
Link to comment
Share on other sites

extending my thanks to WBD, now I am able to list the profile as per my requirement but, when I am trying to set my focus on one of them it does not work I am using the ControlGetFocus($itemText,$p), I have also tried to use the SysListview32 but focus does not seems to be moving on.. any help would be much appreciated.

thanks

pgv

thanks once again mate!

Cheers

pgv

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...