Jump to content

cappy2112

Active Members
  • Posts

    168
  • Joined

  • Last visited

Everything posted by cappy2112

  1. Well, I don't see anything move other than tht Mouse Arrow pointer, it's just pivoting left & right, but only a small amount. My monitors are 24 inches wide, so the desktop size is probably 1980 & 1600 (or close to that). Are video attachments allowed? Can I attach a small video from my phone to show you? Noone has answered my question- What is supposed to move? The mouse arrow pointer, or the I-Beam cursor?
  2. So that I can see the movement. I know the coordinate unites are very small (in pixels ??), I wanted to verify that I could see some movement, so I repeated the same mousemove() call many times.
  3. Do you not see the two calls to MouseMove() with different x coordinates?
  4. Is MouseMove() supposed to move the Mouse pointer (the arrow) or the text cursor (the I beam) ? What units are the X & Y coordinates for the mouse ? When I run the following code (copied from the examples directory, and put into a loop) The mouse pointer just wiggles a very small amount. I can't seem to make it move from the right side of the screen to the left Local $loopCount = 0 Local $maxLoops = 10 While $loopCount < $maxLoops MouseMove(10, 100,0) ; Move the mouse cursor to the x, y position of 10, 100. Sleep(400) MouseMove(10000, 100, 0) ; Move the mouse cursor to the x, y position of 700, 700 and move instantly. $loopCount = $loopCount + 1 Sleep(400) WEnd Thanks
  5. Previous reply In the URL above, JLogan3013 posted some code to create a listview. This has been quite helpful. I've been trying to add a second column into the ListView, so that I can provide a mechanism for the user to paste in a path, for each of the items in the first column. See the attached screenshot of what I'm trying to do- using AutoIt. Column0 is contains a list of Windows found by WinList() Column1 will contain a path- that the user provides. I've been going back and forth between _GUICtrlListView_AddSubItem(), _GUICtrlListView_InsertColumn, and _GUICtrlListView_AddSubItem(), trying to get a second column, but it's not going well. The examples I've been reading in the AutoIt help file for those APIs (and others) did not do what I was expecting. My code is now a mess of comments, but it started as a working a example from JLogan3013. Which function should I use to add the second column? Func ShowListView($WindowList) Const $Centered = -1 Local $aList, $hGUI Local $HWinSize = 900 Local $VWinSize = 600 Local $ListboxColWidth Local $i Local $WindowCount If IsArray($WindowList) Then $hGUI = GUICreate("Window Instances", 900, 300, $Centered, $Centered) $ListboxColWidth = $HWinSize - 20 $hListView = GUICtrlCreateListView("", 10, 10, $ListboxColWidth, 200) _GUICtrlListView_SetColumnWidth($hListView, 1, $ListboxColWidth) ;_GUICtrlListView_InsertColumn($hListView, 2, "Column 1", 100) $btnDone = GUICtrlCreateButton("DONE", ($HWinSize / 2) - 20, 235, 55, 45) $WindowCount = $WindowList[0][0] GUICtrlCreateListViewItem($WindowList[1][0], $hListView) For $i = 1 To $WindowCount ;GUICtrlCreateListViewItem($hListView, $WindowList[$i][0],) _GUICtrlListView_AddItem($hListView, $WindowList[$i][0], $i) ;_GUICtrlListView_AddItem($idListview, "Row 1: Col 1", 0) ;_GUICtrlListView_AddSubItem($hListView, 0, "Z:\NetworkPath\Hawk5\KVM1", $i) Next If ($WindowCount > 1) Then EndIf GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") GUISetState(@SW_SHOW) While 1 $aTemp = _GUICtrlListView_GetItemTextArray($hListView) Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $btnDone If ($aTemp[0] = 0) Then _ArrayDisplay($aTemp) MsgBox($MB_OK, "", "Please select a window first") Else _ArrayDisplay($aTemp) MsgBox($MB_OK, "", "You selected " & $aTemp[1]) EndIf EndSwitch WEnd GUIDelete() Else MsgBox($MB_ICONWARNING, "IsArray()", "LIST VIEW is not an array") EndIf EndFunc ;==>ShowListView Func _WM_NOTIFY($nWnd, $iMsg = "", $wParam = "", $lParam = "") Local $tStruct = DllStructCreate("hwnd;uint_ptr;int_ptr;int;int", $lParam) If BitAND(DllStructGetData($tStruct, 3), 0xFFFFFFFF) = $NM_CLICK Then ; Code $hCurrListView = DllStructGetData($tStruct, 1) ; ListView handle EndIf EndFunc ;==>_WM_NOTIFY
  6. Thanks. StringReplace() requires that you know what the contents are. I am looking for a function to initialize the contents of an array to a known value. I know a for loop would work, and that I can easily wrap that in my own function, and pass in the array and the size. If that functionality can be replaced by a builtin function that is written in C (or C++, whichever language AutoIt is written in), that's what I would use.
  7. Thanks. I've found some of the examples in the Examples directory, and started with something very similar. I see your example handles the issue I was struggling with though, creating dynamic list entries on the fly. Your approach makes sense- I knew there has to be some way to do this, I was just looking for an example of a dynamic GUI. BTW- Does AutoIt have the equivalent (~workalike) of C's memset()? Thanks!!
  8. When I call Winlist(), the first entry in the array is typically between 500-600, and it obviously will fluctuate. However, I don't have that many programs working, so where are all of these windows? I know that many processes are running in the background, but having looked at Task Manager many times, I'd say that 100 or less processes are typically running. From the AutoIt Help file: Given that the term "Window" can mean different things to different people, I generally associate this with the "frame" of a top level Window, that is clearly visible, either maximized or minimized. I don't know how AutoIt defines 'Window" nor if it modifies the OS's definition of "Window". To some, Window could also refer to every Button and other clickable items visible, and if so, that could account for the numbers ff "Windows" being returned from WinList(). What are your thoughts on this...?
  9. I've used WinList() to give me a list of all the windows it finds on the system. I then search through that list to find a few windows which match a title string. Now I want to present that smaller list of Title/strings to the user, so that they can select ONE of them. Which widget would be best for this operation? Ideally, the widget should return the index of the item selected, and if possible only allow the user to select 1 item. I don't expect there will be more than 10 Windows running on the systems I'm working with. In all practicality, I've only seen 4 at the max. Thanks
  10. Thank you- that's what I was hoping for. The less I need to write, the better. BTW- What is the preferred directory to install the UDFs, so the compiler finds them without having to fiddle with the path?
  11. Thank you. The cobwebs are slowly melting ;-)
  12. ReDim $WindowsDupe[(UBound($AllWindows))  -1][2] Why? All of the examples I've seen- including in the help file, always show UBound(Array) +1. Isn't dimension [2] out of bounds, for a 2D array?? ReDim $WindowsDupe[$TitleMatchCount + 1][2] Please explain dimension [2], since this is a 2D array. Do array indices start at 0 or 1, in AutoIT?
  13. The MsgBox() function is fine if your messages are very short. What are the AutoI alternatives if you need to display larger messages? Is there a lager dialog available, or do I need to write something from scratch? Thanks
  14. Hi, It's been a while since I've used AutoIt, but I'm having fun with it again. I'm running on Windows 7 Pro, 64_bit. with AutoIt 3.3.14.2+ In my program, I've called Winlist(), so that I can get a list of all windows on the system. I then iterate through the titles, and attempt to copy the title & handle of Windows I'm specifically interested in. While this seems to be a very easy task, I'm having a strange problem copying the title & handle of the two windows that I'm interested in. In the For loop: For $i = 1 To $AllWindowsCount ConsoleWrite() displays the expected Title & handle, from the WindowsDupe array, so it appears that the copy from the $AllWindows array works as expected. However, when _ArrayDisplay($WindowsDupe) is called after the for loop, $WindowsDupe is empty. I wasn't able to find any functions in the help file, for copying entire arrays or certain elements, so I thought I would just copy them manually, as seen in the for loop. What am I doing wrong with the WindowsDupe array? Thanks Thanks My code is attached. ListWindows2.au3
  15. Regarding this http://www.autoitscript.com/forum/index.php?showtopic=112804&st=0&p=791628&fromsearch=1&#entry791628 As a last resort, I thought I would try the AURecorder. While this AuRecorder is able to automate the target application that I couldn't make work by using ControlSend() and MouseClick(), I'm concerned about using X-Y coordinates for automation. Do the coordinates captured by AURecorder depend on the screen position of the target GUI - relative to the desktop? If so, if the user moves the target application then the coordinates *may* not work. How many people use the output of the recorder to automate their GUIs?
  16. Hmm. According to the documentation, GUICtrlSetState() works with a Control ID returned from GuiCtrlCreate function. The GUI I'm trying to automate is not made with auto it. It was created by an external company, using Visual C/C++. Actually- I get a a compile error on GUICtrlSetState("[iD:1017]", $GUI_FOCUS) "$GUI_FOCUS possibly used before declaration."
  17. The click is not successful, because the control never gets highlighted, and the call to ControlClick() returns an error code. I will try to send the GUI_FOCUS first, then try clicking. I posted another message about this- I used Spy++ and I'm actually able to get the control ID AND the handle of the control with it. AutoIt WIndow Info can't get the control ID, however when I try the control ID in the code I originally posted, it still doesn't work. THanks
  18. >>Would have been nice to start from there to begin with Agreed. I will be more careful when pasting code in the future:oops: The nature of the app is: It is a control program for a piece of test equipment for an embedded storage device. Each "window" in the program talks to one tester over ethernet. The purpose of the software is to start and stop test programs, as well as download the test program to the tester. No flash, no java, no internet / web protocols. We dont have the source for the app, which is why I'm trying to automate it.
  19. I know what COM is- but try to avoid it at all costs. It's a pin to use, and quite often unreliable. My original message said nothing about com, I'm just trying to figure out if the info Spy++ is giving me can help me get autoit to find the controls. I haven't been able to find any of the controls in the app I'm trying to automate, using my autoit script. thanks
  20. I've been having problems getting AutoIt to automate an application. This is probably mostly due to my not having used AutoIt for several years. I've run Visual Studio's Spy ++ and it is able to access & highlight the same controls that I haven't been able to automate through AutoIt. AutoIt Window info won't show me the control ID for these controls, but Spy++ does. However, when I use the control ID from Spy++, I still can't "find the control" with AutoIt. Why is it that Spy++ can give me the control ID but AutoIt Window info can't? I can also get the actual handle of the control I'm trying to automate with Spy++. Is this of any use- from AutoIt??
  21. Copy & past works, I just didn't highlight everything correctly. It happens. If you think the script doesn't run, then how do you explain the script activating the target application? This proves the call to main executed, even though it wasn't visible due to my sloppy copy & paste. I've intentionally minimized the target application, so I would know that it was being activated by my script. _Main() Global $hnd Func _Main() Dim $hndBasher Dim $x $hnd= WinActivate("MyProgram") If $hnd= 0 Then MsgBox(0, "ACTIVATE TARGET APPLICATION WINDOW", "Could not find Target App Window") Else $x = ControlClick("MyProgram", "", "[ID:1017]") If $x = 0 Then MsgBox(0, "CONTROL CLICK", "Could not find Control") Else MsgBox(0, "CONTROL CLICK", "Control was found") EndIf EndIf EndFunc ;==>_Main The code above is complete, no sloppy copy & paste. The code above runs the same as what I pasted yesterday, however I've added this as confirmation that the script "thinks" the control was found Else MsgBox(0, "CONTROL CLICK", "Control was found") EndIf When I run the code above, I do see the message box display "Control was found". However, the target app doesn't respond the same as when I click the control with the mouse. When I click the target control with the mouse, it is highlighted. When the script above effectively clicks the target control, the control is not highlighted. I don't understand why. The forum editor has a problem- there is an Else which isn't appearing in the correct place, making the code look wierd. However, I've edited it 3 times, but the forum software isn't taking the changes- even though I've saved them. I've attached a screenshot as proof.
  22. I'm using AutoIt 3.3.6.0 on XP, SP3. I'll admit- it's been a few years since I've used autoit, so I may have forgotten some basics. I've used the Window Info tool to get the ID, text, and class names from some controls in the gui I'm trying to automate. The program I'm trying to automate has 16 boxes (small windows) in it, which display text status of tests that are running. When I click any of the 16 windows with the mouse, the frame of that small window gets highlighted, and buttons on the toolbar become enabled. These are two visual clues that let me know that a small window has been selected, and I should see the same results when my autoit script does the same. Here is my script. Global $hnd Func _Main() Dim $hnd Dim $x $hnd = WinActivate("MyProgram") If $hnd = 0 Then MsgBox(0, "ACTIVATE MyProgram WINDOW", "Could not find MyProgram Window") Else ;$x = ControlClick("MyProgram", "", "[CLASS:Static;INSTANCE:10]") ;$x = ControlFocus("MyProgram", "", 1226) ;$x = ControlClick("MyProgram", "", 1017) ; $x = ControlClick("MyProgram", "", "[ID:1017]") If $x = 0 Then MsgBox(0, "CONTROL CLICK", "Could not find Control") EndIf EndFunc This is what I know: * The target gui was compiled with Visual C/C++ - I think 6.x or at least a PRE .NET version (yay)! I used a hex editor to scan through the executable, and saw the typical Microsoft messages. * My script does find the main window of the target gui and makes it active. * My script appears to be finding the control I'm trying to automate, because the "If $x = 0 Then" does not fail. However - none of the Boxes/controls I'm selecting using ControlClick() get highlighted, nor do the buttons on the toolbar get enabled, yet, I never see this MsgBox(0, "CONTROL CLICK", "Could not find Control". Any ideas what I'm doing wrong?
  23. I see- so then I don't really need the control ID, just the text of the button. That's great- that should eliminate control ID changes in any version of the target app software. Thanks!
×
×
  • Create New...