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"
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?
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;OnScreenRect0 r;2;OnScreenRect2 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.
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.
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.
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
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.
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.
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
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)