Jump to content

Recommended Posts

Posted

Hello, I have a question. I have made a toolbar for another program, I would like to know how i would create the following behavior of the toolbar

1. When application/Window "TPS REPORT" is maximized, visible to the user, so is "Extras"

2. when application/window "TPS Report" is minimized so is "extras"

3. When application/window "TPS Report" is closed so is "Extras"

I would also like to know what I could do to make it so the Extras window is centered to TPS Report, but can be moved up and down, not side to side.

I plan to have the toolbar program start this application, the one i'm now looking to make.

Thanks,

Posted

This could be achieved with WinMove, WinGetState, and WinExist.

WinGetState, and WinExist for the First, Second, and Third behaviours, and WinMove for the centering behaviour..

Posted

Thanks, Perfect!

Would you know what I could do to make it so the bottom of my Extras window rests 30 pixals from the bottom of the screen?

Thanks

  • 3 weeks later...
  • Moderators
Posted (edited)

Thanks, Perfect!

Would you know what I could do to make it so the bottom of my Extras window rests 30 pixals from the bottom of the screen?

Thanks

When you say "30 pixels", I'm going to assume you want it on top of your toolbar. Mine is 60+ so I'd suggest maybe doing something like:
$hgui = GUICreate("")
GUISetState()
Sleep(2000)
_WinMoveToolBarTop($hgui);No 2nd param for current x position
Sleep(2000)
_WinMoveToolBarTop($hgui, 50)
Sleep(2000)

Func _WinMoveToolBarTop($hWnd, $nXCoord = False)
    Local $aWPos = WinGetPos($hWnd)
    Local $aCPos = ControlGetPos("[CLASS:Shell_TrayWnd]", "", "ToolbarWindow321")
    If IsArray($aWPos) = 0 OR IsArray($aCPos) = 0 Then Return SetError(1, 0, 0)
    If $nXCoord Then Return WinMove($hWnd, "", $nXCoord, (@DesktopHeight - $aWPos[3]) - ($aCpos[3] + 5))
    Return WinMove($hWnd, "", $aWPos[0], (@DesktopHeight - $aWPos[3]) - ($aCpos[3] + 5))
EndFunc
If I am in fact correct in my assumption. 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
×
×
  • Create New...