Active Window Info w/ Photoshop Cs6 Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Demilich

Active Window Info w/ Photoshop Cs6

09 Dec 2014, 15:59

I want Autohotkey to detect the window title of Photoshop's panels like Layers, Channels, Brush Settings but it seems it can only detect Photoshop's main window, new document, etc.
Is there a way to detect panels in Photoshop? I want to use them in a script to switch programs between monitors. I also tried using Winspector Spy but that didn't work for me either.


1::
{
SetTitleMatchMode, 2

WinMove, Autodesk 3ds Max 2014 x64,,-4,-4,1866,1208,
WinMove, Material Editor - 01 - Default,,47,180,367,896,
WinMove, Mozilla Firefox,,1916,-4,1928,1208,
WinMove, Adobe Photoshop CS6,,1916,-4,1928,1208,
WinMove, New,,2663,279,540,391,


return
}

2::
{
SetTitleMatchMode, 2

WinMove, Autodesk 3ds Max 2014 x64,,1916,-4,1928,1208,
WinMove, Material Editor - 01 - Default,,1965,182,367,896,
WinMove, Mozilla Firefox,,1916,-4,1928,1208,
WinMove, Mozilla Firefox,,1921,1,673,605,
WinMove, Adobe Photoshop CS6,,-4,-4,1866,1138,
WinMove, New,,584,285,540,391,
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Active Window Info w/ Photoshop Cs6  Topic is solved

09 Dec 2014, 19:11

Please test this as the class name in your version of photoshop may be different

Code: Select all

WinGet, Cnt, Count, ahk_class OWL.Dock
Msgbox % "There " ((c:=Cnt=1)?"is":"are") " " Cnt " floating window" (c?"":"s") "."
example reply:
Image
Guest

Re: Active Window Info w/ Photoshop Cs6

10 Dec 2014, 00:14

it tells me how many floating panels there are in photoshop, but how do we get it to detect the names of the panels (like Layers, History, Navigator, etc) and possibly any information within those panels (what layer is selected, etc)
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Active Window Info w/ Photoshop Cs6

10 Dec 2014, 03:06

Guest wrote:how do we get it to detect the names of the panels (like Layers, History, Navigator, etc) and possibly any information within those panels (what layer is selected, etc)
AFAICT you can only return limited info from PS panels ( eg. name ),
and there is no way to return data within the panels via AHk directly.
For example:

Code: Select all

WinGet, WinList_, List, ahk_class OWL.Dock

Loop % WinList_
{
    WinGetText, WinText, % "ahk_id " WinList_%A_Index%
    PanelName := RegExReplace( WinText, "s)\s+`n.*" )

    Msgbox % "Panel: " PanelName "`nHandle: " WinList_%A_Index%     ; For display purposes only. To be removed in real script.
}
However, this info can still be used to conditionally move the panels between monitors.

Code: Select all

WinGet, WinList_, List, ahk_class OWL.Dock

Loop % WinList_
{
    WinGetText, WinText, % "ahk_id " WinList_%A_Index%
    PanelName := RegExReplace( WinText, "s)\s+`n.*" )

    if ( PanelName = "Layers" or PanelName = "Paths" )
    {
        WinMove, % "ahk_id " WinList_%A_Index%,, X, Y, Width, Height ; Add desired coordinates/dimensions to X, Y, Width, Height 
    }
}
Edit: WinMove may not work on PS panels!
After some testing, I noticed that WinMove only temporarily moves the panels in my version of PS.
I also tried DllCall( "MoveWindow", Int, WinList_%A_Index%, Int, 10, Int, 10 ) that also didn't work ( as a possible workaround ).

If you are having the same issue, I suggest manually moving the panels to the desired positions, and then creating a new Workspace
( Under: Window > WorkSpace > New WorkSpace ) for each state.
You can then either assign shortcut keys in PS, then send from AHk to toggle between the states or use PostMessage to `select` the desired workspace.
See tutorial here on how to use PostMessage on menu items.
I use PostMessage with AHk > PS this way for many repetitive tasks so it should work.
demilich
Posts: 2
Joined: 10 Dec 2014, 12:39

Re: Active Window Info w/ Photoshop Cs6

11 Dec 2014, 15:53

Thanks for your help TLM. Also for suggesting to use PostMessage. Seems like that is a better option for now. I ended up using a different method that works ok. I added this function to select the saved workstation in Photoshop. I couldn't get Winspector or Window Detective to give me the wm_command messages for Photoshop or 3ds max 2014. Could it be because they are 64 bit apps? I'm wondering is there is an alternative way to get these wm_commands?

#1::



{
{


MouseClick, left, 1845, 48
SetDefaultMouseSpeed, 10
MouseClick, left, 1845, 84

}

SetTitleMatchMode, 2

WinMove, Autodesk 3ds Max 2014 x64,,-4,-4,1866,1208,
WinMove, Material Editor - 01 - Default,,47,180,367,896,
WinMove, Mozilla Firefox,,1916,-4,1928,1208,
WinMove, Adobe Photoshop CS6,,1916,-4,1928,1208,
WinMove, New,,2663,279,540,391,
WinMove, 255,,126,127,350,1094,


return
}


#2::


{

{


MouseClick, left, 1909, 48
SetDefaultMouseSpeed, 10
MouseClick, left, 1909, 65

}
SetTitleMatchMode, 2

WinMove, Autodesk 3ds Max 2014 x64,,1916,-4,1928,1208,
WinMove, Material Editor - 01 - Default,,1965,182,367,896,
WinMove, Mozilla Firefox,,1916,-4,1928,1208,
WinMove, Mozilla Firefox,,1921,1,673,605,
WinMove, Adobe Photoshop CS6,,-4,-4,1866,1138,
WinMove, New,,584,285,540,391,
WinMove, 255,,1980,171,2204,1094,




return
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: arrondark, Bing [Bot] and 102 guests