Tukata Posted May 18, 2006 Share Posted May 18, 2006 (edited) I need a script to give me a message each time when user opens a certain folder ($FolderPath) with explorer. Many thanks in advance Tuk Edited May 18, 2006 by Tukata Link to comment Share on other sites More sharing options...
Valuater Posted May 18, 2006 Share Posted May 18, 2006 (edited) #include <GUIConstants.au3> Run("explorer.exe " & @ProgramFilesDir) WinWaitActive("") Sleep(5000) While 1 If WinActive("Program Files") Then MsgBox(0,"Found", "The window is active", 2) Sleep(15000) WEnd .... I need a Million Dollars (US) 8) Edited May 18, 2006 by Valuater Link to comment Share on other sites More sharing options...
nitro322 Posted May 18, 2006 Share Posted May 18, 2006 I need a Million Dollars (US)Here you go:One Million DollarsYou earned it :-) http://www.legroom.net/ Link to comment Share on other sites More sharing options...
Valuater Posted May 18, 2006 Share Posted May 18, 2006 nice pic nitro... BTW.... can you deliver that??? lol 8) Link to comment Share on other sites More sharing options...
Tukata Posted May 19, 2006 Author Share Posted May 19, 2006 Valuater Your script simply opens C:\Program Files. What I need is to run a loop and every time I open any folder, to get a message which tells me which folder I opened. Thanks Tuk Link to comment Share on other sites More sharing options...
Valuater Posted May 19, 2006 Share Posted May 19, 2006 (edited) Valuater Your script simply opens C:\Program Files. What I need is to run a loop and every time I open any folder, to get a message which tells me which folder I opened. Thanks Tuk do i have to hold your friggin hand #include <GUIConstants.au3> $folder = FileSelectFolder("Choose a folder.", "") Run("explorer.exe " & $folder) WinWaitActive("") $window = WinGetTitle("") Sleep(5000) While 1 If WinActive($window) Then MsgBox(0,"Found", "The window is active" & @CRLF & $window, 2) Sleep(15000) WEnd like some fries with that???? 8) Edited May 19, 2006 by Valuater Link to comment Share on other sites More sharing options...
slightly_abnormal Posted May 19, 2006 Share Posted May 19, 2006 Do they come with a toy? Link to comment Share on other sites More sharing options...
Valuater Posted May 19, 2006 Share Posted May 19, 2006 Do they come with a toy?LMAO..... 8) Link to comment Share on other sites More sharing options...
Tukata Posted May 21, 2006 Author Share Posted May 21, 2006 Well...either I don't understand the script or this is not what i need. I have $folder="C:\Folder" and I want to run a script that will detect each time when $folder is opened. Thanks Tuk Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 21, 2006 Moderators Share Posted May 21, 2006 Try this:While 1 $OpenExplorer = _GetOpenExplorer() If $OpenExplorer Then MsgBox(64, 'Info', $OpenExplorer) Sleep(10) WEnd Func _GetOpenExplorer() $OptTitleMode = Opt('WinTitleMatchMode', 4) Local $ExplorerTitle1 = WinGetTitle('Classname=ExploreWClass') ;Local $ExplorerTitle2 = WinGetTitle('Classname=CabinetWClass'); Check to see if this one is needed If WinExists($ExplorerTitle1) Then;Or WinExists($ExplorerTitle2) Then; Uncomment this line and the above if you want to use CabinetWClass also Opt('WinTitleMatchMode', $OptTitleMode) Return $ExplorerTitle1 EndIf Opt('WinTitleMatchMode', $OptTitleMode) Return 0 EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jvanegmond Posted May 21, 2006 Share Posted May 21, 2006 Try this:While 1 $OpenExplorer = _GetOpenExplorer() If $OpenExplorer Then MsgBox(64, 'Info', $OpenExplorer) Sleep(10) WEnd Func _GetOpenExplorer() $OptTitleMode = Opt('WinTitleMatchMode', 4) Local $ExplorerTitle1 = WinGetTitle('Classname=ExploreWClass') ;Local $ExplorerTitle2 = WinGetTitle('Classname=CabinetWClass'); Check to see if this one is needed If WinExists($ExplorerTitle1) Then;Or WinExists($ExplorerTitle2) Then; Uncomment this line and the above if you want to use CabinetWClass also Opt('WinTitleMatchMode', $OptTitleMode) Return $ExplorerTitle1 EndIf Opt('WinTitleMatchMode', $OptTitleMode) Return 0 EndFunc It does come with a toy! github.com/jvanegmond Link to comment Share on other sites More sharing options...
Tukata Posted May 31, 2006 Author Share Posted May 31, 2006 While 1 $OpenExplorer = _GetOpenExplorer() If $OpenExplorer Then MsgBox(64, 'Info', $OpenExplorer) Sleep(1000) WEnd Func _GetOpenExplorer() $OptTitleMode = Opt('WinTitleMatchMode', 4) Local $ExplorerTitle2 = WinGetTitle('Classname=CabinetWClass') If WinExists($ExplorerTitle2) Then Opt('WinTitleMatchMode', $OptTitleMode) Return $ExplorerTitle2 EndIf Opt('WinTitleMatchMode', $OptTitleMode) Return 0 EndFunc This code works but it detect any folder opened. I need to detect only a specific folder: C:\Folder Where do I add this ? Thank you Tuk Link to comment Share on other sites More sharing options...
Valuater Posted May 31, 2006 Share Posted May 31, 2006 If $OpenExplorer = "C:\Folder" Then MsgBox(64, 'Info', $OpenExplorer) 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 31, 2006 Moderators Share Posted May 31, 2006 If it's a specific file then do what Val has shown, if it is the folder specific, with other files inside, and you want any and all of them, you might try:If StringInStr($OpenExplorer, 'C:\Folder') Then MsgBox(64, 'Info', $OpenExplorer) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Tukata Posted May 31, 2006 Author Share Posted May 31, 2006 I must be doing something wrong. Here are your both options as I used them but didn't work. Please help, thank you. While 1 $OpenExplorer = _GetOpenExplorer() If $OpenExplorer = "C:\Folder" Then MsgBox(64, 'Info', $OpenExplorer) Sleep(1000) WEnd Func _GetOpenExplorer() $OptTitleMode = Opt('WinTitleMatchMode', 4) Local $ExplorerTitle2 = WinGetTitle('Classname=CabinetWClass') If WinExists($ExplorerTitle2) Then Opt('WinTitleMatchMode', $OptTitleMode) Return $ExplorerTitle2 EndIf Opt('WinTitleMatchMode', $OptTitleMode) Return 0 EndFunc While 1 $OpenExplorer = _GetOpenExplorer() If StringInStr($OpenExplorer, 'C:\Folder') Then MsgBox(64, 'Info', $OpenExplorer) Sleep(1000) WEnd Func _GetOpenExplorer() $OptTitleMode = Opt('WinTitleMatchMode', 4) Local $ExplorerTitle2 = WinGetTitle('Classname=CabinetWClass') If WinExists($ExplorerTitle2) Then Opt('WinTitleMatchMode', $OptTitleMode) Return $ExplorerTitle2 EndIf Opt('WinTitleMatchMode', $OptTitleMode) Return 0 EndFunc Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 31, 2006 Moderators Share Posted May 31, 2006 Ahh, your not going to get the directory name in that, it's simply picking up the title of the window, if the title of the window doesn't show the directory it is in, you won't get it. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Tukata Posted May 31, 2006 Author Share Posted May 31, 2006 Is that means I can't detect when user opens "C:\Folder" ? Thank you Tuk Link to comment Share on other sites More sharing options...
Don N Posted May 31, 2006 Share Posted May 31, 2006 (edited) HotKeySet( "{Esc}", "exit_now" ) $folder = "C:\" While 1 If ControlGetText( "", "", 41477 ) = $folder Then MsgBox( 0, "ALERT", "Folder opened!" ) EndIf Sleep( 250 ) WEnd Func exit_now() Exit EndFunc This code works for me. You might have to change 41477 to a dif control ID. Open my computer and launch the AutoItInfo Tool and get the control id of the edit field where it says my computer. Edited May 31, 2006 by Don N _____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper Link to comment Share on other sites More sharing options...
Tukata Posted May 31, 2006 Author Share Posted May 31, 2006 (edited) Don N Yes ! Your code works perfect. I am not expert so can you explain this "41477 to a dif control ID" issue ? - Must I make the changes ? Will your script work on all OS ? Thank you very much Tuk Edited May 31, 2006 by Tukata Link to comment Share on other sites More sharing options...
Don N Posted May 31, 2006 Share Posted May 31, 2006 The 41477 is the control id of the edit box that displays your current folder location when browising folders on your computer. Not sure if it will work on all os's as i can only test it on my copy here which is Win 2k SP4. Should work on all windows relaeses with the fact that you might have to change the contorl id, but other than that it is compatible with all windows releases. This is what im talking about:http://www.autoitscript.com/fileman/users/newLogic/control%20id%20example.gifHope that helps! _____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper 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