This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 23rd, 2011  |  syntax: None  |  size: 4.58 KB  |  views: 155  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #AutoIt3Wrapper_Outfile=P-2k10.exe
  2. #AutoIt3Wrapper_Icon=0.ico
  3. #AutoIt3Wrapper_Compression=n
  4. #AutoIt3Wrapper_UseUpx=n
  5. ; #AutoIt3Wrapper_UseX64=y
  6. #AutoIt3Wrapper_UseAnsi=y
  7. #AutoIt3Wrapper_Res_Comment=
  8. #AutoIt3Wrapper_Res_Description=P-2k10.exe
  9. #AutoIt3Wrapper_Res_Fileversion=0.2.0.0
  10. #AutoIt3Wrapper_Res_FileVersion_AutoIncrement=n
  11. #AutoIt3Wrapper_Res_LegalCopyright=AZJIO
  12. #AutoIt3Wrapper_Res_Language=1049
  13. #AutoIt3Wrapper_Run_Au3check=n
  14. #AutoIt3Wrapper_Res_Icon_Add=1.ico
  15. #AutoIt3Wrapper_Res_Icon_Add=2.ico
  16. ; #AutoIt3Wrapper_Res_Icon_Add=3.ico
  17. ; #AutoIt3Wrapper_Res_Icon_Add=4.ico
  18. ; #AutoIt3Wrapper_Res_Icon_Add=5.ico
  19. #AutoIt3Wrapper_Run_After=%autoitdir%\SciTE\upx\upx.exe -7 --compress-icons=0 "%out%"
  20.  
  21.         ShellExecute(FileGetShortName(@ScriptDir&'\P2start.cmd'), 'Update', @ScriptDir, '', @SW_HIDE)
  22.  
  23. Opt("TrayIconHide", 1)
  24.  
  25. $Ini = @ScriptDir & '\P-2k10.ini'
  26.  
  27. ; If $CmdLine[0]>0 Then
  28.         ; $IniType=IniRead($Ini, 'exclude', 'Type', 'CDROM;FIXED')
  29.         ; $IniLabel=IniRead($Ini, 'exclude', 'Label', '')
  30.         ; $IniPath=IniRead($Ini, 'exclude', 'Path', '')
  31.         ; $IniDisk=IniRead($Ini, 'exclude', 'Disk', '')
  32. ; EndIf
  33.  
  34.  
  35. ; http://www.autoitscript.com/forum/topic/79460-usbmon/page__view__findpost__p__572867
  36. ;============# Запрет на повторный запуск #====================================
  37. $hMutex = DllCall("kernel32.dll", "hwnd", "OpenMutex", "int", 0x1F0001, "int", False, "str", "USB459345")
  38.  
  39. If $hMutex[0] Then
  40.         $hWnd = WinGetHandle("USB459345")
  41.         WinSetState($hWnd, "", @SW_RESTORE)
  42.         DllCall("user32.dll", "int", "SetForegroundWindow", "hwnd", $hWnd)
  43.         Exit
  44. EndIf
  45.  
  46. $hMutex = DllCall("kernel32.dll", "hwnd", "CreateMutex", "int", 0, "int", False, "str", "USB459345")
  47. ;============================================================================
  48.  
  49. Opt("TrayIconHide", 0)
  50. Opt("TrayMenuMode", 7)
  51. Opt("TrayOnEventMode", 1)
  52.  
  53. Global $TpOff = 0, $curico=0, $Dr=0, $CurDrives[1]
  54. Global Const $DBT_DEVICEARRIVAL          = 0x8000 ; Найдено новое устройство
  55. Global Const $DBT_DEVICEREMOVECOMPLETE   = 0x8004 ; отключенное устройство
  56. Global Const $DBT_DEVTYP_VOLUME          = 0x00000002 ; Логический диск
  57.  
  58. If @compiled Then
  59.         $AutoItExe=@AutoItExe
  60. Else
  61.         $AutoItExe=@ScriptDir&'\P-2k10.dll'
  62. EndIf
  63.  
  64. ; $autorun=IniRead($Ini, 'Set', 'autorun', '')
  65. ; $arg=IniRead($Ini, 'Set', 'arg', '')
  66. ; $OutProcessClose=IniRead($Ini, 'Set', 'OutProcessClose', '')
  67.  
  68. TraySetToolTip('Программы 2k10')
  69.  
  70. $update = TrayCreateItem('Обновить')
  71. TrayItemSetOnEvent(-1, "_update")
  72.  
  73. $nExit = TrayCreateItem('Выход')
  74. TrayItemSetOnEvent(-1, "_Quit")
  75.  
  76. TraySetIcon($AutoItExe, $curico)
  77. TraySetState()
  78.  
  79. $Gui = GUICreate("USB1", 370, 140)
  80. GUISetState(@SW_HIDE, $Gui)
  81. GUISetState(@SW_DISABLE, $Gui)
  82.  
  83. GUIRegisterMsg(0x0219, "WM_DEVICECHANGE")
  84.  
  85. While 1
  86.     Sleep(1000)
  87. WEnd
  88.  
  89. ; http://www.autoitscript.com/forum/topic/79460-usbmon/page__view__findpost__p__572867
  90. Func WM_DEVICECHANGE($hWnd, $Msg, $wParam, $lParam)
  91.                
  92.         If ($wParam = $DBT_DEVICEARRIVAL) Or ($wParam = $DBT_DEVICEREMOVECOMPLETE) Then
  93.                 Local $DEV_BROADCAST_VOLUME = DllStructCreate("int dbcvsize;int dbcvdevicetype;int dbcvreserved;int dbcvunitmask;" & _
  94.                                                                                                           "ushort dbcvflags", $lParam)
  95.                 Local $iDriveType = DllStructGetData($DEV_BROADCAST_VOLUME, "dbcvdevicetype")
  96.         Else
  97.                 Return 'GUI_RUNDEFMSG'
  98.         EndIf
  99.        
  100.         If $iDriveType <> $DBT_DEVTYP_VOLUME Then Return 'GUI_RUNDEFMSG'
  101.        
  102.         Local $iMask = DllStructGetData($DEV_BROADCAST_VOLUME, "dbcvunitmask")
  103.         $iMask = Log($iMask) / Log(2)
  104.        
  105.         Local $iDrive = Chr(65 + $iMask) & ":"
  106.        
  107.         Switch $wParam
  108.                 Case $DBT_DEVICEARRIVAL ; обнаружение флешки
  109.                         TraySetIcon($AutoItExe, 201)
  110.                         ShellExecute(FileGetShortName(@ScriptDir&'\P2start.cmd'), 'Start', @ScriptDir, '', @SW_HIDE)
  111.                        
  112.                 Case $DBT_DEVICEREMOVECOMPLETE ; отключение флешки
  113.                         TraySetIcon($AutoItExe, 202)
  114.                         ShellExecute(FileGetShortName(@ScriptDir&'\P2start.cmd'), 'Update', @ScriptDir, '', @SW_HIDE)
  115.         EndSwitch
  116.        
  117.         GUIRegisterMsg(0x0113, "WM_TIMER")
  118.         DllCall("User32.dll", "int", "SetTimer", "hwnd", $Gui, "int", 50, "int", 2000, "int", 0)
  119.        
  120.         Return 'GUI_RUNDEFMSG'
  121. EndFunc
  122.  
  123. Func WM_TIMER()
  124.         TraySetIcon($AutoItExe, $curico)
  125.         GUIRegisterMsg(0x0113, '')
  126.     DllCall("user32.dll", "int", "KillTimer", "hwnd", $Gui, "int*", 50)
  127. EndFunc
  128.  
  129. Func _Quit()
  130.         TraySetState(2)
  131.         ShellExecute(FileGetShortName(@ScriptDir&'\P2start.cmd'), 'Exit', @ScriptDir, '', @SW_HIDE)
  132.         Exit
  133. EndFunc
  134.  
  135. Func _update()
  136.         TraySetState(2)
  137.         ShellExecute(FileGetShortName(@ScriptDir&'\P2start.cmd'), 'Update', @ScriptDir, '', @SW_HIDE)
  138. EndFunc
clone this paste RAW Paste Data