Advertisement
Guest User

Untitled

a guest
Feb 25th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 2.41 KB | None | 0 0
  1. #include <Array.au3>
  2. #include <_httpRequest.au3>
  3.  
  4. #include <ButtonConstants.au3>
  5. #include <ComboConstants.au3>
  6. #include <EditConstants.au3>
  7. #include <GUIConstantsEx.au3>
  8. #include <StaticConstants.au3>
  9. #include <WindowsConstants.au3>
  10. #Region ### START Koda GUI section ### Form=
  11. $Form1 = GUICreate("Form1", 553, 400, 628, 173)
  12. $Group1 = GUICtrlCreateGroup("Text", 0, 0, 385, 393)
  13. $Edit1 = GUICtrlCreateEdit("Edit1", 8, 16, 369, 369)
  14. GUICtrlCreateGroup("", -99, -99, 1, 1)
  15. $Group2 = GUICtrlCreateGroup("Setting", 392, 0, 153, 153)
  16. $Label1 = GUICtrlCreateLabel("Language :", 400, 16, 58, 17)
  17. $Combo1 = GUICtrlCreateCombo("English", 464, 16, 73, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
  18. GUICtrlSetData($Combo1, "Vietnamese|China|ThaiLans")
  19. $Label2 = GUICtrlCreateLabel("Server :", 400, 48, 41, 17)
  20. $Combo2 = GUICtrlCreateCombo("Bing", 464, 48, 73, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
  21. GUICtrlCreateGroup("", -99, -99, 1, 1)
  22. $Button1 = GUICtrlCreateButton("Download", 392, 160, 155, 41)
  23. $Button2 = GUICtrlCreateButton("Play", 392, 208, 155, 49)
  24. $Group3 = GUICtrlCreateGroup("About", 392, 264, 153, 129)
  25. $Label3 = GUICtrlCreateLabel("Dev : ", 400, 280, 33, 17)
  26. $Label4 = GUICtrlCreateLabel("Nguyen Hoang Vu", 432, 280, 92, 17)
  27. $Label5 = GUICtrlCreateLabel("Dev : ", 400, 312, 33, 17)
  28. $Label6 = GUICtrlCreateLabel("FB.com/HoangVu2000", 432, 312, 114, 17)
  29. $Label7 = GUICtrlCreateLabel("Dev : ", 400, 344, 33, 17)
  30. $Label8 = GUICtrlCreateLabel("No Youtube", 432, 344, 61, 17)
  31. GUICtrlCreateGroup("", -99, -99, 1, 1)
  32. GUISetState(@SW_SHOW)
  33. #EndRegion ### END Koda GUI section ###
  34. Global $path = @ScriptDir & '\audio.mp3'
  35.  
  36. While 1
  37.     $nMsg = GUIGetMsg()
  38.     Switch $nMsg
  39.         Case $GUI_EVENT_CLOSE
  40.             Exit
  41.         Case $Button1
  42.             FileDelete($path)
  43.             _Download_mp3(GUICtrlRead($Edit1),GUICtrlRead($Combo1))
  44.         Case $Button2
  45.             SoundPlay($path,0)
  46.  
  47.     EndSwitch
  48. WEnd
  49.  
  50. Func _Download_mp3($text,$ngonngu, $file = "audio.mp3")
  51.     $ngonngu = ($ngonngu = "Vietnamese") ? "vi" : $ngonngu
  52.     $ngonngu = ($ngonngu = "English") ? "en" : $ngonngu
  53.     $ngonngu = ($ngonngu = "China") ? "zh" : $ngonngu
  54.     $ngonngu = ($ngonngu = "ThaiLans") ? "th" : $ngonngu
  55.     Local $link = 'https://www.bing.com/tspeak?&format=audio%2Fmp3&language=' & $ngonngu & '&IG=DA8194C682414AE998883AAC020AAE8D&IID=translator.5036.1&text=' & _URIEncode($text)
  56.     Local $rq = _HttpRequest(3,$link)
  57.     $path = @ScriptDir & '\' & $file
  58.     FileWrite(@ScriptDir & '\' & $file,$rq)
  59. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement