I have a .net application like this;

a simple login window.
the windows info for the label "Username" is
>>>> Window <<<< Title: ABC Login Class: WindowsForms10.window.8.app.0.378734a Position: 492, 381 Size: 296, 189 Style: 0x16C80000 ExStyle: 0x00050101 Handle: 0x000A1006 >>>> Control <<<< Class: WindowsForms10.STATIC.app.0.378734a Instance: 3 ClassnameNN: WindowsForms10.STATIC.app.0.378734a3 Advanced (Class): [CLASS:WindowsForms10.STATIC.app.0.378734a; INSTANCE:3] ID: 790652 Text: Data Source Position: 16, 32 Size: 72, 16 ControlClick Coords: 46, 11 Style: 0x5600000D ExStyle: 0x00000000 Handle: 0x000C107C
and the info for the text box for username is;
>>>> Window <<<< Title: ABC Login Class: WindowsForms10.window.8.app.0.378734a Position: 492, 381 Size: 296, 189 Style: 0x16C80000 ExStyle: 0x00050101 Handle: 0x000A1006 >>>> Control <<<< Class: WindowsForms10.EDIT.app.0.378734a Instance: 1 ClassnameNN: WindowsForms10.EDIT.app.0.378734a1 Advanced (Class): [CLASS:WindowsForms10.EDIT.app.0.378734a; INSTANCE:1] ID: 2560220 Text: Position: 96, 32 Size: 176, 20 ControlClick Coords: 62, 11 Style: 0x560100C0 ExStyle: 0x00000200 Handle: 0x002710DC
At present when i need to script auto login, i write a script like
ControlSend("ABC Login","","[CLASS:WindowsForms10.EDIT.app.0.378734a; INSTANCE:1]","rishav")
But this feels extremely unelegant and i am hardcoding the script to the class/instance instead of the label name. In essence i would like to write the whole script using the fields' labels rather than the class/instance.
will it be possible for me to write a script like
$var=GetControl("ABC Login","Username") CustomSend("ABC Login","$var,"rishav")
or
CustomCommand("ABC Login","Username","rishav")
Anyone has any ideas or advices?
Edited by Rishav, 26 September 2008 - 10:17 AM.




