Jump to content
Sign in to follow this  
wccppp

Question about using ANYGUI

Recommended Posts

Hello,

I tried to use ANYGUI to add a button to Adobe Acrobat Professional's toolbar, but could not get it to work. The trouble I'm having is to get the target window/control (the toolbar).

$Targetwindow = _GuiTarget($winhandle,"","AVToolBarView", $ControlID)

But the Adobe toolbar control does not have ID, based on AutoIt Window Info.

Anyone has a suggestion?

Thank you!

Share this post


Link to post
Share on other sites

Are there overlapping controls?

What is the output of WinGetClassList?

Thanks Skruge. There are no overlapping controls and this is the output of WinGetClassList:

AVEaselBarWindow

AVEaselBarWindow

AVEaselBarWindow

AVEaselBarWindow

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

Static

AVL_AVView

Edit

Static

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

Edit

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

MDIClient

AcrobatMDIChildWnd

AVL_AVView

AVL_AVView

AVL_AVView

Static

AVL_AVView

Static

msctls_progress32

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

Edit

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

Edit

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

Static

AVL_AVView

AVL_AVView

AVL_AVView

ScrollBar

ScrollBar

AVEaselBarWindow

AVEaselBarWindow

AVEaselBarWindow

AVEaselBarWindow

AVEaselBarWindow

AVEaselBarWindow

AVEaselBarWindow

AVEaselBarWindow

AVL_AVView

AVL_AVView

AVL_AVView

ATL:038BCD50

AtlAxWin71

Shell Embedding

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

AVL_AVView

ScrollBar

ScrollBar

AVL_AVView

Button

Share this post


Link to post
Share on other sites

Hmm... The closest match to a "toolbar" on that list sounds like "AVEaselBarWindow" and you have 12 of them.

ANYGUI expects either control ID's (handles) or coordinates, so you could try coordinates if the toolbar is in a predictable location.

Otherwise, test it with ControlGetHandle($winhandle,"", "AVEaselBarWindow1") and work your way to up "AVEaselBarWindow12" to see which control it's actually using.


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Otherwise, test it with ControlGetHandle($winhandle,"", "AVEaselBarWindow1") and work your way to up "AVEaselBarWindow12" to see which control it's actually using.

Thanks again Skruge! The ClassnameNN for the toolbar is AVEaselBarWindow4. This is output from AutoIt Window Info:

Class: AVEaselBarWindow

Instance: 4

ClassnameNN: AVEaselBarWindow4

ID:

Text:

Position: 0, 1

Size: 1280, 32

ControlClick Coords: 946, 16

Style: 0x52000000

ExStyle: 0x00000000

Handle: 0x00060738

But how do I use above information in the _GuiTarget function? I'm not clear about the last argument:

$controlid [optional] - "Targeted" Control in window **OR** array containing x and y coords

Share this post


Link to post
Share on other sites

But how do I use above information in the _GuiTarget function? I'm not clear about the last argument:

$controlid [optional] - "Targeted" Control in window **OR** array containing x and y coords

It needs the handle of the toolbar control. I'm using $hToolbar in this example:
Opt("GUIOnEventMode", 1)

; Your existing code goes here... where you get $winhandle

$hToolbar = ControlGetHandle($winhandle, "", "AVEaselBarWindow4")
$hTarget = _GuiTarget($winhandle, 0, "", $hToolbar)
$hButton = _TargetaddButton("Your Button", 0, 0, 50, 25,"","",$hTarget) ; Change button text/coords/size
GUICtrlSetOnEvent($hButton[0], "_YourFunction") ; Assign a function
GUISetState(@SW_SHOW)

While WinExists($winhandle) ; Keep script alive as long as the app is open
    Sleep(100)
WEnd

Func _YourFunction()
    ; Execute this when button is pressed
EndFunc

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

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  

×
×
  • Create New...