Find Window with Text Problem

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
derail

Find Window with Text Problem

Post by derail » Sun Nov 17, 2002 12:30 am

:?: I am trying to write a script that searches a specific window continuously waiting for a certain phrase to be writtten in the window and if it then finds it to finally continue to another macro I have already written.

Any suggestions? Sorry for my Newbyizm :D

Any help would be greatly appreciated.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Nov 18, 2002 9:26 am

Hi,

If using FindWindowWithText then it sounds like you'll need the Edits flag set.

However, since you already know the window, it sounds like the best approach is going to be a loop within which you set focus to the window, and grab the text using the clipboard and check to see if your phrase is in it, something like:

Label>textcheck
Wait>5
SetFocus>your window
//Assume the text editor is focused already
//copy all text to clipboard
Press Ctrl
Send>ac
Release Ctrl
Wait>2
GetClipBoard>thetext
Position>yourphrase,thetext,1,p
If>p=0,textcheck
Macro>yourmacro.scp

So here, if yourphrase is not in thetext the script branches back and loops again. The check is performed every 5 seconds. If yourphrase IS in thetext, the loop ends and the script calls your macro.

You will obviously need to do some tweaking but I hope this gives you the right idea.

derail

find window with text problem

Post by derail » Tue Nov 19, 2002 11:55 pm

Well, your idea works really good...theres just one problem...

Because I want to be able to type in the window and have the macro running at the same time...

I keep getting errors...like I'm sometimes using the A and C keys to type...and since the macro uses those keys...it's not working right...

Here's what I have "tweaked" so far

Label>textcheck
Wait>5
SetFocus>My Window
//Assume the text editor is focused already
//copy all text to clipboard
press shift
press tab
press tab
release shift
Press Ctrl
Send>ac
Release Ctrl
press tab
press tab
GetClipBoard>test
Position>yourphrase,test,1,p
If>p=0,textcheck
macro>mymacro.scp

That's why I was trying to use the findwindowwithtext command...
but I'm not smart enough to figure it out. :lol:

Any more suggestions?

Thanks very much for all your help!

Derail

derail

find window with text problem

Post by derail » Tue Nov 19, 2002 11:57 pm

Oh I almost forgot

I keep getting Macro Scheduler errors

"cannot open clipboard"

Or something like that.

Thanks again!

Derail

Ernest

Post by Ernest » Fri Nov 22, 2002 8:26 pm

Hi derail,
am I'm wright, that you've posted a similar request at the Technical/Scripting forum? :?

It's a little confusing to keep an eye on both forums to solve the same issue. But maybe I'm wrong ... :wink:

Ciao
Ernest

Ernest

Post by Ernest » Fri Nov 22, 2002 8:36 pm

Huh - it's not right to write wright ... :lol:

derail

find window with text problem

Post by derail » Sat Nov 23, 2002 9:42 pm

sorry won't happen again.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts