Jump to content
Sign in to follow this  
sy10

n00b ControlSetText and ControlSend problem

Recommended Posts

sy10

Hi All -

I'm trying to use either ControlSetText or ControlSend to enter contact info into Vista Contacts (on Vista SP1). I can do this perfectly well by using Send(), but I really want to use the other commands. I must be doing something wrong here - I can't even get these to work with Notepad.

here's the code:

Run("C:\Program Files\Windows Mail\wab.exe")
WinWait("Contacts")
WinActivate("Contacts")

; Open the New Contact window
$return = ControlClick("Contacts", "", "[CLASS:DirectUIHWND;INSTANCE:1]", "left", "1", "244", "16")

WinWaitActive("Properties")
WinActivate("Properties")

ControlSend("Properties", "First", "[ID:2765]", "jaskhdfaslkj askdj", "1")
ControlSend("Properties", "", "[ID:2765]", "jaskhdfaslkj askdj")
ControlSend("Properties", "", "[CLASSNN:Edit1]", "jaskhdfaslkj askdj")
ControlSend("Properties", "First", "[CLASS:Edit; INSTANCE:1]", "jaskhdfaslkj askdj", "1")
ControlSetText("Properties", "First", "[ID:2765]", "jaskhdfaslkj askdj", "1")
ControlSetText("Properties", "", "[ID:2765]", "jaskhdfaslkj askdj")
ControlSetText("Properties", "", "[CLASSNN:Edit1]", "jaskhdfaslkj askdj")
ControlSetText("Properties", "First", "[CLASS:Edit; INSTANCE:1]", "jaskhdfaslkj askdj", "1")

Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
ControlSend("Properties", "", "[ID:15]", "jaskhdfaslkj askdj")
ControlSetText("Properties", "First", "[ID:15]", "jaskhdfaslkj askdj")

None of the ControlSetText or ControlSend function calls do anything, no matter what format I try. I'm using the AutoIT control viewer to get the control attributes, and everything looks legit as far as the syntax goes.

Any ideas? I'm pulling my hair out trying to get this to work. :) It's so simple, I must be overlooking something.

Thanks!

Share this post


Link to post
Share on other sites
Inverted

ControlSetText ("Untitled - Notepad", "", "Edit1", "HELL0 W0RLD !")

:)

The Classname is the most important. It's Edit1 in this case.

Share this post


Link to post
Share on other sites
nfaustin

sy10,

The word 'Properties' on title of Win function has a space like " Properties"

Try to double click the title name on Autoit Window info to copy the text and observe it has space.

That is why it doesn't see the window.

Sample:

WinWaitActive(" Properties")


[font="Palatino Linotype"][size="2"]*** The information contained in this post should be considered and certified WORKS ON MY MACHINE ***[/size][/font][font="Palatino Linotype"][size="2"] [/size][/font]

Share this post


Link to post
Share on other sites
sy10

sy10,

The word 'Properties' on title of Win function has a space like " Properties"

Try to double click the title name on Autoit Window info to copy the text and observe it has space.

That is why it doesn't see the window.

Sample:

WinWaitActive(" Properties")

That's exactly the problem! Now that I have that silly space in there everything is working like a charm. Much thanks for the help!

Share this post


Link to post
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
Sign in to follow this  

×