I'm not sure whether its possible or not but is there a method to detect whether current active window is Desktop or not,
Eg.
1)Monitor active window
2)If active window is currently desktop then launch a program(process)/made the program(process/window) the active window if its currently running.
Thank you.
How to check current active window is Desktop or not?
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: How to check current active window is Desktop or not?
The Desktop has a window title of "Program Manager". So you can do:
Code: Select all
GetActiveWindow>title,x,y
If>title=Program Manager
//Desktop is active
Else
//Something else is active
Endif
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: How to check current active window is Desktop or not?
Thanks Marcus, the code works provided I click the desktop first. I use it like below
I compiled it into exe, then run exe inside a folder, then minimise/close folder, I can see the desktop, but message desktop is not active will be display unless, I minimise/close folder, then click desktop, then I will get message desktop is active.
Is there a method, when I see the desktop in plain sight(screen), then launch whatever app or macro I want?
Thank you.
Code: Select all
Wait>5
GetActiveWindow>title,x,y
If>title=Program Manager
//Desktop is active
MessageModal>Desktop is Active.
Else
//Something else is active
MessageModal>Desktop is not Active.
Endif
I compiled it into exe, then run exe inside a folder, then minimise/close folder, I can see the desktop, but message desktop is not active will be display unless, I minimise/close folder, then click desktop, then I will get message desktop is active.
Is there a method, when I see the desktop in plain sight(screen), then launch whatever app or macro I want?
Thank you.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: How to check current active window is Desktop or not?
Err, of course. You said you want code that detects WHETHER the desktop is active or not.
The code doesn't MAKE it active, it tells you IF it is active.
Is that not what you want?
If you want to MAKE it active then use SetFocus.
The code doesn't MAKE it active, it tells you IF it is active.
Is that not what you want?
If you want to MAKE it active then use SetFocus.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: How to check current active window is Desktop or not?
Sorry, my mistake, I thought making it active is what I want, I'm wrong as usual.
Initially, I thought detecting the active desktop window will do but I was wrong, when I saw the desktop on screen, it doesn't mean its active or not, so I'm wrong, sorry.
So, actually, what I'm trying to achieve is when, I can see the desktop on screen(in plain sight) irregardless whether its active or not, launch a macro or program I specify.
So the right method below is eg.
1) Saw the destkop on screen(whether its active window or not, doesnt matter).
2) Launch the a program I specify.
Any ideas?
Thanks.
Initially, I thought detecting the active desktop window will do but I was wrong, when I saw the desktop on screen, it doesn't mean its active or not, so I'm wrong, sorry.
So, actually, what I'm trying to achieve is when, I can see the desktop on screen(in plain sight) irregardless whether its active or not, launch a macro or program I specify.
So the right method below is eg.
1) Saw the destkop on screen(whether its active window or not, doesnt matter).
2) Launch the a program I specify.
Any ideas?
Thanks.