Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Windowtext.find = How to add a "-" in a search word
#1
A quick ? per above topic. How can I find a word w. a '-', such as "Model-doc".

EX:
int wMain=win("Nota Bene - [TEST_QM_find-text.nb]" "ThunderRT6MDIForm")
int w=child("" "ThunderXWText" wMain)
WindowText x.Init(w)
if x.Find("MODEL-doc" 0x1000)
mes "found"
else
mes "not found"

Thanks,

Kent
#2
Does not find words with - ? Maybe it is not the ASCII hyphen. There are several similar characters.
http://en.wikipedia.org/wiki/Hyphen
#3
Hmm??? shall investigate this! Thanks
#4
I've spent TONS OF TIME attempting to get this to work. I have a very, very simple situation.
A Notepad text file named '20150606103330.txt'
I want to search for the text "~ct#"

I just want to search, find and have the cursor go there. My macro will take over from there. (I would REALLY prefer to use this 'WindowText.Find'!)

Could someone please provide an adjustment on the above example to show how I can do this?

Thank You!
#5
Macro Macro2573
Code:
Copy      Help
run "Notepad"
0.4
paste "ghdgfhjgsfhj[]MODEL-doc[]ugshgdhsghs[]"

int wMain=win("Notepad")
int w=child("" "Edit" wMain)
WindowText x.Init(w)
WTI* t=x.Find("MODEL-doc" 0x1000)
if t
,mes "found"
,x.Mouse(0 t)
,RECT r=t.rt; MapWindowPoints w 0 +&r 2; OnScreenRect 0 r; 2; OnScreenRect 2
else
,mes "not found"

This example is with Notepad window. Not from all windows and controls can capture text. Always Test in 'Window Text' dialog.
#6
Sorry to continue on what may be for most --such a 'simple' issue.--
BUT, -I can't get 'WindowText x.Init(w)' to find text in a child window of my primary research software, 'Nota Bene'.
I can now find it in a 'Notepad' window, with you recent advice & help. (I can generally address and control 'child-windows' in Nota Bene, such as: a) hide/unhide window; b) and many more QM commands and functions.

I have spent a lot of time: a) reading the help files and b) tweaking the examples there, along with what you have provided above
BUT
I continue to have a problem with:
a) "window not found" or
b) "object not found" messages

What I want to do is very simple once more, but I'm missing some very important element of the syntax. Hmmm???

The parent application is Nota Bene
The child window could be named "childFilename.nb"

I want to find 'CLWDee' (text) in that window and simply yield a message of:

IF found =
mes "yes"

IF not found =
mes "not found"

And once again, "IF" I can get to this point, I can implement the rest of my macro.

Kent
#7
When you click the first Test button in dialog 'Window Text', does it show red rectangles over text in the selected window/control?
If not, QM cannot get text from that window. Then try dialog 'Find accessible object'. But text lines/words usually are not accessible objects.
#8
No, it is a 'black' rectangle. Ouch!
#9
Gintaras, my system ALSO shows a black rectangle around a Notepad window and it can get data from there! What's this mean?
#10
Gintaras, SORRY ... in my haste I DID NOT answer your question correctly:

here is what I find w. Notapad

I choose the 'Window text' dialog'
THEN via the select button, I click on the 'choose' button
and
Select a the Notepad window via 'shift' = a 'black' rectangle
THEN
I press the 'upper right' test button and the screen responds but no red-rectangel
IF I press the lower text button = a QM message box of 'text empty'

SO, what does this say since I know that you can find text in a Notepad window
#11
Cannot get text from that window.
If can get text, the first Text button shows the attached image. The second Test button finds text that you enter in 'Item text' field and shows small black rectangle around the found text item.


Attached Files Image(s)
   
#12
If you have any more time = THANKS

The message of 'window not found' seems to imply to me AGAIN, sorry!, --that my syntax may be wrong!

I have tried:

int wMain=win("Nota Bene - [TEST_QM_find-text.nb]" "ThunderRT6MDIForm")
int w=child("" "ThunderXWText" wMain)
WindowText x.Init(w)
if x.Find("MODEL-doc" 0x1000)

and

int wMain=win("Nota Bene" "ThunderRT6MDIForm")
int w=id(32772 wMain) ;;ThunderRT6FormDC 'test.nb'
WindowText x.Init(w)
;;WTI* t=x.Find("CLWDee" 0x1000)
if x.Find("CLWDee");; 0x1000)

(part of this one was generated by the 'Window text' diaglog)


and

int wMain=win("Nota Bene")
int w=child("" "Edit" wMain)
WindowText x.Init(w)
WTI* t=x.Find("cit#" 0x1000)
if t

and

int wMain=win("Notepad")
int w=child("fileNameHere.nb" "Edit" wMain)
WindowText x.Init(w)
WTI* t=x.Find("cit#" 0x1000)
if t

I'm hoping for the best here and NOT trying to be obstinate.

AND thanks for your time, help, advice!!!!!!!!
#13
Run macro:

int wMain=win("Nota Bene - [TEST_QM_find-text.nb]" "ThunderRT6MDIForm")
outw wMain
int w=child("" "ThunderXWText" wMain)
outw w

What it shows in QM output?
#14
Error (RT) in piece_forThis_WindowtextFind_test_w_NB: window not found
#15
outw wMain shows 0? It means that such window does not exist. Maybe need to edit name.
#16
Don't understand???
#17
int wMain=win("Nota Bene - [TEST_QM_find-text.nb]" "ThunderRT6MDIForm")
outw wMain ;;if this shows 0 in QM output, such window does not exist
int w=child("" "ThunderXWText" wMain)
outw w
#18
Gintaras,

Here is one of the things that is throwing me, the:

"[TEST_QM_find-text.nb]]"

Was I supposed to create a file w. this name? (I did)

IF NOT, then the file does not exist? Right? That's --king-of-- what I DON'T understand.

By the way, --HERE IS A VERY ENCOURAGING NOTE, -In the past 24 hrs, I have made tweaks what have cut my macro times down from about 40-50%

=

From 12 seconds, to about 8 for shorter macros and from about 18 to about 11 on longer ones. WONDERFUL!!!!
#19
[TEST_QM_find-text.nb]
It is from your macro, I don't know what it is.
#20
Gintaras, esp. note the very last line of this note. Does it tell you anything?
Wow! -that answers this ? = this string began MONTHS AGO! (ha!)

So, any filename would go there, correct.

For this to work to I have to: a) activate Nota Bene and then b) activate the child fild?

e.g.

act "Nota Bene"
wait 0.2
act child("test.nb")
wait 0.2

THEN I could run what you have listed above:

int wMain=win("Nota Bene - [test.nb]" "ThunderRT6MDIForm")
outw wMain
int w=child("" "ThunderXWText" wMain)
outw w

I can tell you, that this yields the same result of:

0
"Error (RT) ...: window not found.

ALSO, I have tried various files and filenames. This is interesting to me since other commands certainly work on the same file correctly, such as: paste, act, etc., etc.

Here is something that may be important to you or --may tell you something--

When the error message is displayed, the cursor is always blinking BEFORE the "w" of the "int w=child("" "ThunderXWText" wMain)


Forum Jump:


Users browsing this thread: 2 Guest(s)