Jump to content

Start button


Recommended Posts

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

Link to comment
Share on other sites

Funny, I was able to pull the info:

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

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

And I don't think that worked... it returned a 0... which means it failed...

Edited by magician13134
Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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