Desktops.exe multiple desktops

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
conjure
Pro Scripter
Posts: 64
Joined: Thu Jan 12, 2012 3:05 pm

Desktops.exe multiple desktops

Post by conjure » Thu Sep 01, 2016 10:42 am

Hi.
I m using Win7 and Desktops.exe which opens multiple desktops and multiple explorer.exe processes.
Does anyone know if there is a way for MS to know which desktop is running?

User avatar
JRL
Automation Wizard
Posts: 3531
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Desktops.exe multiple desktops

Post by JRL » Thu Sep 01, 2016 12:44 pm

Never heard of "Desktops". Doing an internet search it appears to be a Mark Russinovich product. From the reading on the Sys Internals web page it almost sounds like they are providing a method of switching users or running multiple sessions of Explorer.exe. If that is the case its possible they use different user names for each desktop. If you examine the value of the "User_Name" variable in the Macro Scheduler editor, does "User_Name" change from desktop to desktop?

Just a very uneducated guess.

conjure
Pro Scripter
Posts: 64
Joined: Thu Jan 12, 2012 3:05 pm

Re: Desktops.exe multiple desktops

Post by conjure » Thu Sep 01, 2016 12:55 pm

How do i examine the the value of the "User_Name" variable in the Macro Scheduler editor?

User avatar
JRL
Automation Wizard
Posts: 3531
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Desktops.exe multiple desktops

Post by JRL » Thu Sep 01, 2016 12:59 pm

Sorry, should have stated this in the first post. One easy way would be. Open a new script and run the following line of code.

Code: Select all

MDL>User_Name

conjure
Pro Scripter
Posts: 64
Joined: Thu Jan 12, 2012 3:05 pm

Re: Desktops.exe multiple desktops

Post by conjure » Thu Sep 01, 2016 1:02 pm

is there a way to get the icons names on taskbar?
there you can find an icon of "desktops.exe" with name desktop1 and desktop2 when you move the mouse on the icon
Last edited by conjure on Thu Sep 01, 2016 1:24 pm, edited 1 time in total.

conjure
Pro Scripter
Posts: 64
Joined: Thu Jan 12, 2012 3:05 pm

Re: Desktops.exe multiple desktops

Post by conjure » Thu Sep 01, 2016 1:09 pm

JRL wrote:Sorry, should have stated this in the first post. One easy way would be. Open a new script and run the following line of code.

Code: Select all

MDL>User_Name
:( same user name

User avatar
JRL
Automation Wizard
Posts: 3531
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Desktops.exe multiple desktops

Post by JRL » Thu Sep 01, 2016 1:30 pm

Just installed Desktops. Pretty painless. You're correct the user_name does not change. I'll play around with it for a bit and see if I can find anything to distinguish when a particular desktop is active.

conjure
Pro Scripter
Posts: 64
Joined: Thu Jan 12, 2012 3:05 pm

Re: Desktops.exe multiple desktops

Post by conjure » Thu Sep 01, 2016 1:38 pm

JRL wrote:Just installed Desktops. Pretty painless. You're correct the user_name does not change. I'll play around with it for a bit and see if I can find anything to distinguish when a particular desktop is active.
There is no way to get the icons names on taskbar?

conjure
Pro Scripter
Posts: 64
Joined: Thu Jan 12, 2012 3:05 pm

Re: Desktops.exe multiple desktops

Post by conjure » Thu Sep 01, 2016 1:49 pm

i FOund out that if you open Control Panel\All Control Panel Items\Notification Area Icons
and do a GetWindowTextEx>Notification Area Icons,result
you get the desktop names.
Is there any easiest way?

Code: Select all

Run C:\Windows\explorer.exe shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}
WaitWindowOpen>Notification Area Icons
wait>2
GetTextInit
GetWindowTextEx>Notification Area Icons,result
RegEx>Desktop 2,result,1,matches,num,0
If>num=1
mdl>Desktop 2
endif

User avatar
JRL
Automation Wizard
Posts: 3531
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Desktops.exe multiple desktops

Post by JRL » Thu Sep 01, 2016 3:34 pm

Easier is a relative term. I found a way to work from the explorer.exe process ID for each desktop window. The following seems to work for me. One important thing has to happen for the following code to work. It does not actually recognize the "Desktop" number, it recognizes the order in which the desktops are initialized. So this will work as long as you open the desktops in order the very first time you open them. First open desktop 2 then desktop 3 then desktop 4. (desktop 1 is open before you start) If you open desktop 3 first, this code will report desktop 3 as desktop 2. As you open each desktop the first time a session of explorer.exe is created. Those sessions are reported in order of being created when one views them using DOS tasklist.

Code: Select all

DeleteFile>%temp_dir%ExplorerList.txt
Let>RP_Windowmode=0
Let>RP_Wait=1

RunProgram>cmd /c tasklist /FI "imagename eq explorer.exe" > %temp_dir%ExplorerList.txt

Let>kk=3
Let>vNum=0
Repeat>kk
  Add>kk,1
  Add>vNum,1
  ReadLn>%temp_dir%ExplorerList.txt,kk,value
  MidStr>value,26,10,vID
  Trim>vID,vID
  Let>vDesktop%vNum%=vID
Until>kk=7

DeleteFile>%temp_dir%ExplorerList.txt

LibFunc>user32,GetDesktopWindow,vhwnd
LibFunc>user32,GetWindow,GWRes,vhwnd,5
LibFunc>user32,GetWindow,vhwnd1,vhwnd,5
LibFunc>user32,GetWindow,vhwnd2,vhwnd1,2
LibFunc>user32,GetWindow,vhwnd3,vhwnd2,2
LibFunc>user32,GetWindow,vhwnd4,vhwnd3,2
LibFunc>user32,GetWindow,vhwnd5,vhwnd4,2
LibFunc>user32,GetWindow,vhwnd6,vhwnd5,2
LibFunc>user32,GetWindow,vhwnd7,vhwnd6,2

Let>WIN_USEHANDLE=1
GetWindowProcess>vhwnd7,vProcID,vProcName
Let>WIN_USEHANDLE=0
Let>dd=0
Repeat>dd
  Add>dd,1
  Let>value=vDesktop%dd%
  If>value=vProcID
    Let>vDesktop=This is desktop %dd%
  EndIf
Until>dd=4

MDL>vDesktop

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