Jump to content

Silverlode

Active Members
  • Posts

    30
  • Joined

  • Last visited

Silverlode's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Func WinListChildren($hWnd, ByRef $avArr) If UBound($avArr, 0) <> 2 Then Local $avTmp[10][2] = [[0]] $avArr = $avTmp EndIf Local $hChild = _WinAPI_GetWindow($hWnd, $GW_CHILD) While $hChild If $avArr[0][0]+1 > UBound($avArr, 1)-1 Then ReDim $avArr[$avArr[0][0]+10][2] $avArr[$avArr[0][0]+1][0] = $hChild $avArr[$avArr[0][0]+1][1] = _WinAPI_GetWindowText($hChild) $avArr[0][0] += 1 WinListChildren($hChild, $avArr) $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) WEnd ReDim $avArr[$avArr[0][0]+1][2] EndFunc Global $avChildren Local $hWinHan = ControlGetHandle("Options", "", "[CLASS:WindowsForms10.Window.8.app.0.27c59a_r77_ad1; INSTANCE:2]") Sleep($sm_sleep) WinListChildren($hWinHan, $avChildren) Local $vValue = "Hyperion Strategic Planning" Sleep($sm_sleep) $ArrIndex = _ArraySearch($avChildren, $vValue) $ArrIndexVersion = $ArrIndex - 2 Local $iStart_Row = $ArrIndexVersion $VersionString = _ArrayToString($avChildren, "|", $ArrIndexVersion, $ArrIndexVersion, "-", 1, 1) Global $buildno = $VersionString Sleep($sm_sleep) Local $LogMsg = "INFO: Installed version is " & $buildno & "." _FileWriteLog(@ScriptDir & $logfile, $LogMsg)
  2. I actually solved this another way by creating an array from all the controls within a dialog, and sorting to find what I needed. Thanks.
  3. The classnameNN changes from machine to machine, installation to installation, for this particular dialog. I need to get the classnameNN of a particular label (the text in that label is always the same), so that I can reference another label (which has text that changes) and read its text. Basically I'm trying to read the version number of an installed piece of software from a dialog that lists a bunch of Excel extensions.
  4. Thanks JohnOne, that returns the class, not the classnameNN.
  5. More specifically I need to get the classnameNN from the text string. I did figure out to use ControlGetHandle to get the handle of the controlID, but now I need to get the classnameNN of that handle.
  6. Hi, I've searched and not come up with much. I would like to get the controlID of a text label based on what the text is. So, if I have several labels in a WindowsForm and one of them is "This Text String", I want to get the controlID of that particular label. I haven't found a way to get that, based on the text in the control. Any ideas out there? I appreciate it.
  7. Thanks, Spider001. I don't want to upload a file, but create an HTTP POST request containing a custom header. I need to send a session token in the header in order to gain access to the MediaWiki API. The login for MediaWiki is a 2-step process. First I send this login and find the 2 tokens I need in the return. This is working: ; WIKI LOGIN $sPD = 'action=login&lgname=wikiuser&lgpassword=secret' $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "http://hsfwiki.us.oracle.com:8080/w/api.php", False) $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.Send($sPD) $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status ConsoleWrite(@CRLF & $oStatusCode) ;ConsoleWrite($oReceived) If $oStatusCode = 200 Then ;Process the response $oReceived ConsoleWrite(@CRLF & "Recieved response from HSFWiki") Else MsgBox(16, "Error " & $oStatusCode, $oReceived, 7) EndIf ; FIND TOKEN and SESSIONID IN $oReceived _FileWriteLog("WikiLoginToken.xml", $oReceived) $tfile = FileOpen("WikiLoginToken.xml", 0) If $tfile = -1 Then MsgBox(0, "Error", "Unable to open WikiLoginToken.xml.") ConsoleWrite(@CRLF & "ERROR: Unable to open WikiLoginToken.xml.") Exit Else ConsoleWrite(@CRLF & "Opened WikiLoginToken.xml.") EndIf For $line = 1 To 40 If StringInStr(FileReadLine($tfile, $line), "NeedToken") Then $lgtoken = StringRegExpReplace(FileReadLine($tfile, $line), "(\D.*|\d.*|)token=&quot;(\D.*|\d.*|)&quot;(\D.*|\d.*|)&quot;(\D.*|\d.*|)&quot;(\D.*|\d.*|)&quot;(\D.*|\d.*|)&quot;(\D.*|\d.*|)", "$2") $lgsessionid = StringRegExpReplace(FileReadLine($tfile, $line), "(\D.*|\d.*|)sessionid=&quot;(\D.*|\d.*|)&quot;(\D.*|\d.*|)", "$2") EndIf Next ConsoleWrite(@CRLF & "Token = " & $lgtoken) ConsoleWrite(@CRLF & "SessionID = " & $lgsessionid) FileClose($tfile) The next step is to send $lgsessionid in the header of another POST request. I'm trying to figure out how to customize the header. I'm trying to figure out how to send header info other than "Content-Type". I need to send "session" in the header as well. Thanks for any insight.
  8. Spider001, any insights yet? I need to make some POST requests with custom headers and am not finding much in the way of examples for AutoIt.
  9. Duh...my apologies. And thanks again.
  10. Universalist, I was in the process of updating this thread when you posted. Yes, I need to use $aFileList since that is what is capturing the return of _FileListToArray! I was just relying too much on examples, and this was my first time using an array. Thank you. The reason I need to do this is that the name of the zip file to extract will never be the same, as it contains a build number that increments with each build.
  11. _ArrayDisplay does seem to work fine. Here's the entire script (obviously file paths will mean nothing): #include <GuiEdit.au3> #include <GuiListBox.au3> #include <GuiComboBox.au3> #include <GuiListView.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <File.au3> #include <FileConstants.au3> #include <Array.au3> AutoItSetOption ( "SendKeyDelay" , 30 ) AutoItSetOption ( "TrayIconDebug", 1 ) Opt("WinTitleMatchMode", 2) ; GET BITNESS OF OS (CRUDE METHOD) If FileExists("C:\Program Files (x86)") Then Local $osbit = "64" Else Local $osbit = "32" EndIf Local $aArray[0], $aArray[1] Sleep(1000) ; COPY PATCH ZIP FILE FileCopy("\\chi413071\Ship\HSF11.1.2.4\11_1_2_4_000_3031\BuildPatch.zip", "C:\Oracle\Middleware\EPMSystem11R1\opatch\", $FC_OVERWRITE) MsgBox(0, "", "") Sleep(1000) Local $opatch_dir = "C:\Oracle\Middleware\EPMSystem11R1\opatch\" Local $extract_dir = "C:\Oracle\Middleware\EPMSystem11R1\opatch\Extracted" DirCreate($extract_dir) ; to extract to _ExtractZip($opatch_dir & "BuildPatch.zip", $extract_dir) If $osbit = "32" Then Local $aFileList = _FileListToArray($extract_dir, "*win32*") _ExtractZip($extract_dir & $aArray[1], $extract_dir) ElseIf $osbit = "64" Then Local $aFileList = _FileListToArray($extract_dir, "*amd*") _ExtractZip($extract_dir & $aArray[1], $extract_dir) EndIf Sleep(5000) Exit ; #FUNCTION# ;=============================================================================== ; ; Name...........: _ExtractZip ; Description ...: Extracts file/folder from ZIP compressed file ; Syntax.........: _ExtractZip($sZipFile, $sDestinationFolder) ; Parameters ....: $sZipFile - full path to the ZIP file to process ; $sDestinationFolder - folder to extract to. Will be created if it does not exsist exist. ; Return values .: Success - Returns 1 ; - Sets @error to 0 ; Failure - Returns 0 sets @error: ; |1 - Shell Object creation failure ; |2 - Destination folder is unavailable ; |3 - Structure within ZIP file is wrong ; |4 - Specified file/folder to extract not existing ; Author ........: trancexx, modifyed by corgano ; ;========================================================================================== Func _ExtractZip($sZipFile, $sDestinationFolder, $sFolderStructure = "") Local $i Do $i += 1 $sTempZipFolder = @TempDir & "\Temporary Directory " & $i & " for " & StringRegExpReplace($sZipFile, ".*\\", "") Until Not FileExists($sTempZipFolder) ; this folder will be created during extraction Local $oShell = ObjCreate("Shell.Application") If Not IsObj($oShell) Then Return SetError(1, 0, 0) ; highly unlikely but could happen EndIf Local $oDestinationFolder = $oShell.NameSpace($sDestinationFolder) If Not IsObj($oDestinationFolder) Then DirCreate($sDestinationFolder) ;~ Return SetError(2, 0, 0) ; unavailable destionation location EndIf Local $oOriginFolder = $oShell.NameSpace($sZipFile & "\" & $sFolderStructure) ; FolderStructure is overstatement because of the available depth If Not IsObj($oOriginFolder) Then Return SetError(3, 0, 0) ; unavailable location EndIf Local $oOriginFile = $oOriginFolder.Items();get all items If Not IsObj($oOriginFile) Then Return SetError(4, 0, 0) ; no such file in ZIP file EndIf ; copy content of origin to destination $oDestinationFolder.CopyHere($oOriginFile, 20) ; 20 means 4 and 16, replaces files if asked DirRemove($sTempZipFolder, 1) ; clean temp dir Return 1 ; All OK! EndFunc
  12. Hi everyone, I've got a bit of code that gets the file name of a zip file in a particular directory and tried to unzip it. _FileListToArray should create an array and define $aArray[1] as the first file returned by the search. But when I try to use $aArray[1] for anything, I get the error: "==> Array variable has incorrect number of subscripts or subscript dimension range exceeded." Any thoughts? If $osbit = "32" Then Local $aFileList = _FileListToArray($extract_dir, "*win32*") _ExtractZip($extract_dir & $aArray[1], $extract_dir) ElseIf $osbit = "64" Then Local $aFileList = _FileListToArray($extract_dir, "*amd*") _ExtractZip($extract_dir & $aArray[1], $extract_dir) EndIf Thanks.
  13. I have a tree view in Excel that was returning the correct index of a member using ControlTreeView($win, "", "[iD]", GetSelected) in Excel 2007 and 2010. However, in Excel 2013, it's not working at all. So I tried GUICtrlTreeView_GetSelected and it is returning a hex value! In older versions of Excel I got an orderly "#0|#3" (for example). In Excel 2013 I get "0x15483621" or something. Any experience with this? It's a custom Excel extension that displays a tree. Local $sel_ref = ControlTreeView($hwin, "", "[ID:1927]", "GetSelected", 1) Local $handle01 = ControlGetHandle($hwin, "", "[ID:1927]") Local $sel_ref = _GUICtrlTreeView_GetSelection($handle01) Thanks!
  14. It works! Thanks. Now I just need to incorporate that in my script in a meaningful way.
  15. Hi. This looks amazing. I'm trying to get the state of a radio button in a dialog and nothing in default AutoIt is working. Here's the Spy output of the control: Mouse position is retrieved 386-359 At least we have an element [Items][WindowsForms10.BUTTON.app.0.165f26b_r59_ad1] Having the following values for all properties: Title is: <Items> Class := <WindowsForms10.BUTTON.app.0.165f26b_r59_ad1> controltype:= <UIA_RadioButtonControlTypeId> ,<50013> , (0000C35D) *** Parent Information *** Title is: <> Class := <WindowsForms10.Window.8.app.0.165f26b_r59_ad1> controltype:= <UIA_PaneControlTypeId> ,<50033> , (0000C371) *** Detailed properties of the highlighted element *** UIA_AcceleratorKeyPropertyId := UIA_AccessKeyPropertyId := UIA_AriaPropertiesPropertyId := UIA_AriaRolePropertyId := UIA_AutomationIdPropertyId :=radioButton_Output_Items UIA_BoundingRectanglePropertyId :=365;356;50;18 UIA_ClassNamePropertyId :=WindowsForms10.BUTTON.app.0.165f26b_r59_ad1 UIA_ClickablePointPropertyId := UIA_ControllerForPropertyId := UIA_ControlTypePropertyId :=50013 UIA_CulturePropertyId :=0 UIA_DescribedByPropertyId := UIA_DockDockPositionPropertyId :=5 UIA_ExpandCollapseExpandCollapseStatePropertyId :=3 UIA_FlowsToPropertyId := UIA_FrameworkIdPropertyId :=WinForm UIA_GridColumnCountPropertyId :=0 UIA_GridItemColumnPropertyId :=0 UIA_GridItemColumnSpanPropertyId :=1 UIA_GridItemContainingGridPropertyId := UIA_GridItemRowPropertyId :=0 UIA_GridItemRowSpanPropertyId :=1 UIA_GridRowCountPropertyId :=0 UIA_HasKeyboardFocusPropertyId :=True UIA_HelpTextPropertyId := UIA_IsContentElementPropertyId :=True UIA_IsControlElementPropertyId :=True UIA_IsDataValidForFormPropertyId :=False UIA_IsDockPatternAvailablePropertyId :=False UIA_IsEnabledPropertyId :=True UIA_IsExpandCollapsePatternAvailablePropertyId :=False UIA_IsGridItemPatternAvailablePropertyId :=False UIA_IsGridPatternAvailablePropertyId :=False UIA_IsInvokePatternAvailablePropertyId :=True UIA_IsItemContainerPatternAvailablePropertyId :=False UIA_IsKeyboardFocusablePropertyId :=True UIA_IsLegacyIAccessiblePatternAvailablePropertyId :=True UIA_IsMultipleViewPatternAvailablePropertyId :=False UIA_IsOffscreenPropertyId :=False UIA_IsPasswordPropertyId :=False UIA_IsRangeValuePatternAvailablePropertyId :=False UIA_IsRequiredForFormPropertyId :=False UIA_IsScrollItemPatternAvailablePropertyId :=False UIA_IsScrollPatternAvailablePropertyId :=False UIA_IsSelectionItemPatternAvailablePropertyId :=True UIA_IsSelectionPatternAvailablePropertyId :=False UIA_IsSynchronizedInputPatternAvailablePropertyId :=False UIA_IsTableItemPatternAvailablePropertyId :=False UIA_IsTablePatternAvailablePropertyId :=False UIA_IsTextPatternAvailablePropertyId :=False UIA_IsTogglePatternAvailablePropertyId :=False UIA_IsTransformPatternAvailablePropertyId :=False UIA_IsValuePatternAvailablePropertyId :=False UIA_IsVirtualizedItemPatternAvailablePropertyId :=False UIA_IsWindowPatternAvailablePropertyId :=False UIA_ItemStatusPropertyId := UIA_ItemTypePropertyId := UIA_LabeledByPropertyId := UIA_LegacyIAccessibleChildIdPropertyId :=0 UIA_LegacyIAccessibleDefaultActionPropertyId :=Check UIA_LegacyIAccessibleDescriptionPropertyId := UIA_LegacyIAccessibleHelpPropertyId := UIA_LegacyIAccessibleKeyboardShortcutPropertyId := UIA_LegacyIAccessibleNamePropertyId :=Items UIA_LegacyIAccessibleRolePropertyId :=45 UIA_LegacyIAccessibleSelectionPropertyId := UIA_LegacyIAccessibleStatePropertyId :=1048596 UIA_LegacyIAccessibleValuePropertyId := UIA_LocalizedControlTypePropertyId :=radio button UIA_MultipleViewCurrentViewPropertyId :=0 UIA_MultipleViewSupportedViewsPropertyId := UIA_NamePropertyId :=Items UIA_NativeWindowHandlePropertyId :=66296 UIA_OrientationPropertyId :=0 UIA_ProcessIdPropertyId :=1568 UIA_ProviderDescriptionPropertyId :=[pid:5360,hwnd:0x102F8 Main:Nested [pid:1568,hwnd:0x102F8 Main(parent link):Microsoft: MSAA Proxy (unmanaged:UIAutomationCore.DLL)]; Hwnd(parent link):Microsoft: HWND Proxy (unmanaged:uiautomationcore.dll)] UIA_RangeValueIsReadOnlyPropertyId :=True UIA_RangeValueLargeChangePropertyId :=0 UIA_RangeValueMaximumPropertyId :=0 UIA_RangeValueMinimumPropertyId :=0 UIA_RangeValueSmallChangePropertyId :=0 UIA_RangeValueValuePropertyId :=0 UIA_RuntimeIdPropertyId :=42;66296 UIA_ScrollHorizontallyScrollablePropertyId :=False UIA_ScrollHorizontalScrollPercentPropertyId :=0 UIA_ScrollHorizontalViewSizePropertyId :=100 UIA_ScrollVerticallyScrollablePropertyId :=False UIA_ScrollVerticalScrollPercentPropertyId :=0 UIA_ScrollVerticalViewSizePropertyId :=100 UIA_SelectionCanSelectMultiplePropertyId :=False UIA_SelectionIsSelectionRequiredPropertyId :=False UIA_SelectionselectionPropertyId := UIA_SelectionItemIsSelectedPropertyId :=True UIA_SelectionItemSelectionContainerPropertyId := UIA_TableColumnHeadersPropertyId := UIA_TableItemColumnHeaderItemsPropertyId := UIA_TableRowHeadersPropertyId := UIA_TableRowOrColumnMajorPropertyId :=2 UIA_TableItemRowHeaderItemsPropertyId := UIA_ToggleToggleStatePropertyId :=2 UIA_TransformCanMovePropertyId :=False UIA_TransformCanResizePropertyId :=False UIA_TransformCanRotatePropertyId :=False UIA_ValueIsReadOnlyPropertyId :=True UIA_ValueValuePropertyId := UIA_WindowCanMaximizePropertyId :=False UIA_WindowCanMinimizePropertyId :=False UIA_WindowIsModalPropertyId :=False UIA_WindowIsTopmostPropertyId :=False UIA_WindowWindowInteractionStatePropertyId :=0 UIA_WindowWindowVisualStatePropertyId :=0 Can someone show me simple code to check whether this radio button is checked or not? Many thanks.
×
×
  • Create New...