when using the find on explorer, how to see if data is found
Moderators: JRL, Dorian (MJT support)
when using the find on explorer, how to see if data is found
I know this is an easy one for you experts, but I just can't find the command to check the text.
I am using scripting to Press Ctrl F and enter text such as "my log" when it finds the text and highlights it, I can see it but how do I have the script tell me success. I tried If>Find="my log" but of course that was a guess and it did not work.
Anyone please. I know it must be a simple script command but if you don't know the command you don't know the command.
Thanks
Tom
I am using scripting to Press Ctrl F and enter text such as "my log" when it finds the text and highlights it, I can see it but how do I have the script tell me success. I tried If>Find="my log" but of course that was a guess and it did not work.
Anyone please. I know it must be a simple script command but if you don't know the command you don't know the command.
Thanks
Tom
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
If search fails, a window comes up with a Failed message. Different window names come up depending on the program being searched, and how the search was started. Find, Find Again, Find Previous, etc.
General guideline to be modified based on actual programs used:
Do the Search. Get name of active window. If Active Window is same as Find window name, then search succeeded. If Active Window name is different, like "Alert", then search failed. MSIE may have a window that says "Finished searching the document". You may need to do a Wait> or a loop to provide time if the search will take a lot of time.
So my thoughts start with defining which programs/browsers will be used.
Manually do some searches to ID the Window names that come up.
Then use an IF loop based on the Active Window name. If Acrive Window iis not the same, then Search failed, else Search was good.
Hope this made some sense, quick and dirty response right now, time is short.
General guideline to be modified based on actual programs used:
Do the Search. Get name of active window. If Active Window is same as Find window name, then search succeeded. If Active Window name is different, like "Alert", then search failed. MSIE may have a window that says "Finished searching the document". You may need to do a Wait> or a loop to provide time if the search will take a lot of time.
So my thoughts start with defining which programs/browsers will be used.
Manually do some searches to ID the Window names that come up.
Then use an IF loop based on the Active Window name. If Acrive Window iis not the same, then Search failed, else Search was good.
Hope this made some sense, quick and dirty response right now, time is short.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Also, if the search is successful some text will be highlighted, so issue a CTRL-C and if you place a known value on the clipboard with PutClipBoard at the start of the search you can now use GetClipBoard to compare - if different (and equal to your search term) you have successfully found something. Use this in combination with the find window disappearing and watch for an alert window if nothing found.
MJT Net Support
[email protected]
[email protected]
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
I like that idea from support....I like to see thinking "outside the box". Much easier than my method, yours works on any program.
Would sugest one more step. Be sure to empty your clipboard before doing the search, or the clipboard may already contain the matching value and mislead you to think a match had been found.
Would sugest one more step. Be sure to empty your clipboard before doing the search, or the clipboard may already contain the matching value and mislead you to think a match had been found.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Thank you Support and Bob Hansen for your suggestions. Bob, it looks like your idea will work just fine, however the support suggestion does seem a little simpler to activate.
However, I am having some very basic problems right now. I have included code below so that you can see if I am coding correctly. The current problem before I can implement supports plan is to get past the ctrl c problem.
When I invoke the ctrl c manually, by manually hiliting some text in the browser then ctrl c...it goes to the clipboard ok and if I activate the script below, it will show my text in the message box.
However if I hilite the text and then active the ctrl c sript below it will not copy the text to the clipboard. The old text remains on the clipboard and the message box shows the old text. Even when I run the complete gamut (last script below) where I script the hiliting of text, it still will not copy text to the clipboard.
Any ideas will be greatly appreciated.
The bottom line of all this experimenting is to be able to process a page with several forms on the same page where the author did not name the form so no way to choose which one to fill out. If they were named, it would be very simple to choose the correct one. My idea was to find some text wording near the form you want to fill and then once the correct text is verified, click tab which will move the cursor to the hilite location and then press tab again to cause the cursor to enter the first field to be filled in. This will
work for all pages that are not framed.
The problem gets complicated when the form page is operating in a frame. For some reason, if you hilite text then press tab the cursor moves not to the hilite text, but to the first field of the first form on the page. If not in a frame then when tab is pressed, the cursor will move to the hilited text. If there was a way to determine the x,y position of the hilited text, I could then position the cursor to that position and that would solve the frame problem.
This problem is discussed further at:
http://www.mjtnet.com/forum/posting.php ... eply&t=768
Title:Getting x,y position of text after doing text find.
In this one, I think I answered the authors question, (when not framed) by finding the text, then press tab, the take the x,y, position of the cursor. Won't work if framed.
and
http://www.mjtnet.com/forum/posting.php ... eply&t=822
Title:Access no name forms via scripts.
I am not getting much response from that question.
**********************************************
Anyway bottom line back to the question at hand.....what am I doing wrong that ctrl c will not place data on the clipboard?
*********************************************
I can highlite anything on the browser screen and activate this script.
The set focus below returns focus back to browser and text will remain hghlighted. When the below script is run the old text remains on the clipboard as shown in the message box. If I manually hilite, then ctrl c and run the below script, the new text shows up in the message box. I even tried a ctrl a script as shown below and nothing went to the clipboard.
Thank you sooooo much for any help.
Tom
SetFocus>Microsoft Internet*
Wait>1
//Press Ctrl
//Send>A
//Release Ctrl
//Wait>1
Press CTRL
Wait>1
Send>C
Wait>1
Release CTRL
Wait>1
GetClipBoard>x
Message>This is the data you hilited -> %x%
end
This code goes thru all the right steps but will place nothing on the clipboard.
SetFocus>Microsoft Internet*
Wait>1
Press Alt
Wait>1
// Open the search box for data entry
Send>EF
Wait>1
Release Alt
Wait>1
//Clear out any old search term
Press Del
Wait>1
// Enter the desired search terms.
Send>color photo
Wait>1
// Search now.
Press Enter
Wait>1
SetFocus>Microsoft Internet*
Wait>1
Press Ctrl
// Copy any found data to the clipboard
Send>C
Release Ctrl
Wait>1
// Move the clipboard data to the x variable
GetClipBoard>x
Wait>1
// View the data from search.
Message>Your clipboard data is -> %x%
end
However, I am having some very basic problems right now. I have included code below so that you can see if I am coding correctly. The current problem before I can implement supports plan is to get past the ctrl c problem.
When I invoke the ctrl c manually, by manually hiliting some text in the browser then ctrl c...it goes to the clipboard ok and if I activate the script below, it will show my text in the message box.
However if I hilite the text and then active the ctrl c sript below it will not copy the text to the clipboard. The old text remains on the clipboard and the message box shows the old text. Even when I run the complete gamut (last script below) where I script the hiliting of text, it still will not copy text to the clipboard.
Any ideas will be greatly appreciated.
The bottom line of all this experimenting is to be able to process a page with several forms on the same page where the author did not name the form so no way to choose which one to fill out. If they were named, it would be very simple to choose the correct one. My idea was to find some text wording near the form you want to fill and then once the correct text is verified, click tab which will move the cursor to the hilite location and then press tab again to cause the cursor to enter the first field to be filled in. This will
work for all pages that are not framed.
The problem gets complicated when the form page is operating in a frame. For some reason, if you hilite text then press tab the cursor moves not to the hilite text, but to the first field of the first form on the page. If not in a frame then when tab is pressed, the cursor will move to the hilited text. If there was a way to determine the x,y position of the hilited text, I could then position the cursor to that position and that would solve the frame problem.
This problem is discussed further at:
http://www.mjtnet.com/forum/posting.php ... eply&t=768
Title:Getting x,y position of text after doing text find.
In this one, I think I answered the authors question, (when not framed) by finding the text, then press tab, the take the x,y, position of the cursor. Won't work if framed.
and
http://www.mjtnet.com/forum/posting.php ... eply&t=822
Title:Access no name forms via scripts.
I am not getting much response from that question.
**********************************************
Anyway bottom line back to the question at hand.....what am I doing wrong that ctrl c will not place data on the clipboard?
*********************************************
I can highlite anything on the browser screen and activate this script.
The set focus below returns focus back to browser and text will remain hghlighted. When the below script is run the old text remains on the clipboard as shown in the message box. If I manually hilite, then ctrl c and run the below script, the new text shows up in the message box. I even tried a ctrl a script as shown below and nothing went to the clipboard.
Thank you sooooo much for any help.
Tom
SetFocus>Microsoft Internet*
Wait>1
//Press Ctrl
//Send>A
//Release Ctrl
//Wait>1
Press CTRL
Wait>1
Send>C
Wait>1
Release CTRL
Wait>1
GetClipBoard>x
Message>This is the data you hilited -> %x%
end
This code goes thru all the right steps but will place nothing on the clipboard.
SetFocus>Microsoft Internet*
Wait>1
Press Alt
Wait>1
// Open the search box for data entry
Send>EF
Wait>1
Release Alt
Wait>1
//Clear out any old search term
Press Del
Wait>1
// Enter the desired search terms.
Send>color photo
Wait>1
// Search now.
Press Enter
Wait>1
SetFocus>Microsoft Internet*
Wait>1
Press Ctrl
// Copy any found data to the clipboard
Send>C
Release Ctrl
Wait>1
// Move the clipboard data to the x variable
GetClipBoard>x
Wait>1
// View the data from search.
Message>Your clipboard data is -> %x%
end
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
This also did not work for me.
Perhaps someone else can explain why CTRL-C does not work, but I changed to the Menu Command, ALT, E, C and it worked for me. See changes in Bold Red.
Perhaps someone else can explain why CTRL-C does not work, but I changed to the Menu Command, ALT, E, C and it worked for me. See changes in Bold Red.
SetFocus>Microsoft Internet*
Wait>1
//Press Ctrl
//Send>A
//Release Ctrl
//Wait>1
Press ALT
Wait>1
Send>EC
Wait>1
Release ALT
Wait>1
GetClipBoard>x
Message>This is the data you hilited -> %x%
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Bob, you are a genius. The Alt EC works great in place of Ctrl C. Again if anyone has an answer as to why you can't script Ctrl c please let us know.
Now I can implement the comparison that support was referring to above. So the only thing left in my project is to find a way to determine the x,y coordinates of hilited text when using the find. I still need to positon the cursor at the point of hilited text for the unnamed forms to work in every case.
That is when you use find to hilite, you can Press tab and the cursor will smartly goto the position of the hilite text. However if the page is framed, when you find text and press tab the cursor goes to the first form field on the page. I need it to go to the hilite text.
I believe that if I hilite and then could some way find the x,y of the hilite, I could command the cursor to go there and then Press Tab and the cursor would then go the the form following the hilite text.
Does all this make sense to anyone?
Any ideas please help. Thanks again Bob and Support you both were a major hurdle jumper.
Tom
Now I can implement the comparison that support was referring to above. So the only thing left in my project is to find a way to determine the x,y coordinates of hilited text when using the find. I still need to positon the cursor at the point of hilited text for the unnamed forms to work in every case.
That is when you use find to hilite, you can Press tab and the cursor will smartly goto the position of the hilite text. However if the page is framed, when you find text and press tab the cursor goes to the first form field on the page. I need it to go to the hilite text.
I believe that if I hilite and then could some way find the x,y of the hilite, I could command the cursor to go there and then Press Tab and the cursor would then go the the form following the hilite text.
Does all this make sense to anyone?
Any ideas please help. Thanks again Bob and Support you both were a major hurdle jumper.
Tom
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Really clutzy, and I would not want to write the routine but you could do a Search until a pixel color changed. But processing time is too long unless you can narrow down the area to be monitored.. Perhaps tab to the general area so you don't have to do the whole page?
You would wait for WaitRectChanged>, then go pixel by pixel doing GetPixelColor>, storing the x,y coordinates, until you get the color of the highlighted text. When the colors match you can then move the mouse to that position. ( If that color is anywhere else on the screen, this won't work).
This is not a new problem, but I don't recall a simple solution.
Perhaps there may be a function in VbScript that can get coordinates of selected text. you could return those coordinates for the mouse. Hmmm, that sounds good. I would like to think that VB has "selected text" functions. I don't know of any right away, but that is another approach to consider....
Keep going for it, we all want the answer.

This is not a new problem, but I don't recall a simple solution.

Keep going for it, we all want the answer.

Last edited by Bob Hansen on Thu Mar 11, 2004 10:29 pm, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Use lower case chars for CTRL/ALT sequences. e.g.
Press CTRL
Send>c
Release CTRL
Press CTRL
Send>c
Release CTRL
MJT Net Support
[email protected]
[email protected]