Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Аватара для Creat0R

Must AutoIt


Сообщения: 3054
Благодарности: 1009

Профиль | Сайт | Отправить PM | Цитировать


Цитата Anarasius:
Можно ли сделать так чтобы скрипт запрограммировал компьютер на включение »
Интересно, а скрипт будет запущен виртуально?

Цитата Anarasius:
можно через скрипт вывести компьютер из спящего режима »
Вроде можно:

Код: Выделить весь код
#include <Date.au3>

SetWakeUpTime(@HOUR, @MIN + 2) ;wakeup the system in 2 minutes from now
SetSuspend() ;go to hibernate mode

;===============================================================================
;
; Description:    Set the computer in Hibernate or Standby Status
; Parameter(s):  $Mode  - Suspend mode  : True=Hibernate, False=Suspend
;                   $Force  - Force-Mode    : True=the system suspends operation immediately
;                                             False=FALSE, the system broadcasts a PBT_APMQUERYSUSPEND event to each application to request permission to suspend operation
;
; Requirement(s):   DllCall
;
; Author(s):        Bastel123 aka Sebastian
; Note(s):        If the system does not support hibernate use the standby mode       -
;
;===============================================================================
Func SetSuspend($mode = True, $force = True)
    $result = DllCall("PowrProf.dll", "long", "SetSuspendState", "long", $mode, "long", $force, "long", False)
EndFunc   ;==>SetSuspend

;===============================================================================
;
; Description:    Sets a wakeup time to wake it up if the system / computer is hibernating or standby
; Parameter(s):  $Hour  - Hour Values   : 0-23
;                   $Minute - Minutes Values: 0-59
;                   $Day    - Days Values   : 1-31  (optional)
;                  $Month   - Month Values  : 1-12  (optional)
;                  $Year    - Year Values   : > 0   (optional)
;
; Requirement(s):   DllCall
; Return Value(s):  On Success - 1
;                  On Failure - 0 sets @ERROR = 1 and @EXTENDED (Windows API error code)
;
; Error code(s):    http://msdn.microsoft.com/library/default....error_codes.asp
;
; Author(s):        Bastel123 aka Sebastian
; Note(s):        -
;
;===============================================================================
Func SetWakeUpTime($Hour, $Minute, $Day = @MDAY, $Month = @MON, $Year = @YEAR)
    $SYSTEMTIME = DllStructCreate("ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort")
    $lpSYSTEMTIME = DllStructGetPtr($SYSTEMTIME)
    $LOCALFILETIME = DllStructCreate("dword;dword")
    $lpLOCALFILETIME = DllStructGetPtr($LOCALFILETIME)
    $DueTime = DllStructCreate("dword;dword")
    $lpDueTime = DllStructGetPtr($DueTime)

    DllStructSetData($SYSTEMTIME, 1, $Year)
    DllStructSetData($SYSTEMTIME, 2, $Month)
    DllStructSetData($SYSTEMTIME, 3, _DateToDayOfWeek($Year, $Month, $Day) - 1)
    DllStructSetData($SYSTEMTIME, 4, $Day)
    DllStructSetData($SYSTEMTIME, 5, $Hour)
    DllStructSetData($SYSTEMTIME, 6, $Minute)
    DllStructSetData($SYSTEMTIME, 7, 0)
    DllStructSetData($SYSTEMTIME, 8, 0)

    $result = DllCall("kernel32.dll", "long", "SystemTimeToFileTime", "ptr", $lpSYSTEMTIME, "ptr", $lpLOCALFILETIME)

    If $result[0] = 0 Then
        Local $lastError = DllCall("kernel32.dll", "int", "GetLastError")
        Return SetError(1, $lastError[0], 0)
    EndIf

    $result = DllCall("kernel32.dll", "long", "LocalFileTimeToFileTime", "ptr", $lpLOCALFILETIME, "ptr", $lpLOCALFILETIME)

    If $result[0] = 0 Then
        Local $lastError = DllCall("kernel32.dll", "int", "GetLastError")
        Return SetError(1, $lastError[0], 0)
    EndIf

    $result = DllCall("kernel32.dll", "long", "CreateWaitableTimer", "long", 0, "long", True, "str", "")

    If $result[0] = 0 Then
        Local $lastError = DllCall("kernel32.dll", "int", "GetLastError")
        Return SetError(1, $lastError[0], 0)
    EndIf

    DllCall("kernel32.dll", "none", "CancelWaitableTimer", "long", $result[0])

    DllStructSetData($DueTime, 1, DllStructGetData($LOCALFILETIME, 1))
    DllStructSetData($DueTime, 2, DllStructGetData($LOCALFILETIME, 2))

    $result = DllCall("kernel32.dll", "long", "SetWaitableTimer", "long", $result[0], "ptr", $lpDueTime, _
        "long", 1000, "long", 0, "long", 0, "long", True)

    If $result[0] = 0 Then
        Local $lastError = DllCall("kernel32.dll", "int", "GetLastError")
        Return SetError(1, $lastError[0], 0)
    EndIf

    Return 1
EndFunc   ;==>SetWakeUpTime
Источник

-------
“Сделай так просто, как возможно, но не проще этого.”... “Ты никогда не решишь проблему, если будешь думать так же, как те, кто её создал.”

Альберт Эйнштейн

P.S «Не оказываю техподдержку через ПМ/ICQ, и по email - для этого есть форум. ©»

http://creator-lab.ucoz.ru/Images/Icons/autoit_icon.png Русское сообщество AutoIt | http://creator-lab.ucoz.ru/Images/Ic...eator_icon.png CreatoR's Lab | http://creator-lab.ucoz.ru/Images/Icons/oac_icon.png Opera AC Community

Это сообщение посчитали полезным следующие участники:

Отправлено: 02:22, 02-11-2009 | #2