Jump to content

mrwizardd

Members
  • Posts

    11
  • Joined

  • Last visited

Recent Profile Visitors

49 profile views

mrwizardd's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Junkew, thanks for the response and efforts Here is the info for the button: And just for reference, this is what it looks like on the Java GUI:
  2. That's one of the first things I did. I tried variations of the control type ID, too. I may have to go with another automation program for java if I'm having this much trouble just getting a click to work. Do you have any suggestions?
  3. Thanks for the reply junkew! This is what I got: uia_action("name:=General;controltype=...","click") ^ ERROR >Exit code: 1 Time: 0.5932 I have #include "UIAWrappers.au3" at the top, so not sure why it's not recognizing.
  4. Quick and easy question. Your guys' knowledge of Autoit is far beyond my own. I'm just looking to do something simple. I have an Java Application called HP Service Manager and I need to automate a few things with it. The SimpleSpy tool is getting information from all the different buttons and links, which is something standard Autoit hasn't done. I'm simply trying to send a ControlClick to the button I'm seeing, but can't seem to get the context right. I think once I have that down I'll be able to figure most of the rest on my own. Here's the info I get from the button: After all my researching and reading through most of this thread, this is what I've come up with: #include <GuiEdit.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include "UIAWrappers.au3" #include <Misc.au3> #include <Constants.au3> #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 #ce ---------------------------------------------------------------------------- #AutoIt3Wrapper_UseX64=Y WinActivate("HPSM Overlay v2") ControlClick("General", "", "controltype [UIA_HyperlinkControlTypeId]") So I can obviously get it to activate the window, but it won't click the button. However, Autoit does not error or see a problem with the command. I've also tried putting a x. before it as well (for Autoitx), no dice with that. I realize this is super simple, I apologize, but I have researched. And I am still learning the ins and outs of Autoit. Much appreciated Junkew!
  5. But the window may not always be in the same place. Certain line items may move or the constraints may change
  6. That would actually work great if I could actually get it to click the button being seen by simplespy. I may have to try and message Junkew about how to use that stuff.
  7. AU3Info is not recognizing any of the Java buttons, just the window. From what I understand, native Autoit does not support Java buttons and controls. But using that script above, it can identify them. May need some of the files I originally downloaded first. See Junkew put together something that will allow Autoit to send commands to them inside the Java App. I tried your suggestions, thank you, but no dice
  8. Having trouble finding that original post where a guy made it and required a .jar file and some .au3's in the "Include" folder. But here is the script: (EDIT: Found it! '?do=embed' frameborder='0' data-embedContent>> ) #include <GuiEdit.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include "UIAWrappers.au3" #include <Misc.au3> AutoItSetOption("MustDeclareVars", 1) #AutoIt3Wrapper_UseX64=Y ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os dim $oldUIElement ; To keep track of latest referenced element dim $Form1, $Edit1, $label1, $label2, $msg, $x, $y, $oUIElement, $oTW, $objParent, $oldElement, $text1, $t ;~ Some references for reading ;~ [url=http://support.microsoft.com/kb/138518/nl]http://support.microsoft.com/kb/138518/nl[/url] tagpoint structures attention point ;~ [url=http://www.autoitscript.com/forum/topic/128406-interface-autoitobject-iuiautomation/]http://www.autoitscript.com/forum/topic/128406-interface-autoitobject-iuiautomation/[/url] ;~ [url=http://msdn.microsoft.com/en-us/library/windows/desktop/ff625914(v=vs.85).aspx]http://msdn.microsoft.com/en-us/library/windows/desktop/ff625914(v=vs.85).aspx[/url] HotKeySet("{ESC}", "Close") ; Set ESC as a hotkey to exit the script. HotKeySet("^w", "GetElementInfo") ; Set Hotkey Ctrl+M to get some basic information in the GUI #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 1024, 768, 192, 124) $Edit1 = GUICtrlCreateEdit("", 10, 10, 600, 700) ;~ $Edit1 = GUICtrlCreateEdit("", 10, 10, 10, 10) $Label1 = GUICtrlCreateLabel("Ctrl+W to capture information", 640,10,600,25) $Label2 = GUICtrlCreateLabel("Escape to exit", 640,45,600,25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### _UIA_Init() ; Run the GUI until the dialog is closed While true $msg = GUIGetMsg() sleep(100) ;~ if _ispressed(01) Then ;~ getelementinfo() ;~ endif If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func GetElementInfo() Local $hWnd Local $tStruct = DllStructCreate($tagPOINT) ; Create a structure that defines the point to be checked. ;~ Local $tStruct = DllStructCreate("INT64,INT64") ;~ Local $tStruct =_AutoItObject_DllStructCreate($tagPoint) ToolTip("") Global $UIA_oUIAutomation ;The main library core CUI automation reference Global $UIA_oDesktop, $UIA_pDesktop ;Desktop will be frequently the starting point Global $UIA_oUIElement, $UIA_pUIElement ;Used frequently to get an element Global $UIA_oTW, $UIA_pTW ;Generic treewalker which is allways available $x=MouseGetPos(0) $y=MouseGetPos(1) DllStructSetData($tStruct, "x", $x) DllStructSetData($tStruct, "y", $y) consolewrite(DllStructGetData($tStruct,"x") & DllStructGetData($tStruct,"y")) ;~ consolewrite("Mouse position is retrieved " & @crlf) $UIA_oUIAutomation.ElementFromPoint($tStruct,$UIA_pUIElement ) ;~ $objUIAutomation.ElementFromPoint(DllStructGetPtr($tStruct),$pUIElement) ;~ consolewrite("Element from point is passed, trying to convert to object ") $oUIElement = objcreateinterface($UIA_pUIElement,$sIID_IUIAutomationElement, $dtagIUIAutomationElement) $UIA_oUIAutomation.RawViewWalker($UIA_pTW) $oTW=ObjCreateInterface($UIA_pTW, $sIID_IUIAutomationTreeWalker, $dtagIUIAutomationTreeWalker) If IsObj($oTW) = 0 Then msgbox(1,"UI automation treewalker failed", "UI Automation failed failed",10) EndIf local $parentHandle $oTW.getparentelement($oUIElement,$parentHandle) $objParent=objcreateinterface($parentHandle,$sIID_IUIAutomationElement, $dtagIUIAutomationElement) If IsObj($objParent) = 0 Then msgbox(1,"No parent", "UI Automation failed failed",10) EndIf if isobj($oldUIElement) Then if $oldUIElement=$oUIElement then return endif endif _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) ; Clears Red outline graphics. GUICtrlSetData($Edit1, "Mouse position is retrieved " & $x & "-" & $y & @CRLF) $oldElement=$oUIElement If IsObj($oUIElement) Then ;~ ConsoleWrite("At least we have an element " & "[" & _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId) & "][" & _UIA_getPropertyValue($oUIElement, $UIA_ClassNamePropertyId) & "]" & @CRLF) GUICtrlSetData($Edit1, "At least we have an element " & "[" & _UIA_getPropertyValue($oUIElement, $UIA_NamePropertyId) & "][" & _UIA_getPropertyValue($oUIElement, $UIA_ClassNamePropertyId) & "]" & @CRLF,1) $text1="Title is: <" & _UIA_getPropertyValue($oUIElement,$UIA_NamePropertyId) & ">" & @TAB _ & "Class := <" & _UIA_getPropertyValue($oUIElement,$uia_classnamepropertyid) & ">" & @TAB _ & "controltype:= " _ & "<" & _UIA_getControlName(_UIA_getPropertyValue($oUIElement,$UIA_ControlTypePropertyId)) & ">" & @TAB _ & ",<" & _UIA_getPropertyValue($oUIElement,$UIA_ControlTypePropertyId) & ">" & @TAB _ & ", (" & hex(_UIA_getPropertyValue($oUIElement,$UIA_ControlTypePropertyId)) & ")" & @TAB & @CRLF $text1=$text1 & "*** Parent Information ***" & @CRLF $text1=$Text1 & "Title is: <" & _UIA_getPropertyValue($objParent,$UIA_NamePropertyId) & ">" & @TAB _ & "Class := <" & _UIA_getPropertyValue($objParent,$uia_classnamepropertyid) & ">" & @TAB _ & "controltype:= " _ & "<" & _UIA_getControlName(_UIA_getPropertyValue($objParent,$UIA_ControlTypePropertyId)) & ">" & @TAB _ & ",<" & _UIA_getPropertyValue($objParent,$UIA_ControlTypePropertyId) & ">" & @TAB _ & ", (" & hex(_UIA_getPropertyValue($objParent,$UIA_ControlTypePropertyId)) & ")" & @TAB & @CRLF $text1=$text1 & "*** Detailed properties of the highlighted element ***" $text1= $text1 & @CRLF & _UIA_getAllPropertyValues($oUIElement) GUICtrlSetData($Edit1, "Having the following values for all properties: " & @crlf & $text1 & @CRLF, 1) _GUICtrlEdit_LineScroll($Edit1, 0, 0 - _GUICtrlEdit_GetLineCount($Edit1)) $t=stringsplit(_UIA_getPropertyValue($oUIElement, $UIA_BoundingRectanglePropertyId),";") _UIA_DrawRect($t[1],$t[3]+$t[1],$t[2],$t[4]+$t[2]) EndIf EndFunc ;==>Example Func Close() Exit EndFunc ;==>Close
  9. My situation: I'm trying to automate ticket management software called HP Service Manager that's made in Java. I'm on Windows 7 64 bit and the application is 32 bit. Here's a screenshot of the Application: We often have Emails (first, second, and third notifications) that need to be send out to users about their computers coming in, or that we received a ticket in their name and for them to stop by so we can work on it. I have a little experience with Autoit. Definitely never made anything pretty but I could get some simple keyboard key and mouse clicking down when it was needed. That's essentially what I'm trying to do here, so it doesn't need to be pretty, just functional. What I'm having trouble with: I'm having a bit of trouble getting started with this. I'm using the SimpleSpy.au3 to get info from the button I need to click in HPSM. Here's the info I get: I know I must be not doing something very basic to get this to work. When I run my script below, the window will activate and I won't get any errors from Autoit, but it won't actually click this button. #include <GuiEdit.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include "UIAWrappers.au3" #include <Misc.au3> #include <Constants.au3> #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 #ce ---------------------------------------------------------------------------- #AutoIt3Wrapper_UseX64=Y WinActivate("HPSM Overlay v2") ControlClick("General", "", "controltype [UIA_HyperlinkControlTypeId]") I've tried adding the x. before it as well. With that I get an error that Autoit doesn't recognize "x." What am I doing wrong? What would be the correct way to script it to simply click the button? I think once I get something as simple as this down I can get the rest of what I'm hoping to do. If you might have links to basic examples of automating a java app that would be greatly appreciated too! Thanks folks.
  10. Hey folks, my brains fried. i've been stuck at this line of code for a couple hours now. I've done Google searches, forum searches, etc.. I'm making no progress and I feel like I've tried every variation of the code possible. It's a simple program to open a 3d application I'm working on so I can Log in. $default_resolutionX = 1920 $default_resolutionY = 1080 $x_ratio = @Desktopwidth / $default_resolutionX $y_ratio = @Desktopheight / $default_resolutionY Run ("C:\Program Files (x86)\3dMax\Projects\Project1.exe") Do $Pixel2 = PixelSearch(0,0,(1113 * $x_ratio),(616 * $y_ratio),0xF6F8FC,3) Until @error Then If not @error Then MouseClick("left", Round(1113 * $x_ratio),Round(616 * $y_ratio)) Endif Do $Pixel3 = PixelSearch(0,0,(1113 * $x_ratio),(616 * $y_ratio),0xF6F8FC,3) Until @error Then Do $Pixel4 = PixelSearch(0,0,(959 * $x_ratio),(356 * $y_ratio),0xEF571D,3) Until @error Then Etc.. I realize this is grossly incorrect, but I re-did the coding that would make sense to me. Hopefully you can see my way of thinking and help explain how I'm getting everything wrong here. Having a hard time figuring out how to continue off of "Until @error" because it seems to just stop when it becomes true, instead of wanting to use the "Then" request. It basically needs to search for the launch button with the distinct red color at those coords, when it appears, clicks it, then starts searching for the next pixel, clicks a certain point on the screen, etc... Thanks folks. Once I grasp this, should be smooth sailing. This is my first Autoit program, coming from DOS batch files.
  11. Hey folks, my brains fried. i've been stuck at this line of code for a couple hours now. I've done Google searches, forum searches, etc.. I'm making no progress and I feel like I've tried every variation of the code possible. It's a simple program to open D3 so I can Log in. $default_resolutionX = 1920 $default_resolutionY = 1080 $x_ratio = @Desktopwidth / $default_resolutionX $y_ratio = @Desktopheight / $default_resolutionY Run ("C:Program Files (x86)Diablo IIIDiablo III Launcher.exe") Do $Pixel2 = PixelSearch(0,0,(1113 * $x_ratio),(616 * $y_ratio),0xF6F8FC,3) Until @error Then If not @error Then MouseClick("left", Round(1113 * $x_ratio),Round(616 * $y_ratio)) Endif Do $Pixel3 = PixelSearch(0,0,(1113 * $x_ratio),(616 * $y_ratio),0xF6F8FC,3) Until @error Then Do $Pixel4 = PixelSearch(0,0,(959 * $x_ratio),(356 * $y_ratio),0xEF571D,3) Until @error Then Etc.. I realize this is grossly incorrect, but I re-did the coding that would make sense to me. Hopefully you can see my way of thinking and help explain how I'm getting everything wrong here. Having a hard time figuring out how to continue off of "Until @error" because it seems to just stop when it becomes true, instead of wanting to use the "Then" request. It basically needs to search for the launch button with the distinct red color at those coords, when it appears, clicks it, then starts searching for the next pixel, clicks a certain point on the screen, etc... Thanks folks. Once I grasp this, should be smooth sailing. This is my first Autoit program, coming from DOS batch files.
×
×
  • Create New...