Jump to content
Sign in to follow this  
magician13134

Start button

Recommended Posts

PaulIA

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

Share this post


Link to post
Share on other sites
Paulie

What's the class name or handle, or whatever...

Well which is it?

Classname, handle, or whatever?

Share this post


Link to post
Share on other sites
magician13134

Hmmm... I can't find the "Edit" button... Is something wrong, or am I just that dumb? How do I use the name "button"? Like... if I were to get the position of the start button... how would I do that using "button"? And where does that AutoIt Window Info tool live?

Thanks

Share this post


Link to post
Share on other sites
BigDod

And where does that AutoIt Window Info tool live?

Start>>All Programs>>Autoit v3


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
magician13134

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

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
magician13134

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

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
magician13134

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

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.