Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/27/2019 in all areas

  1. GoliaX, So you are still trying to write that gamebot. I really dislike it when people lie to me - and I warned you here that you had used up any flex I was prepared to show you. Take a week off to think about how you have behaved since your arrival here - if and when you return you had best be prepared to fit in to the community and respect its rules or the next ban will be permanent. M23
    2 points
  2. What is Rollbar? Rollbar provides real-time error alerting & debugging tools for developers. Learn more about it at https://rollbar.com/product/ Demo: https://rollbar.com/demo/demo/ Screenshot: Instructions: (RollbarTest.au3) ; Include RollbarSDK #include "RollbarSDK.au3" ;Turns on ConsoleWrite debugging override. ;Global $Rollbar_Debug=False ; Initialize RollbarSDK with the project's API key. ; Parameters ....: $__Rollbar_sToken - [Required] Go to https://rollbar.com/<User>/<ProjectName>/settings/access_tokens/ for your project. Use the token for post_server_item. _Rollbar_Init("eaa8464a4082eeabd9454465b8f0c0af") ; Write code that causes an error you want to catch, then call ; _Rollbar_Send ; Parameters ....: $__Rollbar_sErrorLevel - [Required] Must be one of the following values: Debug, Info, Warning, Error, Critical. ; $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_Send("Debug", "This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_Send("Warning", "This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_Send("Error", "This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_Send("Critical", "This is an critical message. If you received this, you were successful!", "Critical Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!") ;No Message ; Rollbar_Send's helper functions ; Parameters ....: $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_SendDebug("This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_SendInfo("This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_SendWarning("This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_SendError("This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_SendCritical("This is an critical message. If you received this, you were successful!", "Critical Message") ; Usable Example Local $sImportantFile = "C:\NOTAREALFILE_1234554321.txt" Switch FileExists($sImportantFile) Case True MsgBox(0, "Example Script", "An important file was found. Continuing...") Case Else _Rollbar_SendCritical('An important file was missing. Halting... File: "' & $sImportantFile & '"', 'Important file "' & $sImportantFile & '" is missing.') EndSwitch Notes: Please comment your feedback, advice, & suggestions below. While this is only a proof of concept, I will expand its feature set for everyone to use. Right now, it is fully functional but not tested in production. Changelog: RollbarSDK.au3 RollbarTest.au3 v0.2 v0.1.1
    1 point
  3. Exit, Note that after the Windows 8, 8.1 and 10 updates a month ago when UIA_Constants.au3 was introduced, junkew's code no longer works with my code. So please rewrite your chrome://accessibility/ function to work with my code. It shouldn't be that hard. SEKOMD, Excellent. You don't necessarily have to go through all the controls in the chain from the top window to the target control. You can usually go directly from the top window to the target control. I'll continue to develop and maintain the project. But since my project is about using the Microsoft code directly just translated into the AutoIt language but without a set of intermediate functions, I do not expect that much maintenance should be done. Get Internet Explorer URL In the example here, which is on Windows 7, I started running your (SEKOMD's) code above so Internet Explorer is already open on the Google page. 1. Open UIASpy, delete all top windows, place the mouse over the address bar, press F1 Create sample code: 2. Add complete initial code 3. Indentify and find top window 4. Indentify and find Edit control 5. Get $UIA_LegacyIAccessibleValuePropertyId control pattern property, the URL 6. Make the code executable by moving the code into the function #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "UIA_Constants.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_SafeArray.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Variant.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement( $pDesktop ) $oDesktop = ObjCreateInterface( $pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oDesktop ) Then Return ConsoleWrite( "$oDesktop ERR" & @CRLF ) ConsoleWrite( "$oDesktop OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0, $pCondition1, $pAndCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "IEFrame", $pCondition0 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "Google - Internet Explorer", $pCondition1 ) $oUIAutomation.CreateAndCondition( $pCondition0, $pCondition1, $pAndCondition1 ) If Not $pAndCondition1 Then Return ConsoleWrite( "$pAndCondition1 ERR" & @CRLF ) ConsoleWrite( "$pAndCondition1 OK" & @CRLF ) Local $pWindow1, $oWindow1 $oDesktop.FindFirst( $TreeScope_Descendants, $pAndCondition1, $pWindow1 ) $oWindow1 = ObjCreateInterface( $pWindow1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oWindow1 ) Then Return ConsoleWrite( "$oWindow1 ERR" & @CRLF ) ConsoleWrite( "$oWindow1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition2 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "Edit", $pCondition2 ) If Not $pCondition2 Then Return ConsoleWrite( "$pCondition2 ERR" & @CRLF ) ConsoleWrite( "$pCondition2 OK" & @CRLF ) Local $pEdit1, $oEdit1 $oWindow1.FindFirst( $TreeScope_Descendants, $pCondition2, $pEdit1 ) $oEdit1 = ObjCreateInterface( $pEdit1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oEdit1 ) Then Return ConsoleWrite( "$oEdit1 ERR" & @CRLF ) ConsoleWrite( "$oEdit1 OK" & @CRLF ) ; --- Control Pattern Properties --- ConsoleWrite( "--- Control Pattern Properties ---" & @CRLF ) Local $sLegacyIAccessibleValue1 $oEdit1.GetCurrentPropertyValue( $UIA_LegacyIAccessibleValuePropertyId, $sLegacyIAccessibleValue1 ) ConsoleWrite( "$sLegacyIAccessibleValue1 = " & $sLegacyIAccessibleValue1 & @CRLF ) EndFunc SciTE output: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pAndCondition1 OK $oWindow1 OK --- Find window/control --- $pCondition2 OK $oEdit1 OK --- Control Pattern Properties --- $sLegacyIAccessibleValue1 = https://www.google.com/
    1 point
  4. jchd

    Login script

    Yes, correct. Encryption of the file isn't mandatory, unless you insist on keeping names hidden in case some malvolent gets access to the file (users and logins may be distinct or not, depending on your use case). In allmost all cases, this simple scheme is safe enough since you can't be held responsible for passphrase leaking, even if the AutoIt executable is somehow reverse-engineered and the file is copied. Even home-jacking you and your kids isn't an effective way to recover working access: all you can give is file decryption key and salt value, not enough to impersonate any user. Obviously if the context requires very high robustness (keeping the number and identities/logins a secret) then extra measures can be taken, but then it's a completely different story. Yet you can do something to protect names and logins: encrypt them wih the user password just supplied. Your file then just contains a 2D table of meaningless binary data: hash(login & passphrase & salt), crypt(name), crypt(login). This way makes users protect their credentials by their own login/password. That said, a powerful opponent will probably find it easier to compromise physical access to you PC (trojan, hardware) or intercept the network flow at some point in your organization.
    1 point
  5. This single command works for me _ArrayDisplay(_FileListToArray(@ScriptDir, "*")) IMHO this kind of command window should not be intended to deal with variables
    1 point
  6. LarsJ, your library is a great job!!! Just super!!! ..it was hard for me to very understand(( in the end I figured out!!! Will you continue to develop the project? ============== for the purpose of experiment I tried to get the address of the link > I managed!! it's beautiful!! I did it on my own!! "UIA_Constants.au3" > download AllChromeTexts.7z from this post. My simple example - Getting URL from Google Page: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "UIA_Constants.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_SafeArray.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Variant.au3" ; Can be copied from UIASpy Includes folder #include <IE.au3> ;my simple mini-example: ; 1) Open IE > https://www.google.com ; 2) Getting current URL ; 3) Close window IE Opt("MustDeclareVars", 1) Example() Func Example() Local $oIE = _IECreate("https://www.google.com") ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface($sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation) If Not IsObj($oUIAutomation) Then Return ConsoleWrite("$oUIAutomation ERR" & @CRLF) ConsoleWrite("$oUIAutomation OK" & @CRLF) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement($pDesktop) $oDesktop = ObjCreateInterface($pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oDesktop) Then Return ConsoleWrite("$oDesktop ERR" & @CRLF) ConsoleWrite("$oDesktop OK" & @CRLF) ;====================================================================== ; --- Find window/control --- ConsoleWrite("--- Find window/control ---" & @CRLF) Local $pCondition0, $pCondition1, $pAndCondition1 $oUIAutomation.CreatePropertyCondition($UIA_ClassNamePropertyId, "IEFrame", $pCondition0) $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_WindowControlTypeId, $pCondition1) $oUIAutomation.CreateAndCondition($pCondition0, $pCondition1, $pAndCondition1) If Not $pAndCondition1 Then Return ConsoleWrite("$pAndCondition1 ERR" & @CRLF) ConsoleWrite("$pAndCondition1 OK" & @CRLF) Local $pCondition2, $pAndCondition2 $oUIAutomation.CreatePropertyCondition($UIA_NamePropertyId, "Google - Internet Explorer", $pCondition2) $oUIAutomation.CreateAndCondition($pAndCondition1, $pCondition2, $pAndCondition2) If Not $pAndCondition2 Then Return ConsoleWrite("$pAndCondition2 ERR" & @CRLF) ConsoleWrite("$pAndCondition2 OK" & @CRLF) Local $pWindow1, $oWindow1 $oDesktop.FindFirst($TreeScope_Descendants, $pAndCondition2, $pWindow1) $oWindow1 = ObjCreateInterface($pWindow1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oWindow1) Then Return ConsoleWrite("$oWindow1 ERR" & @CRLF) ConsoleWrite("$oWindow1 OK" & @CRLF) ; --- Find window/control --- ConsoleWrite("--- Find window/control ---" & @CRLF) Local $pCondition3, $pCondition4, $pAndCondition4 $oUIAutomation.CreatePropertyCondition($UIA_ClassNamePropertyId, "Frame Tab", $pCondition3) $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_PaneControlTypeId, $pCondition4) $oUIAutomation.CreateAndCondition($pCondition3, $pCondition4, $pAndCondition4) If Not $pAndCondition4 Then Return ConsoleWrite("$pAndCondition4 ERR" & @CRLF) ConsoleWrite("$pAndCondition4 OK" & @CRLF) Local $pPane1, $oPane1 $oWindow1.FindFirst($TreeScope_Descendants, $pAndCondition4, $pPane1) $oPane1 = ObjCreateInterface($pPane1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oPane1) Then Return ConsoleWrite("$oPane1 ERR" & @CRLF) ConsoleWrite("$oPane1 OK" & @CRLF) ; --- Find window/control --- ConsoleWrite("--- Find window/control ---" & @CRLF) Local $pCondition5, $pCondition6, $pAndCondition6 $oUIAutomation.CreatePropertyCondition($UIA_ClassNamePropertyId, "TabWindowClass", $pCondition5) $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_PaneControlTypeId, $pCondition6) $oUIAutomation.CreateAndCondition($pCondition5, $pCondition6, $pAndCondition6) If Not $pAndCondition6 Then Return ConsoleWrite("$pAndCondition6 ERR" & @CRLF) ConsoleWrite("$pAndCondition6 OK" & @CRLF) Local $pCondition7, $pAndCondition7 $oUIAutomation.CreatePropertyCondition($UIA_NamePropertyId, "Google - Internet Explorer", $pCondition7) $oUIAutomation.CreateAndCondition($pAndCondition6, $pCondition7, $pAndCondition7) If Not $pAndCondition7 Then Return ConsoleWrite("$pAndCondition7 ERR" & @CRLF) ConsoleWrite("$pAndCondition7 OK" & @CRLF) Local $pPane2, $oPane2 $oPane1.FindFirst($TreeScope_Descendants, $pAndCondition7, $pPane2) $oPane2 = ObjCreateInterface($pPane2, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oPane2) Then Return ConsoleWrite("$oPane2 ERR" & @CRLF) ConsoleWrite("$oPane2 OK" & @CRLF) ; --- Find window/control --- ConsoleWrite("--- Find window/control ---" & @CRLF) Local $pCondition8, $pCondition9, $pAndCondition9 $oUIAutomation.CreatePropertyCondition($UIA_ClassNamePropertyId, "Shell DocObject View", $pCondition8) $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_PaneControlTypeId, $pCondition9) $oUIAutomation.CreateAndCondition($pCondition8, $pCondition9, $pAndCondition9) If Not $pAndCondition9 Then Return ConsoleWrite("$pAndCondition9 ERR" & @CRLF) ConsoleWrite("$pAndCondition9 OK" & @CRLF) Local $pPane3, $oPane3 $oPane2.FindFirst($TreeScope_Descendants, $pAndCondition9, $pPane3) $oPane3 = ObjCreateInterface($pPane3, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oPane3) Then Return ConsoleWrite("$oPane3 ERR" & @CRLF) ConsoleWrite("$oPane3 OK" & @CRLF) ; --- Find window/control --- ConsoleWrite("--- Find window/control ---" & @CRLF) Local $pCondition10, $pCondition11, $pAndCondition11 $oUIAutomation.CreatePropertyCondition($UIA_ClassNamePropertyId, "Internet Explorer_Server", $pCondition10) $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_PaneControlTypeId, $pCondition11) $oUIAutomation.CreateAndCondition($pCondition10, $pCondition11, $pAndCondition11) If Not $pAndCondition11 Then Return ConsoleWrite("$pAndCondition11 ERR" & @CRLF) ConsoleWrite("$pAndCondition11 OK" & @CRLF) Local $pPane4, $oPane4 $oPane3.FindFirst($TreeScope_Descendants, $pAndCondition11, $pPane4) $oPane4 = ObjCreateInterface($pPane4, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement) If Not IsObj($oPane4) Then Return ConsoleWrite("$oPane4 ERR" & @CRLF) ConsoleWrite("$oPane4 OK" & @CRLF) ; --- Control Pattern Properties --- ConsoleWrite("--- Control Pattern Properties ---" & @CRLF) Local $sLegacyIAccessibleName1 $oPane4.GetCurrentPropertyValue($UIA_LegacyIAccessibleNamePropertyId, $sLegacyIAccessibleName1) ConsoleWrite("$sLegacyIAccessibleName1 = " & $sLegacyIAccessibleName1 & @CRLF) _IEQuit($oIE) MsgBox(64, 'Getting URL', 'Result: ' & $sLegacyIAccessibleName1) EndFunc ;==>Example
    1 point
  7. jchd

    Login script

    You should never ever store passphrases! Just store the user name and the hash made from login name, passphrase and preferably some salt. Validating input then means collecting login name and pass then checking the resulting hash is correct.
    1 point
  8. Inpho, Alas this is a limitation of the MS object used to create the marquee. I too would love to be able to reduce that annoying gap, but I have not been able to do it so far. M23
    1 point
  9. ISI360

    ISN AutoIt Studio

    Hi guys! Itยดs update time again! ISN AutoIt Studio version 1.09 is online! A special thanks for beta testing this time goes to the user @Rex ! ๐Ÿ˜Ž Happy testing, and as always: Feedback desired ๐Ÿ‘ Changelog (translated with google):
    1 point
  10. @jmp - You are not qualified enough in coding to be selling scripts. Give up now and we can all pretend it was a silly dream.
    1 point
  11. This post has been edited due to @LarsJ request in the after next post @LarsJ Many thanks for this very usefull sample ๐Ÿ˜ƒ I have written a small function to handle accessibility. You just put these 2 lines at the beginning of your script and accessibility is established. #include "_UIA_ChromeAccessibility.au3" _UIA_ChromeAccessibility() Here is the funtion "_UIA_ChromeAccessibility.au3" #include-once #include <UIA_Constants.au3> ; http://autoitscript.com/forum/index.php?showtopic=153520 ;============================================================================================================== ; UDF Name: _UIA_ChromeAccessibility.au3 ; Description: iMode=0 Switch Chrome browser to accessiblility OFF. ; iMode=1 Switch Chrome browser to accessiblility ON. ; iMode=2 Return current Chrome browsers accessiblility Status. ; iMode=3 Debug current Chrome browsers accessiblility Status page. ; ; Syntax: _UIA_ChromeAccessibility([iMode=1]) ; Default: iMode=1 ; Parameter(s): iMode: 0/1/2/3 see above ; Requirement(s): #include "UIA_Constants.au3" ; http://autoitscript.com/forum/index.php?showtopic=153520 ; Return Value(s): -1= error @error=1 invalid iMode ; @error=2 "Chrome.exe" not found ; 0= accessiblility Status is OFF @error=0 ; 1= accessiblility Status is ON @error=0 ; Example: ; #include <_UIA_ChromeAccessibility.au3> ; http://autoitscript.com/forum/index.php?showtopic=1425848&view=findpost&p=1425848 ; $rc=_UIA_ChromeAccessibility() ; Set Chrome accessibility to 1 (ON) ( iMode defaults to 1 ) ; MsgBox(Default, Default, "Set Chrome accessibility to " & $rc, 0) ; ; Author: Exit ( http://www.autoitscript.com/forum/user/45639-exit ) ; SourceCode: http://autoitscript.com/forum/index.php?showtopic=1425848&view=findpost&p=1425848 ; COPYLEFT: © 2019 Freeware by "Exit" ; ALL WRONGS RESERVED ;============================================================================================================== Func _UIA_ChromeAccessibility($iMode = 1) Local $sVersion = "Version: 2019.05.11" Local $return, $hWin, $bAccInt, $pEdit, $oEdit, $pPattern, $oPattern Local $pDesktop, $oDesktop, $pCond, $pPane1, $oPane1, $pCheckBox, $oCheckBox, $pText, $oText Local $oUIAutomation = ObjCreateInterface($sCLSID_CUIAutomation8, $sIID_IUIAutomation5, $dtag_IUIAutomation5) If Not ($iMode = 0 Or $iMode = 1 Or $iMode = 2 Or $iMode = 3) Then Return SetError(1, 0, -1) ; invalid iMode If Not ProcessExists("chrome.exe") Then ; we create a new window to retain the wanted accessibility If ShellExecute("chrome.exe", ($iMode == 1 ? "--force-renderer-accessibility " : "")) < 1 Then Return SetError(2, 0, -1) ; "Chrome.exe" not found Else Return SetError(0, 0, ($iMode == 1 ? 1 : 0)) ; return current acceibility mode ( 0 or 1) EndIf EndIf ;~ chrome://accessibility "--force-renderer-accessibility --new-window --window-position=200,200 --window-size=100,100" ShellExecuteWait("chrome.exe", " --new-window file:none") ; create a new temporary chrome window to test/change accessibility While WinGetTitle("[ACTIVE]") <> "file://none/ - Google Chrome" ; allow Chrome to activate panel WEnd $hWin = WinGetHandle("[active]") WinMove($hWin,"",-200,-200,100,100) ;~ WinSetState($hWin, "", @SW_MINIMIZE) $oUIAutomation.GetRootElement($pDesktop) $oDesktop = ObjCreateInterface($pDesktop, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8) $oUIAutomation.CreatePropertyCondition($UIA_ClassNamePropertyId, "Chrome_WidgetWin_1", $pCond) $oDesktop.FindFirst($TreeScope_Descendants, $pCond, $pPane1) $oPane1 = ObjCreateInterface($pPane1, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8) $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_TextControlTypeId, $pCond) $oPane1.FindFirst($TreeScope_Descendants, $pCond, $pText) $oText = ObjCreateInterface($pText, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8) If IsObj($oText) And $iMode = 1 Then $bAccInt = 1 ; indicate that accewssibility is already active Else $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_EditControlTypeId, $pCond) $oPane1.FindFirst($TreeScope_Descendants, $pCond, $pEdit) $oEdit = ObjCreateInterface($pEdit, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8) $oEdit.GetCurrentPattern($UIA_LegacyIAccessiblePatternId, $pPattern) $oPattern = ObjCreateInterface($pPattern, $sIID_IUIAutomationLegacyIAccessiblePattern, $dtag_IUIAutomationLegacyIAccessiblePattern) $oPattern.SetValue("chrome:accessibility") $oEdit.SetFocus() ControlSend($hWin, "", "", "{ENTER}") While WinGetTitle($hWin) <> "Accessibility Internals - Google Chrome" ; allow Chrome to switch panel WEnd $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_CheckBoxControlTypeId, $pCond) $oPane1.FindFirst($TreeScope_Descendants, $pCond, $pCheckBox) $oCheckBox = ObjCreateInterface($pCheckBox, $sIID_IUIAutomationElement8, $dtag_IUIAutomationElement8) $bAccInt = IsObj($oCheckBox) EndIf Select Case $iMode = 3 MsgBox(64 + 262144, Default, "ChromeAccessibility is " & ($bAccInt ? "ON" : "OFF") & @LF & @LF & "Verify the checkboxes and press OK to continue." & @LF & @LF & @LF & $sVersion, 30) ContinueCase Case $iMode = 2 $return = SetError(0, 0, $bAccInt) Case $iMode = $bAccInt $return = SetError(0, 0, $iMode) Case Else For $i = 1 To 5 ControlSend($hWin, "", "", "{TAB " & $i & "}{SPACE}") ; toggle all 5 checkboxes Sleep(100) Next $return = SetError(0, 0, $iMode) EndSelect Sleep(100) WinKill($hWin) Return $return EndFunc ;==>_UIA_ChromeAccessibility Here a small testcase: ;~ Elevate Chrome browser to accessiblility #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include "_UIA_ChromeAccessibility.au3" Opt( "MustDeclareVars", 1 ) Func _run($id = 1) Local $rc = _UIA_ChromeAccessibility($id) ConsoleWrite(" ID: " & $id & " RC: " & $rc & @LF) EndFunc ;==>_run _run(2) _run(0) _run(1) _run(4) _run(3) _run() I hope this little function is helpfull for you. Thanks Exit
    1 point
  12. Get all texts in a Chrome document This example shows how to extract all texts in a Chrome document. The previous webpage (page 2) is used as an example. Don't forget this: To be able to spy on web content in Google Chrome it's necessary to enable accessibility by entering chrome://accessibility/ in the address bar of a new tab item, and then check the five check boxes that are located in a column in upper left corner down along the left edge. Then the accessibility tab can be closed again. It's a global setting that applies to all open and new tabs until Chrome is closed. Without accessibility enabled you are only able to investigate the outer elements of Chrome but not web content. SampleCode1.au3 shows how to find the first text (SampleCode1-a.au3 is the code generated directly by UIASpy): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "UIA_Constants.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_SafeArray.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Variant.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement( $pDesktop ) $oDesktop = ObjCreateInterface( $pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oDesktop ) Then Return ConsoleWrite( "$oDesktop ERR" & @CRLF ) ConsoleWrite( "$oDesktop OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "Chrome_WidgetWin_1", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) Local $pPane1, $oPane1 $oDesktop.FindFirst( $TreeScope_Descendants, $pCondition0, $pPane1 ) $oPane1 = ObjCreateInterface( $pPane1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oPane1 ) Then Return ConsoleWrite( "$oPane1 ERR" & @CRLF ) ConsoleWrite( "$oPane1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_TextControlTypeId, $pCondition1 ) If Not $pCondition1 Then Return ConsoleWrite( "$pCondition1 ERR" & @CRLF ) ConsoleWrite( "$pCondition1 OK" & @CRLF ) Local $pText1, $oText1 $oPane1.FindFirst( $TreeScope_Descendants, $pCondition1, $pText1 ) $oText1 = ObjCreateInterface( $pText1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oText1 ) Then Return ConsoleWrite( "$oText1 ERR" & @CRLF ) ConsoleWrite( "$oText1 OK" & @CRLF ) EndFunc SciTE output: $oUIAutomation OK $oDesktop OK --- Find window/control --- $pCondition0 OK $oPane1 OK --- Find window/control --- $pCondition1 OK $oText1 OK SampleCode2.au3 shows how to find all texts (SampleCode2-a.au3 is the code generated directly by UIASpy): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ;#AutoIt3Wrapper_UseX64=n ; If target application is running as 32 bit code ;#AutoIt3Wrapper_UseX64=y ; If target application is running as 64 bit code #include "UIA_Constants.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Functions.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_SafeArray.au3" ; Can be copied from UIASpy Includes folder ;#include "UIA_Variant.au3" ; Can be copied from UIASpy Includes folder Opt( "MustDeclareVars", 1 ) Example() Func Example() ; Create UI Automation object Local $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtag_IUIAutomation ) If Not IsObj( $oUIAutomation ) Then Return ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ; Get Desktop element Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement( $pDesktop ) $oDesktop = ObjCreateInterface( $pDesktop, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oDesktop ) Then Return ConsoleWrite( "$oDesktop ERR" & @CRLF ) ConsoleWrite( "$oDesktop OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition0 $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "Chrome_WidgetWin_1", $pCondition0 ) If Not $pCondition0 Then Return ConsoleWrite( "$pCondition0 ERR" & @CRLF ) ConsoleWrite( "$pCondition0 OK" & @CRLF ) Local $pPane1, $oPane1 $oDesktop.FindFirst( $TreeScope_Descendants, $pCondition0, $pPane1 ) $oPane1 = ObjCreateInterface( $pPane1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oPane1 ) Then Return ConsoleWrite( "$oPane1 ERR" & @CRLF ) ConsoleWrite( "$oPane1 OK" & @CRLF ) ; --- Find window/control --- ConsoleWrite( "--- Find window/control ---" & @CRLF ) Local $pCondition1 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_TextControlTypeId, $pCondition1 ) If Not $pCondition1 Then Return ConsoleWrite( "$pCondition1 ERR" & @CRLF ) ConsoleWrite( "$pCondition1 OK" & @CRLF ) #cs Local $pText1, $oText1 $oPane1.FindFirst( $TreeScope_Descendants, $pCondition1, $pText1 ) $oText1 = ObjCreateInterface( $pText1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) If Not IsObj( $oText1 ) Then Return ConsoleWrite( "$oText1 ERR" & @CRLF ) ConsoleWrite( "$oText1 OK" & @CRLF ) #ce Local $pElements $oPane1.FindAll( $TreeScope_Descendants, $pCondition1, $pElements ) ; --- Code Snippets --- ConsoleWrite( "--- Code Snippets ---" & @CRLF ) Local $oUIElementArray1, $iLength1 ; $pElements is a pointer to an UI Automation element array $oUIElementArray1 = ObjCreateInterFace( $pElements, $sIID_IUIAutomationElementArray, $dtag_IUIAutomationElementArray ) $oUIElementArray1.Length( $iLength1 ) If Not $iLength1 Then Return ConsoleWrite( "$iLength1 = 0 ERR" & @CRLF ) ConsoleWrite( "$iLength1 = " & $iLength1 & @CRLF ) ; --- Code Snippets --- ConsoleWrite( "--- Code Snippets ---" & @CRLF ) Local $pElement1, $oElement1, $sValue1 For $i = 0 To $iLength1 - 1 $oUIElementArray1.GetElement( $i, $pElement1 ) $oElement1 = ObjCreateInterface( $pElement1, $sIID_IUIAutomationElement, $dtag_IUIAutomationElement ) $oElement1.GetCurrentPropertyValue( $UIA_NamePropertyId, $sValue1 ) ConsoleWrite( "$sValue1 = " & $sValue1 & @CRLF ) Next EndFunc SampleCode2.au3 is a continuation of SampleCode1.au3 where FindFirst is replaced with FindAll and code snippets are added to Create an UI Automation element array from pointer Traverse an array to get access to individual elements The code snippets are added รญn two steps in UIASpy. It's only possible to use item 2 if item 1 is completed. Item 2 is simply not shown in the listview unless item 1 is completed. SciTE output (in part, see SampleCode2.txt): $oUIAutomation OK $oDesktop OK --- Find window/control --- $pCondition0 OK $oPane1 OK --- Find window/control --- $pCondition1 OK --- Code Snippets --- $iLength1 = 3768 --- Code Snippets --- $sValue1 = Existing user? Sign In   $sValue1 = ? $sValue1 = Sign Up $sValue1 = Browse $sValue1 = Forums $sValue1 = Downloads $sValue1 = Calendar $sValue1 = Forum Rules $sValue1 = Wiki $sValue1 = AutoIt Resources $sValue1 = ? $sValue1 = FAQ $sValue1 = Our Picks $sValue1 = ? $sValue1 = $sValue1 = All Activity $sValue1 = ? $sValue1 = Home $sValue1 = ? $sValue1 = AutoIt v3 Search for SEKOMD in SampleCode2.txt to see all activity of this user. Why is the URL in the address bar not included in the texts? Because the address bar is part of the outer elements of the Chrome window and therefore not included in the web document itself. AllChromeTexts.7z
    1 point
  13. Jos

    #Include not working

    I am sure you have done a right-mouse-click on a *.au3 file and done a "Run With" that old version and ticked the "alway use this program box". Install the full SciTE4AutoIt3 version, run SciTEConfig (Ctrl+1 when you have a au3 file opened); Select Other tools tab and press button: "Run AutoIt3/SciTE check". This will show a separate window with all registry information found and report on any deviations from the default. Jos
    1 point
  14. MrMitchell

    Tomorrow date

    One way... #include <Date.au3> $sNewDate = _DateAdd( 'd',1, _NowCalcDate()) ConsoleWrite($sNewDate & @CRLF) $aNewDate = StringSplit($sNewDate, "/", 2) $sNewDateggmmaaaa = $aNewDate[2] & $aNewDate[1] & $aNewDate[0] ConsoleWrite($sNewDateggmmaaaa & @CRLF)
    1 point
  15. Sorry Exit, but you'll have to live with the 7z-files.
    0 points
×
×
  • Create New...