Moderators SmOke_N Posted May 31, 2006 Moderators Share Posted May 31, 2006 I would just use the ClassNameNNMsgBox(0, '', _GetFileInUse()) Func _GetFileInUse() $OptWindowMode = Opt('WinTitleMatchMode', 4) Local $WinClass = 'classname=ExploreWClass' Local $FileInUse = ControlGetText($WinClass, '', 'Edit1') Opt('WinTitleMatchMode', $OptWindowMode) Return $FileInUse 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...
Don N Posted May 31, 2006 Share Posted May 31, 2006 Smoke_m's idea is more generic so id look at using his solution. _____________________________________________________"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...
Framed 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.I am completely new to autoit and desktop programming in general (I'm a webdeveloper). Could I ask where you obtain the control id of objects in windows? Link to comment Share on other sites More sharing options...
Valuater Posted May 31, 2006 Share Posted May 31, 2006 Autoit window Info on your computer.. press... Start > All Programs > Autoit v3 > Autoit Window Info 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 31, 2006 Moderators Share Posted May 31, 2006 (edited) I am completely new to autoit and desktop programming in general (I'm a webdeveloper). Could I ask where you obtain the control id of objects in windows?If you are going to be doing Browser options you will need to look at IE.au3and you can find the IE.au3 Help File hereAs for how we find ControlID's in other applications, we use the AutoIt Window Info ToolStart >> All Programs >> AutoItv3 >>Edit:Tad slow to the Valanizer! Edited May 31, 2006 by SmOke_N 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 (edited) I would just use the ClassNameNNMsgBox(0, '', _GetFileInUse()) Func _GetFileInUse() $OptWindowMode = Opt('WinTitleMatchMode', 4) Local $WinClass = 'classname=ExploreWClass' Local $FileInUse = ControlGetText($WinClass, '', 'Edit1') Opt('WinTitleMatchMode', $OptWindowMode) Return $FileInUse EndFunc But where do I put this code ? Tuk Edited May 31, 2006 by Tukata Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 31, 2006 Moderators Share Posted May 31, 2006 But where do I put this code ? TukI can think of a few places It returns a value, so you put the UDF anywhere and use it like: If StringInStr(_GetFileInUse(), @HomeDrive & '\') Then MsgBox(64, 'Info:', 'Found') Func _GetFileInUse() $OptWindowMode = Opt('WinTitleMatchMode', 4) Local $WinClass = 'classname=ExploreWClass' Local $FileInUse = ControlGetText($WinClass, '', 'Edit1') Opt('WinTitleMatchMode', $OptWindowMode) Return $FileInUse 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...
Killer Posted June 12, 2006 Share Posted June 12, 2006 I can think of a few places It returns a value, so you put the UDF anywhere and use it like: If StringInStr(_GetFileInUse(), @HomeDrive & '\') Then MsgBox(64, 'Info:', 'Found') Func _GetFileInUse() $OptWindowMode = Opt('WinTitleMatchMode', 4) Local $WinClass = 'classname=ExploreWClass' Local $FileInUse = ControlGetText($WinClass, '', 'Edit1') Opt('WinTitleMatchMode', $OptWindowMode) Return $FileInUse EndFunc This code to use classname doesn't work at all. Is this the whole code or just partial? Link to comment Share on other sites More sharing options...
GaryFrost Posted June 12, 2006 Share Posted June 12, 2006 works for me in the release and beta version if you want to be a little more precise in what is open try something like If StringUpper(_GetFileInUse()) = StringUpper(@HomeDrive & '\') Then MsgBox(64, 'Info:', 'Found') SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference.  Link to comment Share on other sites More sharing options...
Killer Posted June 12, 2006 Share Posted June 12, 2006 I am using beta. It doesn't work. Once I run the script it will load and exit itself. Link to comment Share on other sites More sharing options...
GaryFrost Posted June 12, 2006 Share Posted June 12, 2006 Try: If IsEqual(_GetFileInUse(),@HomeDrive & '\') Then MsgBox(64, 'Info:', 'Found') Else MsgBox(64, 'Info:', 'Not Found') EndIf Func _GetFileInUse() $OptWindowMode = Opt('WinTitleMatchMode', 4) Local $WinClass = 'classname=ExploreWClass' Local $FileInUse = ControlGetText($WinClass, '', 'Edit1') Opt('WinTitleMatchMode', $OptWindowMode) Return $FileInUse EndFunc Func IsEqual($s_first, $s_second) If StringUpper($s_first) = StringUpper($s_second) Then Return 1 Return 0 EndFunc SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference.  Link to comment Share on other sites More sharing options...
Killer Posted June 12, 2006 Share Posted June 12, 2006 I see why it exit. The folder wasn't found so it exited. But then it seems that it can't find my @HomeDrive or even c:\ which I changed it. It would just load and say not found. Link to comment Share on other sites More sharing options...
BrianH Posted June 12, 2006 Share Posted June 12, 2006 I see why it exit. The folder wasn't found so it exited. But then it seems that it can't find my @HomeDrive or even c:\ which I changed it. It would just load and say not found.Perhaps you had opened the drive in a window rather than an explorer. Try this modified code... $explore='ExploreWClass' $window='CabinetWClass' $lookfor=@HomeDrive & '\' If IsEqual(_GetFileInUse($explore),$lookfor) Then MsgBox(64, 'Info:', 'Found explorer '&$lookfor) ElseIf IsEqual(_GetFileInUse($window),$lookfor) Then MsgBox(64, 'Info:', 'Found window'&$lookfor) Else MsgBox(64, 'Info:', 'Not Found '&$lookfor) EndIf Func _GetFileInUse($class) $OptWindowMode = Opt('WinTitleMatchMode', 4) Local $WinClass = 'classname='&$class Local $FileInUse = ControlGetText($WinClass, '', 'Edit1') Opt('WinTitleMatchMode', $OptWindowMode) Return $FileInUse EndFunc Func IsEqual($s_first, $s_second) If StringUpper($s_first) = StringUpper($s_second) Then Return 1 Return 0 EndFunc Link to comment Share on other sites More sharing options...
Killer Posted June 12, 2006 Share Posted June 12, 2006 Thanks for your patience. I think I know the logic here. I will need to put in a loop and try to see. 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