Screen Capture Help Needed (NEW)

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Screen Capture Help Needed (NEW)

Post by PepsiHog » Thu Oct 14, 2010 2:07 pm

I wrote a screen capture program, as you may have seen. It consists of a dialog with a tranparent background. When I capture an image, there will be a window behind my screen capture dialog (the one being captured from).

When I click capture I would like my program to discover the name of the window behind it. This is so I can set focus to it later to capture the Http address. How could I do this.

My thought was screen capture a separate file with the entire screen. But is there a way to get text from a bmp file?

Any idea is welcome.

Thanks in advance.

More thought: I'm thinking I'm a user with several windows open. When I use this capture utility, it needs to be smart enough to know which window it captured from.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

sarver311
Pro Scripter
Posts: 84
Joined: Tue Jun 17, 2008 6:37 pm

Post by sarver311 » Thu Oct 14, 2010 7:28 pm

What if you just tell your script to press alt tab which should then go to the window directly behind your current window and then just grab window name?

So something like this

Code: Select all

//your code here that grabs the screen shot
press alt
press tab
release alt
GetActiveWindow>windowtitle,xvar,yvar,width,height

mdl>The window behind your current window is %windowtitle%

Technically alt tab switches between the two most recent windows so this should bring the window directly behind your transparent window into focus.

It's low tech but hopefully will still achieve what you're looking for. :)

Josh

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Post by PepsiHog » Fri Oct 15, 2010 12:34 am

That's a very good idea. Thanks sarver311.

I never or very rarely use shortcut keys. So that didn't even come to mind.

I realized later, after posting earlier, that I didn't explain that FindImage wouldn't work because the main program is a menu of online games(That's the capture). The image is an image of the splash screen, which usually changes or moves. So a match would be unlikely. Or problematic at best. I say this because someone is bound to point it out.

But I really like your idea, sarver311. Thanks.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts