Jump to content

BigDaddyO

Active Members
  • Posts

    932
  • Joined

  • Last visited

  • Days Won

    4

BigDaddyO last won the day on August 26 2025

BigDaddyO had the most liked content!

About BigDaddyO

  • Birthday 09/27/1975

Profile Information

  • Location
    New York
  • Interests
    Woodworking

Recent Profile Visitors

1,984 profile views

BigDaddyO's Achievements

  1. nope, access is by Active Directory so no mater what laptop or citrix box I'm logged into I can access the database. So, this solution only works if you are in a corporate world.
  2. I have to use passwords in a lot of my scripts. I have an SQL server where each script has it's own database where I store passwords as an encrypted string along with any other config/test/log data. I also only allow specific users access to that database via AD. The decryption keys are also unique to each script. This lets me keep passwords secure and lets me control who can access my apps as if the database connection fails then the app closes with a message to contact me for access.
  3. Take a look at the help file for StdoutRead you would need to put in a loop waiting for the output you want before closing the app.
  4. Same, it doesn't seem to work before displaying the UI. It doesn't set @error either.
  5. Remove the ' at the end and begining of your RunWait and it should work
  6. This will take text, split it up into an array, then display a random word from that array. $sTextToSearch = "If you use an empty string "" for the delimiters, each character will be returned as an element." & @CRLF & _ "If the delimiter string contains several characters function behaviour depends on the flag setting. If set to $STR_CHRSPLIT the string will be split at every instance of each of the individual characters in the delimiter - if set to $STR_ENTIRESPLIT then the string will only be split when the entire delimiter string is encountered. See second example below." & @CRLF & _ "Note that the macro @CRLF is actually a 2 character string, so unless the flag parameter to $STR_ENTIRESPLIT extra blank lines will be generated as the string is split on both @CR and @LF." $sTextNoCR = StringReplace($sTextToSearch, @CRLF, " ") $sText = StringStripWS($sTextNoCR, 4) $aWords = StringSplit($sTextToSearch, " ") MsgBox(0, "Random Word", $aWords[Random(0, UBound($aWords) - 1)])
  7. I've had luck in the past with identifying the background color then using GDI+ to remove that color from the entire image... BUT! it looks like your background color is the same color as your actual text you are looking for so that's not going to help. I know you said you have to use OCR, but If all your looking for is text off the screen somewhere, have you tried using the Cmd options to select all/copy and then look in the clipboard text for the possible header text you want? or, see if the Au3Info object spy can read the text from the window so you can use WinGetText("C:\Windows\system32\cmd.exe", "")
  8. your mixing up the UIA Automation and the built in commands. Use the AU3info to get the control that you want to use the controlclick on. If that doesn't show the control info, then you need to use UIA to perform the click [ .Invoke() or .Select() ] depending on the control
  9. Looks like all those menu items have keyboard shortcut you could use instead of using the menu (Alt+Shift+S). Or, when the menu is displayed, use Alt + whatever letter is underlined to activate that item. Try it manually with your keyboard to find the right keys, then use with Send or preferably ControlSend.
  10. I'm looking for help with getting the background color of a text control using UI Automation. I can't figure out how to use the $UIA_BackgroundColorAttributeId The end goal is when submitting a new record into a website, if there are any problems with the submission, text will be displayed with a red background color. The only identifying options for that error message is that the ControlType = $UIA_TextControlTypeId and the background is red. So, if the record doesn't save i'll scan the screen and pull the text out of the error message and save it to my log file. "Currently i'm forced to take screenshots to know what happened which takes much longer to review and can't be easily grouped by error" I found the Wikipedia main page has a similar text control with a green background that I built a sample for. So, anybody know how to get the green background color from that wiki page? #include ".\Include\UIAWrappers.au3" ; GetAttributeValue $UIA_BackgroundColorAttributeId ;Sample written to get the background color of the "From today's featured article" text control on "https://en.wikipedia.org/wiki/Main_Page" ;This example only works if Chrome is open to Wiki Main page and no other tabs are open ; Ultimatly, I want to scan an entire page looking for any text control that has a specific background color (Error Messages) WinWait("Wikipedia, the free encyclopedia", "", 30) ;Create UI Automation object that will be used by all the tests $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) If Not IsObj( $oUIAutomation ) Then If Not @Compiled Then ConsoleWrite( "$oUIAutomation ERR" & @CRLF ) Exit EndIf If Not @Compiled Then ConsoleWrite( "$oUIAutomation OK" & @CRLF ) ;Setup the UIAutomation Local $pDesktop, $oDesktop $oUIAutomation.GetRootElement( $pDesktop ) $oDesktop = ObjCreateInterface( $pDesktop, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If IsObj( $oDesktop ) Then If Not @Compiled Then ConsoleWrite( "$oDesktop OK" & @CRLF ) ;Get the Main Chrome window Local $pCondition ; Note that $UIA_ClassNamePropertyId is CASE SENSITIVE $oUIAutomation.CreatePropertyCondition( $UIA_ClassNamePropertyId, "Chrome_WidgetWin_1", $pCondition ) Local $pIE, $oUIaIE $oDesktop.FindFirst( $TreeScope_Descendants, $pCondition, $pIE ) $oIEdialog = ObjCreateInterface( $pIE, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If IsObj( $oIEdialog ) Then If Not @Compiled Then ConsoleWrite( "Found Chrome_WidgetWin_1" & @CRLF ) Local $pCondition $oUIAutomation.CreatePropertyCondition($UIA_AutomationIdPropertyId, "content", $pCondition ) Local $pIE, $oUIaIE $oIEdialog.FindFirst( $TreeScope_Descendants, $pCondition, $pIE ) $oIEframe = ObjCreateInterface( $pIE, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If IsObj( $oIEframe ) Then If Not @Compiled Then ConsoleWrite( "Found content AutomationID" & @CRLF ) EndIf EndIf EndIf ;Get the text control [From today's featured article] that has a green background Local $pCondition, $pCondition1, $pCondition2 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_TextControlTypeId, $pCondition1 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "From today's featured article", $pCondition2 ) $oUIAutomation.CreateAndCondition( $pCondition1, $pCondition2, $pCondition ) Local $pElements, $oElement $oIEframe.FindFirst( $TreeScope_Descendants, $pCondition, $pElements ) $oElement = ObjCreateInterface($pElements, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) If IsObj( $oElement ) Then If Not @Compiled Then ConsoleWrite("Found the text message we were looking for!" & @CRLF ) EndIf ;JUST THROWING STUFF AT THE WALL FROM HERE. How do I get the Green background color of the text? Local $pTextPattern, $sBkColor $oElement.GetCurrentPattern($UIA_TextPattern2Id, $pTextPattern) $oPattern = ObjCreateInterface($pTextPattern, $sIID_IUIAutomationElement, $dtagIUIAutomationElement) If IsObj($oPattern) Then ConsoleWrite("Found Current Pattern" & @CRLF) Else ConsoleWrite("Unable to find Pattern" & @CRLF) EndIf ;~ $oPattern.DocumentRange($Document_Range) ;~ $oPattern.GetAttributeValue($pTextPattern.BackgroundColorAttribute) ;~ $oElement.DocumentRange.GetAttributeValue($pTextPattern.BackgroundColorAttribute) $oElement.GetCurrentPropertyValue($UIA_BackgroundColorAttributeId, $sBkColor) ConsoleWrite("Background color = (" & $sBkColor & ")" & @CRLF) Any help would be GREATLY appreciated! Thanks, Mike
  11. Have you tried to find a Key sequence you could send to the window to activate the button, like Shift+Alt+M? perhaps you could look through the help file to find the right key sequence. Also, I have automated a mainframe app in the past "BlueZone" which has an automation dll which I can connect to and is able to launch stored macro's. I assume the software you are using would have automation as well. You should find and look through any help documents you can find for your software.
  12. Not sure how you run the debugging but if any functions in there are called by your main script then it will error if you don't include that. You might just want to include If Not @Compiled before any line that uses the debug stuff. that way including it will not cause an issue, it just won't run debug if it's compiled.
  13. I'm trying to convert a sql that's in a single line back into a nicely formatted string but i'm having problems with the comma's when they are within a command such as SUBSTR for an Example: Select SUBSTR(sx.YMD, 5, 2) || '/' || SUBSTR(sx.YMD, 7, 2) || '/' || SUBSTR(sx.YMD, 1, 4) as RecvDt, TRIM(sx.MBR) as MbrNbr From Services currently comes out as Select SUBSTR(sx.YMD,      5,      2) || '/' || SUBSTR(sx.YMD,      7,      2) || '/' || SUBSTR(sx.YMD,      1,      4) as RecvDt,      TRIM(sx.MBR) as MbrNbr From Services Where it should show as Select SUBSTR(sx.YMD, 5, 2) || '/' || SUBSTR(sx.YMD, 7, 2) || '/' || SUBSTR(sx.YMD, 1, 4) as RecvDt,      TRIM(sx.MBR) as MbrNbr From Services This is what i've coded so far. I'm pretty sure I need to use a StringRegExpReplace to replace the , only when it's not within a ( ) but i'm not sure how to do it. Anyone have some RegEx pointers? $sSQL = "Select SUBSTR(sx.YMD, 5, 2) || '/' || SUBSTR(sx.YMD, 7, 2) || '/' || SUBSTR(sx.YMD, 1, 4) as RecvDt, TRIM(sx.MBR) as MbrNbr From Services" $sSQL = StringReplace($sSQL, ",", "," & @CRLF & @TAB) ;Only replace , with , & @CRLF & @TAB if that , is not within ( ) ;~ StringRegExpReplace($sSQL, " $sSQL = StringReplace($sSQL, " Select ", @CRLF & "Select" & @CRLF & @TAB) $sSQL = StringReplace($sSQL, "From ", @CRLF & "From ") $sSQL = StringReplace($sSQL, "Join ", @CRLF & "Join ") $sSQL = StringReplace($sSQL, "Left Join ", @CRLF & "Left Join ") $sSQL = StringReplace($sSQL, "Inner Join ", @CRLF & "Inner Join ") $sSQL = StringReplace($sSQL, "Outer Join ", @CRLF & "Outer Join ") $sSQL = StringReplace($sSQL, "ON ", @CRLF & @TAB & "ON ") $sSQL = StringReplace($sSQL, "Where ", @CRLF & "Where ") $sSQL = StringReplace($sSQL, "AND ", @CRLF & "AND ") ConsoleWrite(@CRLF & $sSQL & @CRLF & @CRLF) Thanks, Mike
  14. Nine did help you. you need to look in the help file at _GUICtrlButton_GetCheck it even has an example. if that function is not working for you, post the code you use as a test and show what the return from the function is.
  15. The data you want from the consolewrite IS in the stdout stream, you just need to update your python code to read it. I don't use Python, but perhaps this will help. https://www.cyberciti.biz/faq/python-run-external-command-and-get-output/
×
×
  • Create New...