Resources are used to recognize area of the screen by image matching. The function of the resource is to maintain a library of reusable user interface element images that are used for recognition. These images can be requested and retrieved by the desktop client before a custom activity script is executed.
Resources are useful because some application are hard to automate with standard function if their element names are not exposed, same as the other element name or if they are not set at all
For example instead of using a push button function in your script to click the don't save button when closing a Notepad application you could capture an image of the don't save button and save it as resource and then reference the resource with find image function within your script.
When the Notepad window is active (focused) the don't save button has blue outline when the window is not active or not focused the don't save button has no blue line. When creating resource, Just make sure the element is set in the state that will be in the when the script tries to look for it in this case we want the window to be focused if you don't want to see the dotted line inside the blue outline press tab a few times.
To create a resource image, Select the application on and then press the print screen button on your keyboard Paste the screenshot into the MS paint. Crop the image to create screenshot of the button or the element you want. This must be done on the agent desktop as resolution difference between PCS can affect image recognition. Finally save the file as 24 bit BMP file on the agent PC.
The final image should look similar to this :
Also here the sample script which opens About notepad window by pressing Alt+h
and after thatAlt+a
After this it finds OK button and do a left click on it.
SetFocus>Untitled - NotepadCapsoff
Press Enter
Send>Paint was opened!
Press Enter
Press ALT
wait 0.5
Send>h
wait 0.5
Send>a
wait 0.5
Release ALT
Wait 3
FindImagePos>{AboutOK},SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Wait 1
Let>MACRO_RESULT=SUCCESS
Else
Let>MACRO_RESULT=FAILED
Endif
Comments
0 comments
Please sign in to leave a comment.