Jump to content

RogerH

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by RogerH

  1. Did you have any luck with this? I have a very similar problem on automating the client installer to dismiss the "You do not have permission to open this file" dialog box.
  2. Retried with every variant I could think of: Text, No Text, Control ID, Advanced Mode, ClassnameNN.... none of the three worked, nor did the directive to click the mouse. Thoughts on why I wouldn't see the cursor move?
  3. Been through too many variants on that today No dice... same thing Starting 717,320 Able to find window $iWinState=[7] $iWinState=[15] $iWinState=[15] the full output
  4. #include <array.au3> #include <WinAPI.au3> #RequireAdmin Func _ClickWait($title, $text, $control, $timeout = "") If WinWait($title, $text, $timeout) Then ControlClick ($title, $text, $control) EndIf EndFunc $mouseStart = WinGetPos ("Dexterity Runtime","OK") ConsoleWrite("Starting" & @crlf) ConsoleWrite($mouseStart[0] & "," & $mouseStart[1] & @crlf) $hwnd = WinWait("Dexterity Runtime", "OK") If IsHWnd($hwnd) Then ConsoleWrite("Able to find window" & @CRLF) Else ConsoleWrite("Unable to find window" & @CRLF) Exit 1 EndIf $iWinState = WinGetState($hwnd) ConsoleWrite("$iWinState=[" & $iWinState & "]" & @CRLF) WinActivate ("Dexterity Runtime","OK") $iWinState = WinGetState($hwnd) ConsoleWrite("$iWinState=[" & $iWinState & "]" & @CRLF) ;ClickWait("Dexterity Runtime","OK",120,1) MouseMove($mouseStart[0] + 240, $mouseStart[1] + 144) MouseClick("left") $iWinState = WinGetState($hwnd) ConsoleWrite("$iWinState=[" & $iWinState & "]" & @CRLF) Making it even uglier... manual mouse move (which I can't see happen... my cursor does not move) [EDIT] Forgot to turn on absolute mouse coord mode... tried that again... no luck
  5. #include <array.au3> #include <WinAPI.au3> #RequireAdmin Func _ClickWait($title, $text, $control, $timeout = "") If WinWait($title, $text, $timeout) Then ControlClick ($title, $text, $control) EndIf EndFunc ConsoleWrite("Starting" & @crlf) $hwnd = WinWait("Dexterity Runtime", "OK") If IsHWnd($hwnd) Then ConsoleWrite("Able to find window" & @CRLF) Else ConsoleWrite("Unable to find window" & @CRLF) Exit 1 EndIf $iWinState = WinGetState($hwnd) ConsoleWrite("$iWinState=[" & $iWinState & "]" & @CRLF) WinActivate ("Dexterity Runtime","OK") $iWinState = WinGetState($hwnd) ConsoleWrite("$iWinState=[" & $iWinState & "]" & @CRLF) _ClickWait("Dexterity Runtime","OK",120,1) $iWinState = WinGetState($hwnd) ConsoleWrite("$iWinState=[" & $iWinState & "]" & @CRLF) Starting Able to find window $iWinState=[7] $iWinState=[15] $iWinState=[15]
  6. So here's my current tester... I launch the installer manually, and when it gets to my annoying popup point: #include <array.au3> #include <WinAPI.au3> #RequireAdmin Func _ClickWait($title, $text, $control, $timeout = "") If WinWait($title, $text, $timeout) Then ControlClick ($title, $text, $control) EndIf EndFunc Func _WinWaitActivate($title, $text, $timeout = 5) WinWait($title, $text, $timeout) If Not WinActive($title, $text) Then WinActivate($title, $text) If Not WinWaitActive($title, $text, 5) Then Return 0 Else Return 1 EndIf EndFunc ;==>_WinWaitActivate _ClickWait("Dexterity Runtime","OK",120,1) ;this is the part giving me hell -- right now we manually have to click this off ConsoleWrite("Starting" & @crlf) $hwnd = _WinWaitActivate("Dexterity Runtime", "OK") If IsHWnd($hwnd) Then ConsoleWrite("Able to find window" & @CRLF) Else ConsoleWrite("Unable to find window" & @CRLF) Exit 1 EndIf $iWinState = WinGetState($hwnd) ConsoleWrite("$iWinState=[" & $iWinState & "]" & @CRLF) I launch this and here are my console results: Starting Unable to find window Which is extra strange because it pulled the window out to the forefront -- attaching screenies [EDIT: More] Some digging suggests that I'm not pulling the window handle from the WinWaitActivate here --- will tweak.
  7. Starting Able to find window Func=[Var_GetAllWindowsControls]: ControlCounter=[1] ControlID=[1] Handle=[0x0000000000341158] ClassNN=[button1] XPos=[200] YPos=[132] Width=[80] Height=[24] Text=[OK]. Able to find button; $bFocus=[0], $bVisible=[1], $bEnabled=[1], x=[200], y=[132], width=[80], height=[24]. Able to click button Yet there the window still sits... mocking me
  8. Took me a bit to figure out that to see the console writes, SciTE had to be running as admin too :S Starting Able to find window Able to find button Able to click button But... it lies... the button remains unclicked.
  9. Let's start with the code #include <array.au3> #include <GuiComboBox.au3> #RequireAdmin Func _WinWaitActivate($title, $text, $timeout = 5) WinWait($title, $text, $timeout) If Not WinActive($title, $text) Then WinActivate($title, $text) If Not WinWaitActive($title, $text, 5) Then Return 0 Else Return 1 EndIf EndFunc ;==>_WinWaitActivate _WinWaitActivate("Dexterity Runtime","") ControlClick("Dexterity Runtime","","[CLASS:Button; INSTANCE:1]") No matter how hidden I make the "Dexterity Runtime" window, _WinWaitActivate does great finding it and bringing it to the forefront. ControlClick("Dexterity Runtime","","Button1") didn't help I also tried several MouseClick variants as well, but no matter what I've tried this window just won't click off. Here's the relevant WindowInfo output: >>>> Window <<<< Title: Dexterity Runtime Class: TNTDLG Position: 717, 320 Size: 486, 200 Style: 0x94C00000 ExStyle: 0x00000101 Handle: 0x00000000001E1280 >>>> Control <<<< Class: Button Instance: 1 ClassnameNN: Button1 Name: Advanced (Class): [CLASS:Button; INSTANCE:1] ID: 1 Text: OK Position: 200, 132 Size: 80, 24 ControlClick Coords: 52, 12 Style: 0x5000030B ExStyle: 0x00000000 Handle: 0x00000000002211F8 >>>> Mouse <<<< Position: 972, 489 Cursor ID: 0 Color: 0xDDDDDD >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< OK >>>> Hidden Text <<<< This is my third go-round with this, and I am just at a loss as to why it isn't working.
  10. Thawee, I'm having the same questions... I think this part (cleaned up of course) would be more elegant than doing another conversion... how did this turn out? I'm leaning toward doing it into the registry, but otherwise I'd like to do the same thing.
  11. On my form, if I check one box, I have it disable another checkbox, and put a message in the input box I want the user to interact with: I use the GUIGetMsg() method: Case $cb_controller If GUICtrlRead($cb_controller) = $GUI_CHECKED Then GUICtrlSetData($in_system_name, @ComputerName) GUICtrlSetState($in_system_name, $GUI_DISABLE) GUICtrlSetState($cb_seccon, $GUI_ENABLE) Else GUICtrlSetData($in_system_name, "Fill in Controller Name here") GUICtrlSetState($in_system_name, $GUI_ENABLE) GUICtrlSetState($cb_seccon, $GUI_UNCHECKED) GUICtrlSetState($cb_seccon, $GUI_DISABLE) EndIf
  12. I went ahead and implemented GeoSoft's suggestion -- just loop through ALL controls for the SetState and it worked fine. However, when I did GUICtrlSetData, things got ugly -- all the text for the labels and buttons disappeared. I removed a few boxes, and cleaned up the interface, so right now I have 50 controls on the form: My current refinement/process is as follows: Func _Clear_All() ;clear all check boxes For $i = 1 To 50 GUICtrlSetState($i, $GUI_UNCHECKED) Next For $i = 42 To 45 GUICtrlSetData($i, "") Next EndFunc ; What I did to try keep them grouped nicely is Excel and good naming practices: $btn_.... - button $cb_..... - checkbox $in_..... - input box $lbl_.... - label $rad_.... - radio button This doesn't quite work out as hoped, because there's something else at play in generating the id than just the order -- I get two checkbox labels wiped out instead of my input boxes with this code sample. As another issue, my tab order is pretty significantly messed up as well, as it appears that tab order is controlled by the order of the controls. What also isn't pretty is the GUICtrlSetState(-1, $GUI_CHECKED) that are put in to set default turned-on items.. this process dumps them all at the end, and eliminates that functionality. To address that I made a Func _Set_Defaults() that turns on my checkboxes, and sets my default input box values: Func _Set_Defaults() GUICtrlSetState($rad_1, $GUI_CHECKED) GUICtrlSetState($cb_1, $GUI_CHECKED) GUICtrlSetState($cb_2, $GUI_CHECKED) GUICtrlSetState($cb_3, $GUI_CHECKED) GUICtrlSetState($cb_4, $GUI_CHECKED) GUICtrlSetState($cb_5, $GUI_CHECKED) GUICtrlSetState($cb_6, $GUI_CHECKED) GUICtrlSetState($cb_7, $GUI_CHECKED) GUICtrlSetState($cb_8, $GUI_CHECKED) GUICtrlSetState($cb_9, $GUI_CHECKED) GUICtrlSetState($cb_10, $GUI_CHECKED) GUICtrlSetState($cb_11, $GUI_CHECKED) GUICtrlSetState($cb_12, $GUI_CHECKED) GUICtrlSetState($cb_13, $GUI_CHECKED) GUICtrlSetState($cb_14, $GUI_CHECKED) GUICtrlSetData($in_1, "1") GUICtrlSetData($in_2, "2") GUICtrlSetData($in_3, @ComputerName) GUICtrlSetData($in_4, "1") EndFunc ;==>_SetDefaults I put this line in immediately before my GUISetState(@SW_SHOW).
  13. I've assigned all the checkboxes variables, but as you see from the numbering I'm at 55 of them so far... Your suggestion for clustering them was how I'd worked it before... I was hoping for something more elegant than that though. Your loop should work well with the sequential checkboxes, and you've answered my question about the "stuff in the middle"... Thanks!
  14. When you build out controls, they are sequentially assigned id's as you add them to the form; so the first control in the code is 1... etc... I had this working when I grouped all the checkboxes together.
  15. Good Afternoon all, I have been searching and haven't had too much luck finding a good solution for these items I have a GUI script I've built that has a bunch of checkboxes and input boxes. I put a button on to load the defaults, and another one to clear all of them. Initially I did this: Func _Clear_All() ;clear all check boxes For $i = 10 To 66 GUICtrlSetState($i, $GUI_UNCHECKED) Next GUICtrlSetData($in_tccount, "") GUICtrlSetData($in_op_count, "") GUICtrlSetData($in_system_name, "") GUICtrlSetData($in_pl_count, "") EndFunc ;==>_Clear_Checkboxes But if I modify the UI (which I have been doing a bunch) it changes the id of the checkboxes, and that FOR loop may or may not get all of them. So it raises a few questions, which also relates to saving off all the window info into the registry or an .ini file. 1) is there a "for each" type of loop that will iterate through all of the elements on a GUI form? 2) is GUICtrlSetState($i, $GUI_UNCHECKED) smart enough not to throw an error if I call it on an input-box for example? a) If it's not, how do I check what type of GUI element the control is?
×
×
  • Create New...