Advertisement
Guest User

Untitled

a guest
Sep 18th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 2.90 KB | None | 0 0
  1. #include <MsgBoxConstants.au3>
  2. #include <File.au3>
  3.  
  4. HotKeySet("{Esc}", "escape")
  5.  
  6. ;initialise all the screen coordinate constants
  7. const $AGENTX = 1870
  8. const $AGENTY = 49
  9. const $MOBILEX = 1725
  10. const $MOBILEY = 130
  11. const $DESKTOPX = 1376
  12. const $DESKTOPY = 132
  13. const $NEUTRALX = 811
  14. const $NEUTRALY =  842
  15. const $SEARCHX = 249
  16. const $SEARCHY = 96
  17.  
  18.  
  19. ;create array for command line arguments
  20. Local $args[5]
  21.  
  22. ;store all the parameters into variables
  23. if $CmdLine[0] > 0 And $CmdLine[1] <> "-" Then
  24.     $args[0] = $CmdLine[1] * 1000
  25. Else                             ;
  26.     $args[0] = StringLeft(@ScriptFullPath, StringLen(@ScriptFullPath) - 8)     ;
  27. EndIf
  28. if $CmdLine[0] > 1 And $CmdLine[2] <> "-" Then
  29.     $args[1] = $CmdLine[2] * 1000
  30. Else                             ;
  31.     $args[1] = 10000      ;
  32. EndIf
  33. If $CmdLine[0] > 2 And $CmdLine[3] <> "-" Then
  34.     $args[2] = $CmdLine[3] * 1000
  35. Else
  36.     $args[2] = 20000
  37. EndIf
  38. If $CmdLine[0] > 3 And $CmdLine[4] <> "-" Then          ;
  39.     $args[3] = $CmdLine[4];
  40. Else                             ;
  41.     $args[3] = 30        ;
  42. EndIf
  43. If $CmdLine[0] > 4 And $CmdLine[5] <> "-" Then           ;
  44.     $args[4] = $CmdLine[5] ;
  45. Else                             ;
  46.     $args[4] = 20            ;
  47. EndIf
  48.  
  49. ;assign the parameters to variables
  50. const $ADDRESS = $args[0]
  51. const $SEARCHES = String($ADDRESS) & "searches.txt"
  52. const $LINECOUNT = _FileCountLines($SEARCHES)
  53. const $LOADTIME = $args[1]
  54. Const $TIMEBETWEENSEARCH = $args[2]
  55. Const $DSKTPSRCH = $args[3]
  56. Const $MBLSRCH = $args[4]
  57.  
  58. ;get to the search page
  59. Run("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
  60. sleep($LOADTIME)
  61. Send("^l")
  62. sleep(100)
  63. send("bing.com{space}{backspace}{enter}")
  64. sleep($LOADTIME)
  65. FileOpen($SEARCHES, 0)
  66. sendSearch()
  67. Send("{Enter}")
  68. FileClose($SEARCHES)
  69. Sleep($LOADTIME)
  70.  
  71. If $DSKTPSRCH <> 0 Then
  72.     FileOpen($SEARCHES, 0)
  73.     makeSearch($DSKTPSRCH)
  74. EndIf
  75. FileClose($SEARCHES)
  76.  
  77. MouseClick("left", $AGENTX, $AGENTY, 1, 0) ;switch to                    ;AGENT
  78. sleep(200);                        ;mobile mode
  79. MouseClick("left", $MOBILEX, $MOBILEY, 1, 0);                            ;MOBILE
  80. sleep(200);
  81. If $MBLSRCH <> 0 Then
  82.     FileOpen($SEARCHES)
  83.     makeSearch($MBLSRCH)
  84. EndIf
  85. FileClose($SEARCHES)
  86. MouseClick("left", $AGENTX, $AGENTY, 1, 0) ;switch to                    ;AGENT
  87. sleep(200);                        ;desktop mode
  88. MouseClick("left", $DESKTOPX, $DESKTOPY, 1, 0);                          ;DESKTOP
  89. sleep(200);                        ;
  90.  
  91. MouseClick("left", $NEUTRALX, $NEUTRALY, 1, 0);close                     ;NEUTRAL
  92. sleep(200);                                   ;chrome
  93. Send("^w");                                   ;
  94.  
  95. Func makeSearch($times)
  96.     For $i = 1 to $times
  97.         MouseClick("left", $SEARCHX, $SEARCHY, 1, 0);click the searchbar ;SEARCH
  98.         Send("^a")
  99.         sendSearch()
  100.         Send("{Enter}")
  101.         sleep(2000)
  102.         Send("{F5}")
  103.         sleep($TIMEBETWEENSEARCH-2000)
  104.     Next
  105. EndFunc
  106. Func sendSearch()
  107.     $line = FileReadLine($SEARCHES, Round(Random(1, $LINECOUNT)))
  108.     Send($line)
  109. EndFunc
  110. Func escape()
  111.     Exit 0
  112. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement