Page 1 of 1

return current desktop to a script

Posted: 10.02.2012 09:26:59
by willichan
Is there a way for a script (I use AutoIt, but batch or VB is ok) to read what the current desktop number is? Registry location, environment variable, command-line return code?

Why I need it:
- I have a monitoring program that watches what my children (and guests) are doing on the network/internet. Unfortunately, it runs in full-screen mode, and likes to pop itself to the front all the time. It is something a friend is writing, and I am his live test. He keeps promising to fix it, but is stuck on other (paying) projects for now. I get around this using a rule to keep it on a particular desktop.
- I have a special transparent screen-saver the same friend made for me that lets me lock my computer, but show through whatever would be showing on my desktop.
- I am writing an AutoIt script that will watch for the screen saver to kick in, and switch the current Dexpot desktop between the one with the network usage monitor and another screen that shows a web page with things like weather and a family calendar.

The problem is that I want the script to switch the current desktop back to where-ever I was before the screen-saver script kicked in. Unfortunately, the -back switch won't do it, because Dexpot will have switched desktops multiple times after the screen-saver script kicked in.

Re: return current desktop to a script

Posted: 11.02.2012 09:14:16
by Patrick

Code: Select all

$handle = WinGetHandle("[TITLE:Dexpot - Main Menu; CLASS:ThunderRT6FormDC]")
$ret = DllCall("user32.dll", "int", "SendMessage", "HWND", $handle, "UINT", 2006, "WPARAM",  0, "LPARAM", 0)
MsgBox(0, "Current Desktop", $ret[0])

Re: return current desktop to a script

Posted: 22.02.2012 18:04:41
by willichan
Thank you! That is a big help.