Jump to content

keeeniiic

Members
  • Posts

    7
  • Joined

  • Last visited

keeeniiic's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. @Bilgus thank you for the suggestion @water thank you for the hint, won't happen again. Thank you for the last answers, would this code cover, if the user reopens the window, because this happens quite often, they work in the "Test 2 ... " window then close it open another one and later come back to the "Test 2.. " window. Let me know thanks
  2. wow, this is great, thank you very much.
  3. Hello all, my goal is to observe a open application and read the visual text, filter for a specific value and based on that value to refresh a sidebar using an http call. This code is working but it is my first AutoIt Coding Experience and this is why I am asking you for any potential code optimization, as I have to observe many more Windows and in order to make this clean I ask for your assistance. So the goals are: Run invisible in the Background Observe open Window of Application (only do something if the Windows is open) Read Visual Text and get specific value (Vendor Number) If this Number changes, update the sidebar using http call Here is the code: #include "Array.au3" #include "WinHttp.au3" #include "WinAPI.au3" #include "WindowsConstants.au3" #include "StringConstants.au3" Global $lieferant, $firstRun, $lieferantChanged $firstRun = True Func observe() While not WinExists("Test2 Rechnungskontrolle (Verbuchung)") Sleep(250) WEnd While WinExists("Test2 Rechnungskontrolle (Verbuchung)") Sleep(250) if($firstRun) Then getLieferant() $firstRun = False EndIf isChanged() getLieferant() Wend EndFunc Func getLieferant() if(WinExists("Test2 Rechnungskontrolle (Verbuchung)")) Then local $strString = WinGetText("Test2 Rechnungskontrolle (Verbuchung)") local $arrResult = StringRegExp($strString, '(?s)&Adresse.*?\d+.*?(\d+)', $STR_REGEXPARRAYGLOBALMATCH) If IsArray($arrResult) Then $lieferant = $arrResult[0] Return $lieferant Else observe() EndIf EndFunc Func isChanged() if(WinExists("Test2 Rechnungskontrolle (Verbuchung)")) Then local $strString = WinGetText("Test2 Rechnungskontrolle (Verbuchung)") local $arrResult = StringRegExp($strString, '(?s)&Adresse.*?\d+.*?(\d+)', $STR_REGEXPARRAYGLOBALMATCH) If IsArray($arrResult) Then $lieferantChanged = $arrResult[0] If $lieferantChanged == $lieferant Then getLieferant() Else ;MsgBox(0,"Changed",$lieferantChanged) ConsoleWrite($lieferantChanged) refreshSidebar($lieferantChanged) getLieferant() EndIf Else observe() EndIf EndFunc Func refreshSidebar($vendorID) Opt("MustDeclareVars", 1) ; Initialize and get session handle Global $hOpen = _WinHttpOpen() ; Get connection handle Global $hConnect = _WinHttpConnect($hOpen, "http://MKSRVAPP04:25024") Local $hRequest = _WinHttpSimpleRequest($hConnect, "GET", "api/client/sidebar/sendCommand?user=MULTIKRAFT\" & @UserName & "&call=OBJ:Vendor@@SELECT@@IDX:Vendor%20ID=" & $vendorID) ; Close handles _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) EndFunc observe() Thank you very much! Best Regards Kenan
  4. Hi Francesco, so I managed to make this Code: #include <Array.au3> #include <StringConstants.au3> Global $storeOld, $storeOldhelper, $lieferant, $strString Func getLieferant() $strString = WinGetText("Test2 Rechnungskontrolle (Verbuchung)") $arrResult = StringRegExp($strString, '(?s)&Adresse.*?\d+.*?(\d+)', $STR_REGEXPARRAYGLOBALMATCH) If IsArray($arrResult) Then $lieferant = $arrResult[0] Return $lieferant EndFunc Func isChanged() $strString = WinGetText("Test2 Rechnungskontrolle (Verbuchung)") $arrResult = StringRegExp($strString, '(?s)&Adresse.*?\d+.*?(\d+)', $STR_REGEXPARRAYGLOBALMATCH) If IsArray($arrResult) Then $lieferantChanged = $arrResult[0] If $lieferantChanged == $lieferant Then getLieferant() Else MsgBox(0,"Changed",$lieferantChanged) EndIf getLieferant() AdlibRegister(isChanged(),1000) ; call this function again in 1 second EndFunc isChanged() I'm new to programming and to autoit, this code works partly not on every change if I switch faster then in 1 second for example and this is not reliable for me, do you have any suggestion for me how I can monitor the input better? Thanks.
  5. I don't need a GUI, it should and actually must run in the background. But if I do it by time this would mean it is not monitoring live the change of the user, I actually need to monitor this value, if you tell me that this should be possible with the AdLib and or Timer functions then let me know. Thanks for your help. Best regards
  6. Thank you very much, this was the Solution. Now if you could help me how I can put this in kind of WatchDog Service that it recognises if the Value has changed in order to be able to change the other applications GUI based on this number. Thank you!
  7. Hello Community, I found your Software to solve a Problem I have. So I have an Application which needs to Update the GUI of another Application based on the Content of the first Application. I managed to get the Text of the first Application using this: $Text=WinGetText("Test2 Rechnungskontrolle (Verbuchung)") As a return I get this: ? 01.10.2018 Bankeinzug 1% Skonto SFru Beleg geprüft Überweisung 5 Bank: Bankkonto: IBAN: Verteilergruppe: Bemerkung: Valutadatum: Zahlungsziel: Zahlungsart: SB Prüfung: Bankverb Konto: Fr 28.09.2018 01.10.2018 SFru Fr 28.09.2018 &Zuschläge SFru AR000304858 F&reigabe EUR 0 A 4672 Bachmanning GutschrErzeugen Unterseling 13 Beleg freigegeben Schmalwieser GesmbH & Co KG &Parameter Solan Kraftfutterwerk &Adresse 306812 701015 Lieferant: Belegnummer: Name: Straße: Ort: Währung: RechnungsNr: Sachbearbeiter: Rechnungsdatum: Wiedervorlage: angelegt durch: Belegdatum: Basisdaten|Zuschläge|Steuer So I need now this Bold Number above, how can I manage this using RegEx or is there another solution, with the Window Info tool I can actually drop the mouse tool directly on this Number 701015. The Contents of the Window Info Tool is following: Please anyone can help me I need this Number to be able to change the gui of the second application. Also as second part I need then this script to run like a service and watch this window live and see if this Value is changing in order to be able to update the second application via an http rest call. Thank you!
×
×
  • Create New...