Jump to content

Handle or CLASS of a folder


johnmcloud
 Share

Recommended Posts

Hi guys,

A fast question, there is a way to recognize if the active window is a folder or not?

In a generic way, without know the title. I want to start the Func() only if the active windows is a folder and do nothing is a browser/software/cmd etc...

Thanks for any help ;)

Link to comment
Share on other sites

This is correct?

While 1
If WinExists("[CLASS:CabinetWClass]") Then
MsgBox(0, 0, "It's a folder")
EndIf
Sleep(100)
WEnd

Seems work on Xp, someone want to test on Seven if work?

Not work, i start it on SciTE and it starts MsgBox ... Edited by PlayHD
Link to comment
Share on other sites

Here is the class list

UIRibbonCommandBarDock
UIRibbonCommandBarDock
UIRibbonCommandBarDock
UIRibbonCommandBar
UIRibbonWorkPane
NUIPane
NetUIHWND
UIRibbonCommandBarDock
WorkerW
ReBarWindow32
TravelBand
ToolbarWindow32
UpBand
ToolbarWindow32
Address Band Root
msctls_progress32
Breadcrumb Parent
ToolbarWindow32
ToolbarWindow32
SeparatorBand
UniversalSearchBand
Search Box
SearchEditBoxWrapperClass
DirectUIHWND
SeparatorBand
ShellTabWindowClass
DUIViewWndClassName
DirectUIHWND
CtrlNotifySink
Shell Preview Extension Host
CtrlNotifySink
NamespaceTreeControl
Static
SysTreeView32
CtrlNotifySink
SHELLDLL_DefView
DirectUIHWND
CtrlNotifySink
ScrollBar
CtrlNotifySink
ScrollBar
WorkerW
ReBarWindow32
ToolbarWindow32
msctls_statusbar32
UIRibbonWorkPane
Link to comment
Share on other sites

This is a better approach

#include <Process.au3>
Local $pid = WinGetProcess("[active]", "")
Local $name = _ProcessGetName($pid)
Local $nFolder = $name = 'explorer.exe'
Switch $nFolder
Case 1
MsgBox(64, 'Information', 'It is a Folder')
Case Else
MsgBox(16, 'Error', 'It is not a Folder')
EndSwitch
Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

This should do the work

#include
If WinGetTitle('[active]')='' Then Exit MsgBox(16, 'Error', 'It is Desktop possibly')
Local $pid = WinGetProcess("[active]", "")
Local $name = _ProcessGetName($pid)
Local $nFolder = $name = 'explorer.exe'
Switch $nFolder
Case 1
MsgBox(64, 'Information', 'It is a Folder')
Case Else
MsgBox(16, 'Error', 'It is not a Folder')
EndSwitch

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...