Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

TABs and funktions is getting ignored

$
0
0

Hi all,

 

I have a Problem with my script and I am new to AutoIt. What I want:

 

1. go to excel

2. copy a cell

3. go to my program

4. TAB 26 times to an specific field

5. paste the cell

6. go to Excel and to the next cell

7. start again

 

/Code in the End/

 

So it is all working, but sometimes my Script or PC or whatever is jumping only 25 times. Sometimes it doesn´t jump at all.

It is not all the time. Sometimes after 10 loots the jumps are wrong, sometimes after 160 , sometime everything goes well. So I have no idea how to figer it out. And what can couse this.

Something with Thread/Memory management or other Prozesses or just someting wrong in the script that couse it to crush sometimes.

 

I can not cominiicate with my program, so i can´t ask for field IDs or something like that.

Also mouse is not recomended.

 

For wrong jumps and errors  I am using Pixel CheckSums.

1. left, right, over and under the filed I want to paste someting in.

 

Maybe this is breaking the code in the rumetime ?

 

So here is my Script:

AutoIt         
  1. Local $iAnswer = MsgBox(BitOR($MB_YESNO, $MB_SYSTEMMODAL), "Umstellung Union", "Umstellung - UNION"
  2.  
  3. If $iAnswer = 7 Then
  4.     MsgBox($MB_SYSTEMMODAL, "Bye bye", "OK.  Bye!")
  5.     Exit
  6.  
  7. Func jumpToUnion() ;My jump funktion
  8.     AutoItSetOption("SendKeyDelay", 50)
  9.     Send("{TAB 26}")
  10.     sleepTime100()
  11.  
  12. Func sleepTime100()
  13.     Sleep(100)
  14.  
  15. Func sleepTime20()
  16.     Sleep(20)
  17.  
  18. ;Funktions for the Pixel Check Sums
  19.  
  20. Func checkPixelUpDown()
  21.  
  22. If $iCheckSumOben <> PixelChecksum(50, 200, 1230, 410) Then
  23.         MsgBox($MB_SYSTEMMODAL, "", "Ungültige Änderung! Im oberen Fensterbereich ")
  24.         Exit
  25.        
  26. If $iCheckSumUnten <> PixelChecksum(50, 485, 1230, 780) Then
  27.         MsgBox($MB_SYSTEMMODAL, "", "Ungültige Änderung! Im unteren Fensterbereich")
  28.         Exit
  29. EndIf      
  30.  
  31. Func checkPixelUnion()
  32.  
  33. If $iCheckSumUnionL <> PixelChecksum(50, 420, 620, 490) Then
  34.         MsgBox($MB_SYSTEMMODAL, "", "Ungültige Änderung! Links vom Unionsfeld")
  35.         Exit
  36. EndIf      
  37. If $iCheckSumUnionR <> PixelChecksum(930, 420, 1230, 490) Then
  38.         MsgBox($MB_SYSTEMMODAL, "", "Ungültige Änderung! Rechts vom Unionsfeld")
  39.         Exit
  40. EndIf      
  41.  
  42. Func checkPixelNextPage()
  43. If $iCheckSumNextPage <> PixelChecksum(50, 215, 100, 360) Then
  44.         MsgBox($MB_SYSTEMMODAL, "", "Ungültige Änderung! Auf zweiter Seite gesprungen")
  45.         Exit
  46.  
  47. ;Checkt für ungültiges Kammando
  48. Func checkPixelWrongAction()
  49. If $iCheckSumWrongAction <> PixelChecksum(150, 930, 270, 960) Then
  50.         MsgBox($MB_SYSTEMMODAL, "", "Ungültige Änderung! Ungültige Eingaben, SICLID bleibt hängen --> Fehler")
  51.         Exit
  52.  
  53.  
  54. Local $sAnswer = InputBox ( "Anzahl der Haendler", "Anzahl der HändlerNummern") ; getting the loops
  55.  
  56. For $i = 1 To $sAnswer
  57.  
  58. ;Go to Excel
  59. WinActivate("Microsoft Excel - TestExcelSource.xlsx")
  60. sleepTime20()
  61.  
  62. ;Copy active cell
  63. Send("^c")
  64. sleepTime20()
  65.  
  66. ;Go to my Program
  67. WinActivate("MyProgram]") ;TEST
  68. sleepTime20()
  69.  
  70. ;Safe the checksums
  71. Local $iCheckSumOben  = PixelChecksum(50, 200, 1230, 410)
  72. Local $iCheckSumUnten = PixelChecksum(50, 485, 1230, 780)
  73.  
  74. Local $iCheckSumWrongAction = PixelChecksum(150, 930, 270, 960)
  75.  
  76. Local $iCheckSumUnionL = PixelChecksum(50, 420, 620, 490)
  77. Local $iCheckSumUnionR = PixelChecksum(930, 420, 1230, 490)
  78.  
  79. ;my jump funktion
  80. jumpToUnion() ;HERE SOMETHING GOES WRONG DONT KNOW WHAT
  81.  
  82. ;Paste the cell
  83. Send("^v")
  84. sleepTime100()
  85.  
  86. ;new checksum for trying to jump out of the current page
  87. Local $iCheckSumNextPage = PixelChecksum(50, 215, 100, 360)
  88.  
  89.  
  90. ;use my check funktions
  91. checkPixelUpDown()
  92.  
  93. checkPixelWrongAction()
  94.  
  95. checkPixelUnion()
  96.  
  97. Send("{ENTER}")
  98. sleepTime20()
  99.  
  100. checkPixelNextPage()
  101.  
  102. ;Back to excel
  103. WinActivate("Microsoft Excel - TestExcelSource.xlsx")
  104.  
  105. ;Go 1 cell down
  106. Send("{DOWN}")
  107.  
  108. Next ;start the loop again
  109.  

Thanks a lot for your time

Niksan

 


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>