I've been running a script that screen scrapes a window and executes based on a matched screen scrape, and it's been running well for months.
The problem is when users close the window, or scroll down and the screen scrape doesn't work because the matching bitmap is no longer there.
Is there a way of preventing any user interaction with that window, preferably the user cannot click anywhere in that window (no closing, minimize or moves)?
Ideally I would also like a way of preventing users from closing my script through the taskbar or taskmanager
Thanks
Locking window for screen scraping
Moderators: Dorian (MJT support), JRL
If the user does not have to do any work at all during the process simply use BlockInput> to prevent all user interaction with the computer via the mouse or keyboard while your script is running. Just remember to turn it off before the script exits.
If the user has to interact while the script is running it gets a little more difficult but can probably be accomplished to some degree.
Code: Select all
//Turn on BlockInput
BlockInput>1
////////////Do stuff
//Turn off BlockInput
BlockInput>0
Exit>0
Yes, the user needs to be able to work with other windows so blocking input isn't an option.
I saw this post for making the window refuse focus
http://www.mjtnet.com/forum/viewtopic.p ... bbd252e184
This could work, but I'm not sure if the user can just click the close button and close the window before focus.
I saw this post for making the window refuse focus
http://www.mjtnet.com/forum/viewtopic.p ... bbd252e184
This could work, but I'm not sure if the user can just click the close button and close the window before focus.
What function are you using for the screen scrape?
I have a thought that perhaps a dynamically created opaque dialog that hovers on top of your window preventing mouse contact with your window combined with an event handler that will decline focus from your window if the user did something like an ALT TAB to put focus on the window might work. Some get text functions can work even though the window is not focused. Those functions should work while your window is masked as I just described. If the function requires the window be focused, I haven't thought of any way other than to focus the window and blockinput during the screen scraping process.
I'm assuming you just need to protect against accidental interference with the window to be scraped so you're not trying to protect against a concerted effort to thwart the script.
I have a thought that perhaps a dynamically created opaque dialog that hovers on top of your window preventing mouse contact with your window combined with an event handler that will decline focus from your window if the user did something like an ALT TAB to put focus on the window might work. Some get text functions can work even though the window is not focused. Those functions should work while your window is masked as I just described. If the function requires the window be focused, I haven't thought of any way other than to focus the window and blockinput during the screen scraping process.
I'm assuming you just need to protect against accidental interference with the window to be scraped so you're not trying to protect against a concerted effort to thwart the script.
heres a silly idea im guessing you dont want them to scroll down why not add a move mouse that keeps dragging the scroll bar back to top during the scrape thus preventing them from clicking anywhere else also you can also make the window stay on top check this link
http://www.mjtnet.com/blog/2010/09/16/m ... ay-on-top/
also they can use shorcuts liek alt f4 to close teh window you could remap those keys during the scrape and remap again after since you dont want to block input maybe redirecting the input can help kinda like how i made a mouse emulator using keyboard when wasd is pressed instead it would move the mouse so if they press alt it sends space key or if they send f4 it sends backspace or something liek that
but if they need to be able to interact with other windows this could cause a problem especially if your inputting to your window maybe you could use image recognition to detect the close /minimise/resize/move buttons on the scrape window and if they move mouse over them then it sends mouse to another point on the screen or you could just use image recogniton for the entire top bar and if mouse is over it then move the mouse you could also detect the mouse movements and if it goes to certain areas then its moved like make a box that if mouse moves within the box send it to another set point off the box
also windows can only set focus to 1 window at a time so if there using other windows you will need to refocus on your window to input to it
http://www.mjtnet.com/blog/2010/09/16/m ... ay-on-top/
also they can use shorcuts liek alt f4 to close teh window you could remap those keys during the scrape and remap again after since you dont want to block input maybe redirecting the input can help kinda like how i made a mouse emulator using keyboard when wasd is pressed instead it would move the mouse so if they press alt it sends space key or if they send f4 it sends backspace or something liek that
but if they need to be able to interact with other windows this could cause a problem especially if your inputting to your window maybe you could use image recognition to detect the close /minimise/resize/move buttons on the scrape window and if they move mouse over them then it sends mouse to another point on the screen or you could just use image recogniton for the entire top bar and if mouse is over it then move the mouse you could also detect the mouse movements and if it goes to certain areas then its moved like make a box that if mouse moves within the box send it to another set point off the box
also windows can only set focus to 1 window at a time so if there using other windows you will need to refocus on your window to input to it
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!