Advertisement
Guest User

Untitled

a guest
Jan 1st, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;===========================================
  2.  
  3. #NoEnv  
  4. #SingleInstance Force
  5. DetectHiddenWindows, On
  6. SetWorkingDir %A_ScriptDir%
  7.  
  8. ;===========================================
  9.  
  10. IEVisible := True
  11. LoadWait = 30
  12. MaxTries = 3
  13.  
  14. Email = %1%
  15. Pass = %2%
  16. Name = %3%
  17. User = %4%
  18.  
  19. /*
  20. Email := ""
  21. Pass := ""
  22. Name := ""
  23. User := ""
  24. */
  25.  
  26. ;===========================================
  27.  
  28. FileDelete, Result.txt
  29. OnExit, Exit
  30. GoSub, LoadIE
  31. Loop
  32. {
  33.   If Failed
  34.   {
  35.     Errors++
  36.     If Errors > %MaxTries%
  37.       ExitApp
  38.     Sleep, 5000
  39.   }
  40.   Failed := False
  41.  
  42.   GoSub, ClearIE
  43.   GoSub, LoadGoogle
  44.   If Failed
  45.     Continue
  46.    
  47.   GoSub, LoadTwitter
  48.   If Failed
  49.     Continue
  50.  
  51.   GoSub, CreateTwitter
  52.   If Failed
  53.     Continue
  54.   Break
  55. }
  56. FileAppend, Account Created, Result.txt
  57. ExitApp
  58.  
  59. ;===========================================
  60.  
  61. LoadTwitter:
  62. ;================
  63. Url := "https://twitter.com/signup"
  64. wb := CheckBrowser(wb)
  65. wb.Navigate(Url)
  66. Sleep, 2000
  67. Wait := (LoadWait * 2)
  68. Loop
  69. {
  70.   wb := CheckBrowser(wb)
  71.   If A_Index > %Wait%
  72.   {
  73.     Failed := True
  74.     Return
  75.   }
  76.   Sleep, 500
  77.   If ((wb.ReadyState = 4 && !wb.Busy) || A_Index > 45)
  78.   {
  79.     html := wb.document.body.innerHTML
  80.     If html =
  81.       html := wb.document.innerHTML
  82.     IfInString, html, <title>This page can
  83.     {
  84.       Failed := True
  85.       Return
  86.     }
  87.     IfInString, html, >This page can
  88.     {
  89.       IfInString, html, be displayed</div>
  90.       {
  91.         Failed := True
  92.         Return
  93.       }
  94.     }    
  95.     IfInString, html, Twitter
  96.       Break  
  97.   }
  98. }
  99. Sleep, 1500
  100. Return
  101.  
  102. ;===========================================
  103.  
  104. CreateTwitter:
  105. ;================
  106. ; full-name
  107. ; email
  108. ; password
  109. ; submit_button
  110. ; Enter your phone
  111. wb := CheckBrowser(wb)
  112. wb.document.getElementById("full-name").value := Name
  113. wb.document.getElementById("email").value := Email
  114. wb.document.getElementById("password").value := Pass
  115. Sleep, 500
  116. wb.document.getElementById("submit_button").click()
  117. Sleep, 5000
  118. wb.document.getElementById("submit_button").click()
  119. Sleep, 2000
  120. Wait := (LoadWait * 2)
  121. Loop
  122. {
  123.   wb := CheckBrowser(wb)
  124.   If A_Index > %Wait%
  125.   {
  126.     Failed := True
  127.     Return
  128.   }
  129.   Sleep, 500
  130.   If ((wb.ReadyState = 4 && !wb.Busy) || A_Index > 45)
  131.   {
  132.     html := wb.document.body.innerHTML
  133.     If html =
  134.       html := wb.document.innerHTML
  135.     IfInString, html, <title>This page can
  136.     {
  137.       Failed := True
  138.       Return
  139.     }
  140.     IfInString, html, >This page can
  141.     {
  142.       IfInString, html, be displayed</div>
  143.       {
  144.         Failed := True
  145.         Return
  146.       }
  147.     }    
  148.     IfInString, html, Enter your phone
  149.       Break  
  150.   }
  151. }
  152. Sleep, 500
  153.  
  154. ; https://twitter.com/account/add_username
  155. ; Choose a username
  156. Url := "https://twitter.com/account/add_username"
  157. wb := CheckBrowser(wb)
  158. wb.Navigate(Url)
  159. Sleep, 2000
  160. Wait := (LoadWait * 2)
  161. Loop
  162. {
  163.   wb := CheckBrowser(wb)
  164.   If A_Index > %Wait%
  165.   {
  166.     Failed := True
  167.     Return
  168.   }
  169.   Sleep, 500
  170.   If ((wb.ReadyState = 4 && !wb.Busy) || A_Index > 45)
  171.   {
  172.     html := wb.document.body.innerHTML
  173.     If html =
  174.       html := wb.document.innerHTML
  175.     IfInString, html, <title>This page can
  176.     {
  177.       Failed := True
  178.       Return
  179.     }
  180.     IfInString, html, >This page can
  181.     {
  182.       IfInString, html, be displayed</div>
  183.       {
  184.         Failed := True
  185.         Return
  186.       }
  187.     }    
  188.     IfInString, html, Choose a username
  189.       Break  
  190.   }
  191. }
  192. Sleep, 500
  193.  
  194. ; username
  195. ; submit_button
  196. ; We’re glad you’re here
  197. wb := CheckBrowser(wb)
  198. wb.document.getElementById("username").value := User
  199. Sleep, 500
  200. wb.document.getElementById("submit_button").Click()
  201. Sleep, 5000
  202. wb.document.getElementById("submit_button").Click()
  203. Wait := (LoadWait * 2)
  204. Loop
  205. {
  206.   wb := CheckBrowser(wb)
  207.   If A_Index > %Wait%
  208.   {
  209.     Failed := True
  210.     Return
  211.   }
  212.   Sleep, 500
  213.   If ((wb.ReadyState = 4 && !wb.Busy) || A_Index > 45)
  214.   {
  215.     html := wb.document.body.innerHTML
  216.     If html =
  217.       html := wb.document.innerHTML
  218.     IfInString, html, <title>This page can
  219.     {
  220.       Failed := True
  221.       Return
  222.     }
  223.     IfInString, html, >This page can
  224.     {
  225.       IfInString, html, be displayed</div>
  226.       {
  227.         Failed := True
  228.         Return
  229.       }
  230.     }    
  231.     IfInString, html, We’re glad you’re here
  232.       Break  
  233.   }
  234. }
  235. Sleep, 500
  236.  
  237. ; https://twitter.com/i/start/interests
  238. ; What are you interested in
  239. Url := "https://twitter.com/i/start/interests"
  240. wb := CheckBrowser(wb)
  241. wb.Navigate(Url)
  242. Sleep, 2000
  243. Wait := (LoadWait * 2)
  244. Loop
  245. {
  246.   wb := CheckBrowser(wb)
  247.   If A_Index > %Wait%
  248.   {
  249.     Failed := True
  250.     Return
  251.   }
  252.   Sleep, 500
  253.   If ((wb.ReadyState = 4 && !wb.Busy) || A_Index > 45)
  254.   {
  255.     html := wb.document.body.innerHTML
  256.     If html =
  257.       html := wb.document.innerHTML
  258.     IfInString, html, <title>This page can
  259.     {
  260.       Failed := True
  261.       Return
  262.     }
  263.     IfInString, html, >This page can
  264.     {
  265.       IfInString, html, be displayed</div>
  266.       {
  267.         Failed := True
  268.         Return
  269.       }
  270.     }    
  271.     IfInString, html, What are you interested in
  272.       Break  
  273.   }
  274. }
  275. Sleep, 500
  276.  
  277. ; button class EdgeButton EdgeButton--primary js-continue
  278. ; Want to find friends and see who they follow
  279. wb := CheckBrowser(wb)
  280. wb.document.getElementsByClassName("EdgeButton EdgeButton--primary js-continue")[0].Click()
  281. Sleep, 2000
  282. Wait := (LoadWait * 2)
  283. Loop
  284. {
  285.   wb := CheckBrowser(wb)
  286.   If A_Index > %Wait%
  287.   {
  288.     Failed := True
  289.     Return
  290.   }
  291.   Sleep, 500
  292.   If ((wb.ReadyState = 4 && !wb.Busy) || A_Index > 45)
  293.   {
  294.     html := wb.document.body.innerHTML
  295.     If html =
  296.       html := wb.document.innerHTML
  297.     IfInString, html, <title>This page can
  298.     {
  299.       Failed := True
  300.       Return
  301.     }
  302.     IfInString, html, >This page can
  303.     {
  304.       IfInString, html, be displayed</div>
  305.       {
  306.         Failed := True
  307.         Return
  308.       }
  309.     }    
  310.     IfInString, html, Want to find friends and see who they follow
  311.       Break  
  312.   }
  313. }
  314. Sleep, 500
  315.  
  316. ; https://twitter.com/i/start/choose
  317. ; Make your timeline yours
  318. Url := "https://twitter.com/i/start/choose"
  319. wb := CheckBrowser(wb)
  320. wb.Navigate(Url)
  321. Sleep, 2000
  322. Wait := (LoadWait * 2)
  323. Loop
  324. {
  325.   wb := CheckBrowser(wb)
  326.   If A_Index > %Wait%
  327.   {
  328.     Failed := True
  329.     Return
  330.   }
  331.   Sleep, 500
  332.   If ((wb.ReadyState = 4 && !wb.Busy) || A_Index > 45)
  333.   {
  334.     html := wb.document.body.innerHTML
  335.     If html =
  336.       html := wb.document.innerHTML
  337.     IfInString, html, <title>This page can
  338.     {
  339.       Failed := True
  340.       Return
  341.     }
  342.     IfInString, html, >This page can
  343.     {
  344.       IfInString, html, be displayed</div>
  345.       {
  346.         Failed := True
  347.         Return
  348.       }
  349.     }    
  350.     IfInString, html, Make your timeline yours
  351.       Break  
  352.   }
  353. }
  354. Sleep, 500
  355.  
  356. ; button class EdgeButton EdgeButton--primary btn-follow-all
  357. ; UIWalkthrough-skip
  358. wb := CheckBrowser(wb)
  359. wb.document.getElementsByClassName("EdgeButton EdgeButton--primary btn-follow-all")[0].Click()
  360. Sleep, 2000
  361. Wait := (LoadWait * 2)
  362. Loop
  363. {
  364.   wb := CheckBrowser(wb)
  365.   If A_Index > %Wait%
  366.   {
  367.     Failed := True
  368.     Return
  369.   }
  370.   Sleep, 500
  371.   If ((wb.ReadyState = 4 && !wb.Busy) || A_Index > 45)
  372.   {
  373.     html := wb.document.body.innerHTML
  374.     If html =
  375.       html := wb.document.innerHTML
  376.     IfInString, html, <title>This page can
  377.     {
  378.       Failed := True
  379.       Return
  380.     }
  381.     IfInString, html, >This page can
  382.     {
  383.       IfInString, html, be displayed</div>
  384.       {
  385.         Failed := True
  386.         Return
  387.       }
  388.     }    
  389.     IfInString, html, UIWalkthrough-skip
  390.       Break  
  391.   }
  392. }
  393. Sleep, 500
  394.  
  395. ; button class UIWalkthrough-skip js-close
  396. ; Welcome to Twitter
  397. wb := CheckBrowser(wb)
  398. wb.document.getElementsByClassName("UIWalkthrough-skip js-close")[0].Click()
  399. Sleep, 2000
  400. Wait := (LoadWait * 2)
  401. Loop
  402. {
  403.   wb := CheckBrowser(wb)
  404.   If A_Index > %Wait%
  405.   {
  406.     Failed := True
  407.     Return
  408.   }
  409.   Sleep, 500
  410.   If ((wb.ReadyState = 4 && !wb.Busy) || A_Index > 45)
  411.   {
  412.     html := wb.document.body.innerHTML
  413.     If html =
  414.       html := wb.document.innerHTML
  415.     IfInString, html, <title>This page can
  416.     {
  417.       Failed := True
  418.       Return
  419.     }
  420.     IfInString, html, >This page can
  421.     {
  422.       IfInString, html, be displayed</div>
  423.       {
  424.         Failed := True
  425.         Return
  426.       }
  427.     }    
  428.     IfInString, html, Welcome to Twitter
  429.       Break  
  430.   }
  431. }
  432. Sleep, 500
  433. Return
  434.  
  435. ;===========================================
  436.  
  437. Logout:
  438. ;================
  439. ; https://twitter.com/logout
  440. ; Log out of Twitter
  441. ; button class EdgeButton EdgeButton--primary js-submit
  442. ; >Log in<
  443. Return
  444.  
  445. ;===========================================
  446.  
  447. LoadIE:
  448. ;================
  449. SB_SetText(" Loading IE")
  450. ComObjError(False)
  451. wb := ComObjCreate("InternetExplorer.Application")
  452. wb.Visible := False
  453. If !IEVisible
  454. {  
  455.   WinSet, Transparent, 0, ahk_id %IEId%
  456.   Sleep, 300
  457. }
  458. wb.Visible := True
  459. WinGet, IEId, ID, Internet Explorer_Server1
  460. If IEId =
  461.   WinGet, IEId, ID, ahk_class IEFrame
  462. If IEId =
  463.   WinGet, IEId, ID, ahk_class TabWindowClass1
  464. If IEId =
  465.   WinGet, IEId, ID, Internet Explorer
  466. ;Msgbox, % IEId
  467. If IEId =
  468. {
  469.   Msgbox, 64, %App%, Failed to load Internet Explorer...
  470.   ExitApp
  471. }
  472. Return
  473.  
  474. ;===========================================
  475.  
  476. ClearIE:
  477. ;================
  478. iCmd = 255
  479. VarSetCapacity(wCmd, 15, 0)
  480. DllCall("MultiByteToWideChar", "Uint", 0, "Uint", 0, "str", iCmd, "int", -1, "str", wCmd, "int", 8)
  481. DllCall("inetcpl.cpl\ClearMyTracksByProcessW", "Uint", 0, "Uint", 0, "str", wCmd, "int", 0)
  482. Sleep, 1000
  483. Return
  484.  
  485. ;===========================================
  486.  
  487. LoadGoogle:
  488. ;================
  489. Url := "https://www.google.com"
  490. wb := CheckBrowser(wb)
  491. wb.Navigate(Url)
  492. Sleep, 2000
  493. Wait := (LoadWait * 2)
  494. Loop
  495. {
  496.   wb := CheckBrowser(wb)
  497.   If A_Index > %Wait%
  498.   {
  499.     Failed := True
  500.     Return
  501.   }
  502.   Sleep, 500
  503.   If ((wb.ReadyState = 4 && !wb.Busy) || A_Index > 45)
  504.   {
  505.     html := wb.document.body.innerHTML
  506.     If html =
  507.       html := wb.document.innerHTML
  508.     IfInString, html, <title>This page can
  509.     {
  510.       Failed := True
  511.       Return
  512.     }
  513.     IfInString, html, >This page can
  514.     {
  515.       IfInString, html, be displayed</div>
  516.       {
  517.         Failed := True
  518.         Return
  519.       }
  520.     }    
  521.     IfInString, html, Google
  522.       Break  
  523.   }
  524. }
  525. Sleep, 500
  526. Return
  527.  
  528. ;===========================================
  529.  
  530. ReloadIE:
  531. ;================
  532. wb := CheckBrowser(wb)
  533. wb.Quit()
  534. GoSub, LoadIE
  535. Sleep, 2000
  536. Return
  537.  
  538. ;===========================================
  539.  
  540. Exit:
  541. ;================
  542. wb := CheckBrowser(wb)
  543. If IEId !=
  544.   wb.Quit()
  545. ExitApp
  546.  
  547. ;===========================================
  548.  
  549. CheckBrowser(wb)
  550. {
  551.   Global IEId
  552.   DetectHiddenWindows, On
  553.   nwb := IEGet()
  554.   If !nwb
  555.     Return wb
  556.   Else
  557.     wb := nwb  
  558.   WinGet, IEId, ID, Internet Explorer_Server1
  559.   If IEId =
  560.     WinGet, IEId, ID, ahk_class IEFrame
  561.   If IEId =
  562.     WinGet, IEId, ID, ahk_class TabWindowClass1
  563.   If IEId =
  564.     WinGet, IEId, ID, Internet Explorer
  565.   ;Msgbox, % IEId
  566.   If IEId =
  567.   {
  568.     Msgbox, Failed to locate Internet Explorer...
  569.     ExitApp
  570.   }    
  571.   Return wb
  572. }
  573.  
  574. ;===========================================
  575.  
  576. IEGet(Name = "")
  577. {
  578.   Global wbLoc
  579.   Global wbName  
  580.   If Name !=
  581.   {
  582.     IfEqual, Name,, WinGetTitle, Name, ahk_class IEFrame
  583.       Name := (Name = "New Tab - Windows Internet Explorer") ? "about:Tabs" : RegExReplace(Name, " - (Windows|Microsoft) Internet Explorer")
  584.   }
  585.   ;Msgbox % Name
  586.   wbLoc =
  587.   wbName =
  588.   For npwb In ComObjCreate("Shell.Application").Windows
  589.   {
  590.     If Name !=
  591.     {
  592.       npwbLoc := npwb.LocationName
  593.       IfNotInString, npwbLoc, %Name%
  594.       {
  595.         If (InStr(npwb.FullName, "iexplore.exe"))
  596.         {
  597.           pwb := npwb
  598.           wbLoc := pwb.LocationName
  599.           wbName := pwb.FullName
  600.         }        
  601.       }  
  602.     }
  603.     Else
  604.     {
  605.       If (InStr(npwb.FullName, "iexplore.exe"))
  606.       {  
  607.         pwb := npwb
  608.         wbLoc := pwb.LocationName
  609.         wbName := pwb.FullName     
  610.       }
  611.     }
  612.   }
  613.   If (wbLoc = "" || wbName = "")
  614.     Return False
  615.   Return pwb
  616. }
  617.  
  618. ;===========================================
  619.  
  620. IEInfo(Name = "")
  621. {
  622.   IEInfo =
  623.   For npwb In ComObjCreate("Shell.Application").Windows
  624.   {
  625.     LocName := npwb.LocationName
  626.     FullName := npwb.FullName  
  627.     StringLower, LocName, LocName
  628.     StringLower, FullName, FullName
  629.     IfInString, FullName, iexplore.exe
  630.     {
  631.       If (Name = "")
  632.         IEInfo .= LocName . "^"
  633.       Else
  634.       {
  635.         IfInString, LocName, %Name%
  636.           IEInfo .= LocName . "^"
  637.       }
  638.     }
  639.   }
  640.   StringRight, cc, IEInfo, 1
  641.   If cc = ^
  642.     StringTrimRight, IEInfo, IEInfo, 1
  643.   Return IEInfo
  644. }
  645. ;===========================================
  646.  
  647. IECount(Name = "")
  648. {
  649.   IECount = 0
  650.   For npwb In ComObjCreate("Shell.Application").Windows
  651.   {
  652.     LocName := npwb.LocationName
  653.     FullName := npwb.FullName  
  654.     StringLower, LocName, LocName
  655.     StringLower, FullName, FullName
  656.     IfInString, FullName, iexplore.exe
  657.     {
  658.       If (Name = "")
  659.         IECount++
  660.       Else
  661.       {
  662.         IfInString, LocName, %Name%
  663.           IECount++
  664.       }
  665.       ;Msgbox % FullName . "|" . LocName
  666.     }
  667.   }
  668.   Return IECount
  669. }
  670.  
  671. ;===========================================
  672.  
  673. ProcessCount(ExeName)
  674. {
  675.   ProCout = 0
  676.   For Process in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process")
  677.   {
  678.     ProName := Process.Name
  679.     If ProName = %ExeName%
  680.       ProCount++
  681.   }
  682.   Return ProCount
  683. }
  684.  
  685. ;===========================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement