Guest User

Diablo 3 launcher

a guest
May 30th, 2012
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.98 KB | None | 0 0
  1. ; http://www.autoitscript.com/site/autoit/downloads/
  2. Global $pass = "mdp"
  3. Global $launcher = "C:\Chronophagie\Diablo III\Diablo III Launcher.exe -launch"
  4. HotKeySet("^g", "paste") ; CTRL+G pour coller le mot de passe
  5. HotKeySet("^h", "stop") ; CTRL+H pour forcer l'arrêt du launcher
  6. ; pour remplacer les raccourcis, cf. http://www.autoitscript.com/autoit3/docs/functions/Send.htm
  7.  
  8. #NoTrayIcon
  9. #include-once
  10. #include <Array.au3>
  11. ;_MySplashOn
  12. #include <GDIPlus.au3>
  13. #include <WinAPI.au3>
  14. #include <WindowsConstants.au3>
  15. #include <GuiConstantsEx.au3>
  16. Opt("MustDeclareVars", 0)
  17. Global Const $AC_SRC_ALPHA = 1
  18. $First = 0
  19. Global $Fade
  20. ;_MySplashOff
  21. Global $process = "Diablo III.exe"
  22. AutoItSetOption("SendKeyDelay", "0")
  23. AutoItSetOption("SendKeyDownDelay", "0")
  24.  
  25. Run($launcher)
  26. If @error Then
  27.     MsgBox(262160, "Diablo 3 launcher", "Erreur lors du lancement de " & $launcher & @CRLF & "Fermeture du programme", 5000)
  28.     Exit
  29. EndIf
  30. $logoPath = @ScriptDir & "\diablohfr3.png"
  31. $logo = FileExists($logoPath)
  32. If $logo = 1 Then
  33.     _MySplashOn($logoPath, 1)
  34. EndIf
  35. $ret = WinWaitActive("Diablo III", "", 30)
  36. If $ret <> 0 And $logo = 1 Then _MySplashOff()
  37. If $ret = 0 Then
  38.     While 1
  39.         $ret = MsgBox(262449, "Diablo 3 launcher", "Processus " & $process & " non trouvé" & @CRLF & "Attendre indéfiniment (maj par ex) ou quitter le programme ?", 10)
  40.         Select
  41.             Case $ret = 1 ;OK
  42.                 ProcessWait($process, 21600) ; max 6h
  43.                 ExitLoop
  44.             Case $ret = 2 ;Cancel
  45.                 Exit
  46.             Case $ret = -1 ;Timeout
  47.                 Exit
  48.         EndSelect
  49.     WEnd
  50. EndIf
  51. While 1
  52.     Sleep(100)
  53.     If Not ProcessExists($process) Then Exit
  54. WEnd
  55. Func paste()
  56. ;~  If ProcessExists($process) And WinActive($hDiablo) Then
  57.     If ProcessExists($process) And WinActive("Diablo III") Then
  58.         Send($pass, 1)
  59.         Sleep(100)
  60.         Send("{ENTER}")
  61.     EndIf
  62. EndFunc   ;==>paste
  63. Func Stop()
  64.     Exit
  65. EndFunc   ;==>Stop
  66.  
  67.  
  68. #cs ----------------------------------------------------------------------------
  69.  
  70.     AutoIt Version : 3.3.2.0
  71.     Auteur:         DJSIR and noman
  72.  
  73.     Fonction du Script :
  74.     Permet de faire un Splash avec une Image PNG
  75.  
  76. #ce ----------------------------------------------------------------------------
  77. Func _MySplashOn($Path_Logo, $Fade = 0)
  78.     _GDIPlus_Startup()
  79.     Global $hImage = _GDIPlus_ImageLoadFromFile($Path_Logo)
  80.     $width = _GDIPlus_ImageGetWidth($hImage)
  81.     $height = _GDIPlus_ImageGetHeight($hImage)
  82.     Global $GUI = GUICreate("", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED, WinGetHandle(AutoItWinGetTitle()))
  83.     SetBitmap($GUI, $hImage, 0)
  84.     GUISetState()
  85.     WinSetOnTop($GUI, "", 1)
  86.     If $Fade = 1 Then
  87.         For $i = 0 To 255 Step 10
  88.             SetBitmap($GUI, $hImage, $i)
  89.         Next
  90.         SetBitmap($GUI, $hImage, 255)
  91.     Else
  92.     EndIf
  93.     $First = 1
  94. EndFunc   ;==>_MySplashOn
  95.  
  96. Func _MySplashOff()
  97.     If Not $First = 1 Then Return -1
  98.     If $Fade = 1 Then
  99.         For $i = 255 To 0 Step -10
  100.             SetBitmap($GUI, $hImage, $i)
  101.         Next
  102.     EndIf
  103.     _WinAPI_DeleteObject($hImage)
  104.     _GDIPlus_Shutdown()
  105.     GUIDelete($GUI)
  106. EndFunc   ;==>_MySplashOff
  107.  
  108. Func SetBitmap($hGUI, $hImage, $iOpacity)
  109.     Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
  110.  
  111.     $hScrDC = _WinAPI_GetDC(0)
  112.     $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
  113.     $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
  114.     $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
  115.     $tSize = DllStructCreate($tagSIZE)
  116.     $pSize = DllStructGetPtr($tSize)
  117.     DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
  118.     DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
  119.     $tSource = DllStructCreate($tagPOINT)
  120.     $pSource = DllStructGetPtr($tSource)
  121.     $tBlend = DllStructCreate($tagBLENDFUNCTION)
  122.     $pBlend = DllStructGetPtr($tBlend)
  123.     DllStructSetData($tBlend, "Alpha", $iOpacity)
  124.     DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
  125.     _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
  126.     _WinAPI_ReleaseDC(0, $hScrDC)
  127.     _WinAPI_SelectObject($hMemDC, $hOld)
  128.     _WinAPI_DeleteObject($hBitmap)
  129.     _WinAPI_DeleteDC($hMemDC)
  130. EndFunc   ;==>SetBitmap
Advertisement
Add Comment
Please, Sign In to add comment