dickep Posted January 27, 2010 Share Posted January 27, 2010 (edited) I have searched here and cannot find what I think it the answer. I have to do an application that reads the tree in the internet explorer security options settings (Internet Explorer -> Tools menu -> Internet Options -> Security tab -> Custom level and read out of the Settings window). Now, while I can get the stuff (all the text that is), I can't figure out how to get the state of each item that has a radio button. I know, I need code to be here - well, I thing I don't need it since this is just one part, but let me know. Thanks in advance. Edited January 28, 2010 by dickep Link to comment Share on other sites More sharing options...
Akshay07 Posted January 27, 2010 Share Posted January 27, 2010 I have searched here and cannot find what I think it the answer.I have to do an application that reads the tree in the internet explorer security options settings (Internet Explorer -> Tools menu -> Internet Options -> Security tab -> Custom level and read out of the Settings window). Now, while I can get the stuff (all the text that is), I can't figure out how to get the state of each item that has a radio button.I know, I need code to be here - well, I thing I don't need it since this is just one part, but let me know.Thanks in advance.Have you tried with _GUICtrlButton_GetCheck? Link to comment Share on other sites More sharing options...
dickep Posted January 27, 2010 Author Share Posted January 27, 2010 Yes, in fact, I am putting my code here for all to see (and critique - I can take it). The message box says all the buttons are cleared (same as 0) so...... need some directions/help. expandcollapse popup#include <GuiButton.au3> #include <GUIConstants.au3> #include <GUITab.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> #include <Array.au3> Opt("WinTitleMatchMode", 2) Dim $sTitle = "Internet Options" Dim $tSecurity = "Security" If WinExists("Internet Explorer") Then ; window already open, do't do anything ; but go to end of IF stuff MsgBox(0, "", "Found the window") Else ; need to open the window ; first open IE Run("iexplore.exe") WinWait("Internet Explorer", 45) WinActivate("Internet Explorer") Send("^t") EndIf WinActivate("Internet Explorer") sleep(2000) ; wait 2 seconds Send("{ALT}t") sleep(250) send("o") ; now find the tab Security $hWnd = WinGetHandle("[CLASS:#32770; TITLE:Internet Options]") sleep (100) WinActivate($hWnd) sleep (100) $hTab = ControlGetHandle($hWnd, "", "SysTabControl321") $TabID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hTab) $TabID = $TabID[0] _ArrayDisplay($TabID) $tCount = _GUICtrlTab_GetItemCount($hTab) ; get the number of tabs in window ; now find Security tab and click on it $x = 0 $bFound = False #cs MsgBox(0,"","Security tab found at index: " & _GUICtrlTab_FindTab($hTab, "Security")) while not $bFound and $x <= $tCount _GUICtrlTab_SetCurFocus($hTab, $x) _GUICtrlTab_SetCurSel($hTab, $x) msgbox(0,""," Tab " & $x & " of " & $tCount & " Tabs found" & @CRLF & "Tab name: " & _GUICtrlTab_GetItemtext($hTab,$x)) ; msgbox(0,""," Tab " & $x & " of " & $tCount & " Tabs found" & @CRLF & "Tab name: " & _GUICtrlTab_GetCurSel($hTab)) ; if _GUICtrlTab_GetItemText($hTab,$x) = $tSecurity Then ; _GUICtrlTab_SetCurFocus($hTab, $x) ; $sResult = _SendMessage($hWnd, $WM_NOTIFY, $TabID, $TCN_SELCHANGE) ; ExitLoop ; Else $x +=1 ; EndIf WEnd #ce ; assume that SECURITY tab is the second (number 1 starting from 0 on left) tab _GUICtrlTab_SetCurFocus($hTab, 1) $sResult = _SendMessage($hWnd, $WM_NOTIFY, $TabID, $TCN_SELCHANGE) WinActivate("Internet Options") sleep(1000) ; now send the command to open the custom item send("{TAB}") sleep(200) send("!c") sleep(1000) ;MsgBox0,"","Tree count: " & _GUICtrlTreeView_GetCount( $treeview = ControlGetHandle("Security Settings - Local Intranet Zone", "", "[CLASS:SysTreeView32]") $item = _GUICtrlTreeView_GetSelection($treeview) $item = _GUICtrlTreeView_GetNext($treeview, $item) $finish = _GUICtrlTreeView_GetCount($treeview) $count =0 While 1 $count = $count + 1 $text = _GUICtrlTreeView_GetTree($treeview, $item) ;$text holds parent|item name msgbox(0,"","Item # " & $count & " text is: " & $text & @CRLF & _ StringFormat("State for Index %d? %s", $count, _ExplainState(_GUICtrlButton_GetCheck($treeview)))) If $count = $finish then ExitLoop $item = _GUICtrlTreeView_GetNext($treeview, $item) WEnd Func _ExplainState($iState, $fPushButton = False) Local $sText = "" If Not $fPushButton And Not $iState Then Return _ @CRLF & "Indicates the button is cleared. Same as a return value of zero." & @CRLF If BitAND($iState, $BST_CHECKED) = $BST_CHECKED Then _ $sText &= @CRLF & "Indicates the button is checked." & @CRLF If BitAND($iState, $BST_FOCUS) = $BST_FOCUS Then _ $sText &= @CRLF & "Specifies the focus state. A nonzero value indicates that the button has the keyboard focus." & @CRLF If BitAND($iState, $BST_INDETERMINATE) = $BST_INDETERMINATE Then _ $sText &= @CRLF & "Indicates the button is grayed because the state of the button is indeterminate." & @CRLF If $fPushButton Then If BitAND($iState, $BST_PUSHED) = $BST_PUSHED Then $sText &= @CRLF & "Specifies the highlight state." & @CRLF Else $sText &= @CRLF & "Specifies not highlighted state." & @CRLF EndIf EndIf Return $sText EndFunc ;==>_ExplainState Link to comment Share on other sites More sharing options...
Akshay07 Posted January 27, 2010 Share Posted January 27, 2010 Maybe _GUICtrlTreeView_GetChecked($hWnd, $hItem) ? Link to comment Share on other sites More sharing options...
dickep Posted January 27, 2010 Author Share Posted January 27, 2010 Same result - item is cleared or 0 Anyone else tried getting the radio button status from within a Windows application/applet??? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 27, 2010 Moderators Share Posted January 27, 2010 dickep,I have not used it myself but ControlCommand with the "IsChecked" Option is what you want. Something along the lines of:$IsChecked = ControlCommand("Window Title", "", $idChkBox, "IsChecked") ; Where $idChkBox is the control IDshould do it.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
dickep Posted January 27, 2010 Author Share Posted January 27, 2010 Not sure what you mean here. Each item in the treeview has the same control ID. I have posted the Window Info capture for the 4th and 5th item in the display. They have almost the same information - especially for the control information. So, not sure how to make this work - if it could. If you would be so kind as to maybe give an example of how to use this to see the state of the radio button in the window. Thanks expandcollapse popup; WINDOW CAPTURE 1 - item 5 (radio button) >>>> Window <<<< Title: Security Settings - Local Intranet Zone Class: #32770 Position: 1463, -99 Size: 417, 479 Style: 0x94C800CC ExStyle: 0x00010101 Handle: 0x035C08EC >>>> Control <<<< Class: SysTreeView32 Instance: 1 ClassnameNN: SysTreeView321 Name: Advanced (Class): [CLASS:SysTreeView32; INSTANCE:1] ID: 1024 Text: Tree1 Position: 27, 31 Size: 354, 270 ControlClick Coords: 84, 203 Style: 0x50310014 ExStyle: 0x00000204 Handle: 0x007D08EE >>>> Mouse <<<< Position: 1577, 164 Cursor ID: 2 Color: 0x316AC5 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Tree1 *Takes effect after you restart Internet Explorer Reset custom settings &Reset to: Medium-low (default) R&eset... OK Cancel Settings >>>> Hidden Text <<<< &Java Custom Settings... ;----------------------------------- ; ; WINDOW CAPTURE 2 - item 4 (radio button) >>>> Window <<<< Title: Security Settings - Local Intranet Zone Class: #32770 Position: 1463, -99 Size: 417, 479 Style: 0x94C800CC ExStyle: 0x00010101 Handle: 0x035C08EC >>>> Control <<<< Class: SysTreeView32 Instance: 1 ClassnameNN: SysTreeView321 Name: Advanced (Class): [CLASS:SysTreeView32; INSTANCE:1] ID: 1024 Text: Tree1 Position: 27, 31 Size: 354, 270 ControlClick Coords: 75, 182 Style: 0x50310014 ExStyle: 0x00000204 Handle: 0x007D08EE >>>> Mouse <<<< Position: 1568, 143 Cursor ID: 2 Color: 0x316AC5 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Tree1 *Takes effect after you restart Internet Explorer Reset custom settings &Reset to: Medium-low (default) R&eset... OK Cancel Settings >>>> Hidden Text <<<< &Java Custom Settings... dickep, I have not used it myself but ControlCommand with the "IsChecked" Option is what you want. Something along the lines of: $IsChecked = ControlCommand("Window Title", "", $idChkBox, "IsChecked") ; Where $idChkBox is the control ID should do it. M23 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 27, 2010 Moderators Share Posted January 27, 2010 dickep,Looks like an interesting control! I am afraid that with IE applets you are now well out of my comfort zone - sorry. I know that ControlCommand works nicely with more "regular" controls, which is why I suggested it.However, there are others around here who know much more. Hang on and they will no doubt pop in some time. Perhaps you should edit the thread title to include "Internet Explorer" - that usually gets the IE gurus running! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
dickep Posted January 27, 2010 Author Share Posted January 27, 2010 THanks for you input. I was thinking this was a "regular" control - just part of the applet, but, maybe not.Not sure how to edit title of the thread but would like to.dickep,Looks like an interesting control! I am afraid that with IE applets you are now well out of my comfort zone - sorry. I know that ControlCommand works nicely with more "regular" controls, which is why I suggested it.However, there are others around here who know much more. Hang on and they will no doubt pop in some time. Perhaps you should edit the thread title to include "Internet Explorer" - that usually gets the IE gurus running! M23 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted January 27, 2010 Share Posted January 27, 2010 Not sure how to edit title of the thread but would like to.When you created the first post you wrote the thread title, so how would you logically change the title? By pressing "edit" on the first post! .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Akshay07 Posted January 27, 2010 Share Posted January 27, 2010 Anyone else tried getting the radio button status from within a Windows application/applet??? I did something similar, but I was not dealing with a tree, I was dealing with a list. Not sure if it can help but here it is: $hWnd = ControlGetHandle("title of the window","","[CLASS:SysListView32]") $numberOfItemsInList = _GUICtrlListView_GetItemCount($hWnd) For $i = 0 To ($numberOfItemsInList -1) If _GUICtrlListView_GetItemChecked($hWnd, $iIndex) = True Then ; Item is checked, do whatever is required Next Link to comment Share on other sites More sharing options...
dickep Posted January 27, 2010 Author Share Posted January 27, 2010 Thanks, but tried this a while ago - no luck. Just seems that the IE Security tab does respond to some of the TreeView calls, but not to all of them - unless I am missing something here. I did something similar, but I was not dealing with a tree, I was dealing with a list. Not sure if it can help but here it is: $hWnd = ControlGetHandle("title of the window","","[CLASS:SysListView32]") $numberOfItemsInList = _GUICtrlListView_GetItemCount($hWnd) For $i = 0 To ($numberOfItemsInList -1) If _GUICtrlListView_GetItemChecked($hWnd, $iIndex) = True Then ; Item is checked, do whatever is required Next Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 27, 2010 Moderators Share Posted January 27, 2010 dickep,It might just me being pessimistic - but perhaps MS have decided to make this particular applet pretty difficult to automate for obvious reasons! However, do not get discouraged too easily - there might well be a solution out there!M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
dickep Posted January 27, 2010 Author Share Posted January 27, 2010 I am not getting discouraged, but very frustrated. I am going to find someone somewhere that can help me understand what MS is doing and/or try to ferret out the information. I do need this for some activities - need to make sure that all machines are set the same way and writing them all down is really painful (and not the accepted answer for me)>Thanks for your help and hope someone will have the help I needdickep,It might just me being pessimistic - but perhaps MS have decided to make this particular applet pretty difficult to automate for obvious reasons! However, do not get discouraged too easily - there might well be a solution out there!M23 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 27, 2010 Moderators Share Posted January 27, 2010 dickep,Nothing personal, but when you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
dickep Posted January 28, 2010 Author Share Posted January 28, 2010 OK, I found what I think will work for this . Seems that someone else had the same problem, and, to my happiness, has a solution.It can be found here if you want to use it.So far my testing has proved good. Just need to figure out some things, but I can read the help file first, try some things, and then, if necessary, come back here.For now, consider this SOLVED/RESOLVED.Thanks all for your input.E Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now