Sign in to follow this  
Followers 0
Bert

Text in window problem

5 posts in this topic

Ok, I got a real good one for you to try.

I use Unicenter Servicedesk to get my tickets so I can run my service calls. I use the Web-based version. For those of you who are know this software, you know that to do queries require everything to be typed in EXACTLY, for the thing is cap sensitive.

I wrote a script to run my queries, which works great. It just has one drawback, which I would love to fix.

I can not for the life of me capture any text inside the window so I can determine when to run a send command.

I wrote this script in a experiment to see if I could see any text in the window I wanted to control. What I discovered was odd, in that the script would work ONLY if my mouse pointer was over the word I was trying to capture. Here is the script:

AutoItSetOption("WinTitleMatchMode", 2)
IF WinExists("Unicenter ServicePlus Service Desk", "Popup search window for group") == 1 then
MsgBox(0, "", "Window was active")
endif

This will show the msgBox ONLY if my mouse pointer is on the correct spot in the window. I can't use the mouse information to solve this, for if the window is resized, or moved, it would break. I plan to let other users use this script.

I know Unicenter is written in Java, and if I try to view the source code for any window I have open, it is all the same.

My question is this: How can I capture the text I need when it is only visible when the mouse pointer is on it? ;)

Share this post


Link to post
Share on other sites



Have you tried using the Window Info tool? (There should be a shortcut to it in the AutoIt Start menu group.) That will tell you the window text as you hover the mouse over the window.

If this method fails (using the window text) maybe you should try using ControlGetText to grab text in a control in the window.

ben

Share this post


Link to post
Share on other sites

I tried that. It didn't tell me anything that I could use. I can tab between fields, and there is no change in the information provided in the Window Info window. If I put the mouse cursor over the text I want to capture, then the information in the Window Info window will change.

scratching my head on this one.....

Share this post


Link to post
Share on other sites

How about maximising the window in your script, then use BlockInput to stop the users moving the mouse elsewhere, and MouseMove to move to the correct point in the window? It's a horrible hack, but maybe it will work. And what about ControlGetText - did that tell you anything?

ben

Share this post


Link to post
Share on other sites

How about maximising the window in your script, then use BlockInput to stop the users moving the mouse elsewhere, and MouseMove to move to the correct point in the window? It's a horrible hack, but maybe it will work. And what about ControlGetText - did that tell you anything?

ben

yeah it sounds like you're going to have to do some manual sizing etc...maybe something like this....

Dim $desired[5]
$desired[0] = 4
$desired[1] = 0;this is the X position that you want the window to have
$desired[2] = 0; this is the y position that you want the window to have.
$desired[3] = 100; this is the width that you want the window to have.
$desired[4] = 100; this is the height that you want the window to have.
$state = WinGetState("Your Window Title")
If BitAND($state,32) or BitAND($state,16) Then WinSetState("Your Window Title",@SW_RESTORE)
WinMove("Your Window Title","",$desired[1],$desired[2],$desired[3],$desired[4])
i suggest this instead of the maximizing proposed earlier, just because coordinates will still be off after maximizing depending on screen resolution...

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

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