Jump to content

Recommended Posts

Posted

What's the class name or handle, or whatever for the start button?

Using the AutoIt Window Info tool that comes with AutoIt reveals that the Start button class name is "Button".
Auto3Lib: A library of over 1200 functions for AutoIt
Posted

And where does that AutoIt Window Info tool live?

Start>>All Programs>>Autoit v3


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

  • Moderators
Posted

Funny, I was able to pull the info:

Opt('WinTitleMatchMode', 4)
ControlClick('classname=Shell_TrayWnd', 'start', 'Button1')

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.

  • Moderators
Posted

That gives me an error...

Opt("WinTitleMatchMode", 4) 
$size = WinGetPos("classname=Shell_TrayWnd", "start", "Button1")
MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])

What exactly does your code do... it didn't do anything...

2 problems with your code...

1. Did you bother to check the parameters of WinGetPos? ;) (Maybe ControlGetPos())?

2. You don't error check to make sure it's an array.

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)

2 problems with your code...

1. Did you bother to check the parameters of WinGetPos? ;) (Maybe ControlGetPos())?

2. You don't error check to make sure it's an array.

Yeah... I saw that, that's why I deleted it... I never tried to use an array in your code...

Oh, and ControlGetPos still returns 0

Edited by magician13134
  • Moderators
Posted (edited)

Are you trying to do the Start button on your system tray?

Try this... I don't know what yours is called, but mine is called button1

$SC = _GetScreenCoords()
If IsArray($SC) Then MouseClick('primary', Random($SC[0], $SC[2], 1), Random($SC[1], $SC[3], 1), 1, 1)

Func _GetScreenCoords($sText = "classname=Shell_TrayWnd")
    $OptWTMM = Opt("WinTitleMatchMode", 4)
    $aCPos = ControlGetPos($sText, "", "Button1")
    $aWPos = WinGetPos($sText)
    If Not IsArray($aCPos) Or Not IsArray($aWPos) Then Return SetError(1, 0, 0)
    Local $aReturn[4] = [$aWPos[0] + $aCPos[0], $aWPos[1] + $aCPos[1] + 4, _
        $aCPos[2] - 4, $aWPos[1] + $aCPos[1] + 4 + $aCPos[3]]
    Opt('WinTitleMatchMode', $OptWTMM)
    Return $aReturn
EndFunc

I really have no idea what you are trying to do, but the above will return screen coordinates for the start button in your system tray (at least if my math is right it will).

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

Are you trying to do the Start button on your system tray?

Try this... I don't know what yours is called, but mine is called button1

$SC = _GetScreenCoords()
If IsArray($SC) Then MouseClick('primary', Random($SC[0], $SC[2], 1), Random($SC[1], $SC[3], 1), 1, 1)

Func _GetScreenCoords($sText = "classname=Shell_TrayWnd")
    $OptWTMM = Opt("WinTitleMatchMode", 4)
    $aCPos = ControlGetPos($sText, "", "Button1")
    $aWPos = WinGetPos($sText)
    If Not IsArray($aCPos) Or Not IsArray($aWPos) Then Return SetError(1, 0, 0)
    Local $aReturn[4] = [$aWPos[0] + $aCPos[0], $aWPos[1] + $aCPos[1] + 4, _
        $aCPos[2] - 4, $aWPos[1] + $aCPos[1] + 4 + $aCPos[3]]
    Opt('WinTitleMatchMode', $OptWTMM)
    Return $aReturn
EndFunc

I really have no idea what you are trying to do, but the above will return screen coordinates for the start button in your system tray (at least if my math is right it will).

Well, yeah, that does click it... but... what I wanted to do was more like this:

http://www.rjlsoftware.com/software/entertainment/avoid/

I'm trying to rewrite everyone of their software programs, just as a personal challenge....

  • Moderators
Posted (edited)

Well, yeah, that does click it... but... what I wanted to do was more like this:

http://www.rjlsoftware.com/software/entertainment/avoid/

I'm trying to rewrite everyone of their software programs, just as a personal challenge....

Ok, I thought you might be up to something like that... my function will return the coords, now it's your job to do something else with it... we did something like this in the scripts and scraps forum a while back.

Edit:

http://www.autoitscript.com/forum/index.php?showtopic=30838

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.

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
  • Recently Browsing   0 members

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