Many developers use multiple screens on their machines, often with varying resolutions. For example, I have two 1920 x 1080 resolution screens and a 1680 x 1050 resolution screen. This can be an issue when using FindImagePos. An image found on the 1680 x 1050 will not be found on the larger screens and vice versa.
Is there a function that can find an image regardless of its size?
Regards,
Finding an image that has changed size
Moderators: Dorian (MJT support), JRL
- Dorian (MJT support)
- Automation Wizard
- Posts: 1390
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: Finding an image that has changed size
Unfortunately not. I think the only option that comes to mind is have the script look for both.
Yes, we have a Custom Scripting Service. Message me or go here
-
- Newbie
- Posts: 19
- Joined: Mon Oct 14, 2019 6:23 am
Re: Finding an image that has changed size
In some older scripts I had different paths and things to check depending on screen res, after a while I stopped and made them 1080p only.
If there's an alternate method to search for the image that could help (FindObject Wizard?)
If it can be moved to a primary (1080p) window before searching, or as a second attempt if not found that might work too.
I use the below to ensure a window is always on my primary 1080p screen. The application is run in a virtual environment and has LOTS of nested frames, so in some cases I need to use MouseMove.
Code: Select all
GetScreenRes>nWidth,nHeight
If>nWidth<>1920
Goto>ScreenResError
Endif>
If>nHeight<>1080
Goto>ScreenResError
Endif>
If there's an alternate method to search for the image that could help (FindObject Wizard?)
If it can be moved to a primary (1080p) window before searching, or as a second attempt if not found that might work too.
I use the below to ensure a window is always on my primary 1080p screen. The application is run in a virtual environment and has LOTS of nested frames, so in some cases I need to use MouseMove.
Code: Select all
Let>WIN_USEHANDLE=1
//Web app is run in a virtual environment due to compatibility issues
Run>%WebApp%
Wait>3
//Grab the IE reference, then handle and wait
IEGetFromURL>%URL%,IE1
Wait>1
IEGetHWND>IE1,Handle
IEWait>IE1
//Move the window to the top left of the main window
MoveWindow>Handle,1,1
Wait>0.3
//Minimise the window
WindowAction>2,Handle
Wait>0.2
//Maximise/fullscreen the window (Doing this if the window is already maximised will make it smaller, so minimise first to ensure it isn't maximised)
WindowAction>1,Handle
- Dorian (MJT support)
- Automation Wizard
- Posts: 1390
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: Finding an image that has changed size
Thank you for adding that. Those are good tips. Controlling the environment definitely helps, and moving them to a screen with a known resolution is a great idea. And even in a single screen scenario, controlling the window size definitely helps.DreamTheater wrote: ↑Fri Jan 17, 2020 4:56 amIn some older scripts I had different paths and things to check depending on screen res, after a while I stopped and made them 1080p only.Code: Select all
GetScreenRes>nWidth,nHeight If>nWidth<>1920 Goto>ScreenResError Endif> If>nHeight<>1080 Goto>ScreenResError Endif>
If there's an alternate method to search for the image that could help (FindObject Wizard?)
If it can be moved to a primary (1080p) window before searching, or as a second attempt if not found that might work too.
I use the below to ensure a window is always on my primary 1080p screen. The application is run in a virtual environment and has LOTS of nested frames, so in some cases I need to use MouseMove.
Code: Select all
Let>WIN_USEHANDLE=1 //Web app is run in a virtual environment due to compatibility issues Run>%WebApp% Wait>3 //Grab the IE reference, then handle and wait IEGetFromURL>%URL%,IE1 Wait>1 IEGetHWND>IE1,Handle IEWait>IE1 //Move the window to the top left of the main window MoveWindow>Handle,1,1 Wait>0.3 //Minimise the window WindowAction>2,Handle Wait>0.2 //Maximise/fullscreen the window (Doing this if the window is already maximised will make it smaller, so minimise first to ensure it isn't maximised) WindowAction>1,Handle
Yes, we have a Custom Scripting Service. Message me or go here