Hi, I need to fine specific device on Iphone in Bluetooth setting. There are can be few devices with the same status (Not Pired, Connected, Not connected). I use ImageFound(Text:“My device”) and ImageFound(Text:“Not Paired”). I need to find devices by Text recognition because the name of device is changed very often.
How to set area of searching? That I will can find ImageFound(Text:“Not Paired”) text based on ImageFound(Text:“My device”) result. I would be very appreciate if you will provide example. Thanks.
If you recon the text name changes ‘dynamically’ then I would approach with CaptureImage() with collection.
Please get back to me if this doesn’t make sense.
avb,
In order to set a search rectangle based on the image of the (text:“My Device”) result, you will want to use code similar to this:
//Get the rectangle bounds of the location of text:"My Device":
put imageRectangle(text:"My Device",searchrectangle: (TLImage,BRImage)) into MyDeviceLocation
put mydeviceLocation
//Use coordinate math to calculate the top left and bottom right corners of the new searchRectangle based off of the image location:
put item 1 of myDeviceLocation +100 into TLX
put item 2 of myDeviceLocation + 100 into TLY
put item 3 of myDeviceLocation + 400 into BRX
put item 4 of myDeviceLocation + 400 into BRY
//Read Text within the new searchRectangle:
Log ReadText ((TLX,TLY),(BRX,BRY))
Here is the documentation on the imagerectangle() function:http://docs.testplant.com/?q=content/eggplant-commands-and-functions#imagerectangle-function
You can read about using images to set a search rectangle here:http://www.testplant.com/2012/02/17/working-with-ocr/
Thank’s I’ve done almost the same as you have written.