Jump to content

Recommended Posts

  • Moderators
Posted

I would just use the ClassNameNN

MsgBox(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.

Posted

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

Posted

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?

  • Moderators
Posted (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.au3

and you can find the IE.au3 Help File here

As for how we find ControlID's in other applications, we use the AutoIt Window Info Tool

Start >> All Programs >> AutoItv3 >>

Edit:

Tad slow to the Valanizer!

Edited 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.

Posted (edited)

I would just use the ClassNameNN

MsgBox(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 by Tukata
  • Moderators
Posted

But where do I put this code ?

Tuk

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

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.

  • 2 weeks later...
Posted

I can think of a few places :D

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?

Posted

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.

 

Posted

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.

Posted

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

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
×
×
  • Create New...