Getting excluded monitors via script ?

Post any technical problems or questions you have while using or configuring Dexpot.
Bug-Tracker
Noesis
Posts: 9
Joined: 07.05.2013 15:26:48

Getting excluded monitors via script ?

Postby Noesis » 12.05.2013 19:36:53

Firstly thanks for this program, it's an amazing piece of software.

I was wondering if there is a way to determine if a monitor is excluded or not via a script ?

Reason for asking this, is I've made a script (in Lua) which minimises/maximises all windows on the desktop which currently has the mouse on it (i.e. for multiple monitors) only it does strange things with dexpot. If the windows are minimised on virtual desktop 1 then the virtual desktop is changed (say to 2), the script will restore the windows from desktop 1 onto desktop 2 instead of minimise desktop 2 (kind of expected I guess as they are still both the same monitor), a subsequent desktop change will actually reset the windows to their original desktops but anyway I can fix that by getting the current dexpot desktop number (using code I found in another thread on this forum). However If I fix that part it will mess up my excluded monitor, unless I can determine which monitors are excluded or included in the dexpot settings.

I'm aware I could simply hard-code the Lua script to ignore the excluded monitor but figured I'd ask the question as doing it with calls from the script would be a better solution than hard-coding it, assuming it's possible.

User avatar
Patrick
Developer
Posts: 7380
Joined: 04.03.2003 14:51:26

Re: Getting excluded monitors via script ?

Postby Patrick » 13.05.2013 17:11:19

:dex:

Yes, should be possible. Can you post the script you're using to get the current desktop number?

Noesis
Posts: 9
Joined: 07.05.2013 15:26:48

Re: Getting excluded monitors via script ?

Postby Noesis » 13.05.2013 18:41:22

The original code I found in these forums somewhere (can't find the thread again) was:

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])


Which I modified into AHK code to test if it still worked as:

Code: Select all

#z::
   DetectHiddenWindows, On
   WinGet, handle, ID, Dexpot - Main Menu ahk_class ThunderRT6FormDC
   result := DllCall("user32.dll\SendMessage", "int", handle, "Uint", 2006, "Uint", 0, "Uint", 0)
   MsgBox %result%
return


And finally same code again but this time in Lua script format:

Code: Select all

function fn_GetDexDesktop()
   local Hwnd = acFindWindow("ThunderRT6FormDC","Dexpot - Main Menu")
   local Alien_SendMessage = alien.core.load("user32.dll").SendMessageW
   Alien_SendMessage:types{ret = 'int', abi = 'stdcall', 'int', 'uint', 'uint', 'uint'}
   return Alien_SendMessage(Hwnd, 2006, 0, 0)
end

User avatar
Patrick
Developer
Posts: 7380
Joined: 04.03.2003 14:51:26

Re: Getting excluded monitors via script ?

Postby Patrick » 13.05.2013 21:04:48

Try something like this:

Code: Select all

bit = require("bit")

MessageBox = alien.core.load("user32.dll").MessageBoxA
MessageBox:types{ ret = 'long', abi = 'stdcall', 'long', 'string', 'string', 'long' }

excluded = Alien_SendMessage(Hwnd, 2049, 0, 0)

for i = 1, 16 do
   local monitor = bit.lshift(1, i-1)
   if bit.band(excluded, monitor) ~= 0 then
      MessageBox(0, "Monitor " .. i .. " is excluded.", "Bla", 0)
   end
end

Noesis
Posts: 9
Joined: 07.05.2013 15:26:48

Re: Getting excluded monitors via script ?

Postby Noesis » 14.05.2013 16:05:14

Thanks Patrick ! :D

pribilinskiy
Posts: 3
Joined: 01.08.2013 12:45:34

Re: Getting excluded monitors via script ?

Postby pribilinskiy » 01.08.2013 13:09:13

Hi Patrick, just started investigating the Plugin SDK and I've found that the last WM_HOOXPOTRUFT message is
#define DEX_FINDWINDOW (WM_HOOXPOTRUFT + 246)
I mean, there's no constant 2049 (WM_HOOXPOTRUFT + 247) declared there :)
constants.h is dated 12/04/2010

Is there a more recent dexpot15_plugin_sdk available?
Thanks

User avatar
Patrick
Developer
Posts: 7380
Joined: 04.03.2003 14:51:26

Re: Getting excluded monitors via script ?

Postby Patrick » 08.08.2013 21:13:42

Sorry for the late reply. Here's the most recent version. Let me know if you have any more questions.

dexpot16_plugin_sdk.zip
(13.55 KiB) Downloaded 231 times

pribilinskiy
Posts: 3
Joined: 01.08.2013 12:45:34

Re: Getting excluded monitors via script ?

Postby pribilinskiy » 08.08.2013 23:10:06

Thanks for the update

Actually i have questions indeed :)
I'm trying to automate Dexpot with Autohotkey. To accomplish that i use the constants.h along with SendMessage function. However i could not achieve to make everything functional

Getting handle to the Dexpot was failry easy thanks to a few posts in the forum:

Code: Select all

DEXPOTTITLE = Dexpot - Main Menu
DEXPOTCLASS = ThunderRT6FormDC
WinGet, hDexpot, ID, % DEXPOTTITLE " ahk_class " DEXPOTCLASS


The messages that are processed without issues:

Code: Select all

; return current desktop:
SendMessage, DEX_GETCURRENTDESKTOP, 0, DEX_GETCURRENTDESKTOP, , ahk_id %hDexpot%
currentDesktop := ErrorLevel


Messages that are working:

Code: Select all

DEX_GETDESKTOPCOUNT

DEX_SETDESKTOPCOUNT (int desktops)

DEX_SWITCHDESKTOP (int desktop)

; move active window to the target desktop, without switching to the desktop
DEX_MOVEWINDOW (int desktop)

; copy active window to the target desktop, without switching to the desktop
DEX_COPYWINDOW (int desktop)

; copy window to the current desktop
DEX_SHOWWINDOW

; move all windows to the current desktop
DEX_GATHERWINDOWS


there's also a lack of documentation for some commands

Following doesn't work and i don't know why

Code: Select all

SendMessage, DEX_DEXPOTCOMMAND, 0, DEX_COMMAND_APPLYRULES, , ahk_id %hDexpot%


Messages that i would like to use, but they are not working:

Code: Select all

DEX_SETFOREGROUNDWINDOW
DEX_ASSIGNWINDOW
DEX_SWITCHTOWINDOW
DEX_GETACTIVEWINDOW
DEX_SETACTIVEWINDOW
DEX_GETWINDOWSONDESKTOP
DEX_FINDWINDOW
DEX_REMOVEWINDOW


it would be awesome if you could help with this

the syntax of ahk's SendMessage is

Code: Select all

SendMessage, msg, wParam, lParam, , hwnd


Return to “Support”

Who is online

Users browsing this forum: No registered users and 248 guests