Sign in to follow this  
Followers 0
ajcrewmisfit

Explanation of the "text" parameter in control*

5 posts in this topic

For some reason i am just not getting the Control* commands

Here's something i had up

Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
$text = WinGetClassList("Untitled - Notepad", "")
MsgBox(0, "Text read was:", $text)
$var = ControlGetText("Untitled - Notepad", "", "Edit1")
MsgBox(0, "Text read was:", $var)
WinWaitActive("Untitled - Notepad")
ControlClick("Untitled - Notepad", "", "Edit")

I was hoping it would click the "Edit" button when you opened notepad.. then i was going ot make it say "Select All..."

I know that we can do it using the hot key Ctrl+A... but for another particular program i have.. there is no hotkey... so i wanted to figure it out with notepad first.

I looked up the help files and i still dont understand the "text" and "classnameNN" parameters... can someone give me better examples than the ones int he help files for

ControlCommand

ControlClick

ControlSend

ControlFocus

please?

thanks!


------------------------------------------------------------------If it were up to me, all computer stuff would work

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

arg...

i guess also what i am trying to say is... Can someone give me examples of what a "classnameNN" and "text" would be when i opened up a program

or you can just tell me how to goto View >> List in Windows Explorer... that would help me understand

Edited by ajcrewmisfit

------------------------------------------------------------------If it were up to me, all computer stuff would work

Share this post


Link to post
Share on other sites

i guess also what i am trying to say is... Can someone give me examples of what a "classnameNN" and "text" would be when i opened up a program

or you can just tell me how to goto View >> List in Windows Explorer... that would help me understand

Run("explorer.exe /e, ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
WinWaitActive("My Computer")
ControlSend("My Computer", "", "ToolbarWindow323", "!vl")

That example opens a new explorer window in the "My Computer" folder. It will then send the alt-v l keystrokes to switch the view. You'll notice the ControlSend has 4 components that I used. The first is the title of the window. The 2nd is the text of the window, which you'll notice I left blank. You can leave it blank if there is only one copy of the window with that title. This paramater is only used to disguinguish between several windows that might have the same title. The 3rd paramater is the classname of the control I wish to send to. I got this by using the Au3_Spy program and holding the mouse over the toolbar. Lastly, give it the text you want to send to that control.


[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

run the autoit window spy, put your mouse over something, like, the control that you want to find... that should tell you the class and text of the control.

you might want to use WinMenuSelectItem

AutoItSetOption("WinTitleMatchMode", 4)
WinActivate("classname=ExploreWClass", "")
WinMenuSelectItem ("classname=ExploreWClass", "", "&View", "&Details")

'course, for some reason, that doesn't work.


"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

aaahhhh i knew that AutoIt Spy wasnt there for nothing =)


------------------------------------------------------------------If it were up to me, all computer stuff would work

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  
Followers 0