johnmcloud Posted September 21, 2012 Share Posted September 21, 2012 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 More sharing options...
johnmcloud Posted September 21, 2012 Author Share Posted September 21, 2012 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? Link to comment Share on other sites More sharing options...
PlayHD Posted September 21, 2012 Share Posted September 21, 2012 (edited) 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 September 21, 2012 by PlayHD My UDF : _WinShake, _WinSplitMy Apps : Google Guitar Bot, PuzzleGameDesign Gui : Interesting Tabs Design, RBox Project (abandoned), Animated Gui on Exit Link to comment Share on other sites More sharing options...
johnmcloud Posted September 21, 2012 Author Share Posted September 21, 2012 So want is the unique class for folder only? Link to comment Share on other sites More sharing options...
PlayHD Posted September 21, 2012 Share Posted September 21, 2012 Here is the class list expandcollapse popupUIRibbonCommandBarDock 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 My UDF : _WinShake, _WinSplitMy Apps : Google Guitar Bot, PuzzleGameDesign Gui : Interesting Tabs Design, RBox Project (abandoned), Animated Gui on Exit Link to comment Share on other sites More sharing options...
PhoenixXL Posted September 21, 2012 Share Posted September 21, 2012 (edited) 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 September 21, 2012 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 More sharing options...
johnmcloud Posted September 22, 2012 Author Share Posted September 22, 2012 PhoneixXL, there is only one problem, say "It's folder" also on desktop...there is a way to exclude it? Link to comment Share on other sites More sharing options...
PhoenixXL Posted September 22, 2012 Share Posted September 22, 2012 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now