找回密码
 加入
搜索
楼主: yarsye

[AU3基础] 在欢迎界面 如何用AutoIT自动进入系统?

 火... [复制链接]
 楼主| 发表于 2010-6-26 14:13:52 | 显示全部楼层
我试了2台XP系统 一台可以直接进去系统 另外一台却不可以 一直停留在欢迎界面
发表于 2010-6-26 15:42:38 | 显示全部楼层
之前记得计算机在锁定状态AU脚本的处于挂机状态
 楼主| 发表于 2010-6-29 20:38:46 | 显示全部楼层
希望有人遇到和我一样的情形
我还真说不清楚了 我越发觉得我的语言组织表达能力下降了
 楼主| 发表于 2010-6-29 20:49:47 | 显示全部楼层
#include <date.au3>

;===============================================================================
;
; 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")
    SetExtended($lastError[0])
    SetError(1)
    Return 0
EndIf
$result = DllCall("kernel32.dll", "long", "LocalFileTimeToFileTime", "ptr", $lpLocalFileTime, "ptr", $lpLocalFileTime)
If $result[0] = 0 Then
    Local $lastError = DllCall("kernel32.dll", "int", "GetLastError")
    SetExtended($lastError[0])
    SetError(1)
    Return 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")
    SetExtended($lastError[0])
    SetError(1)
    Return 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")
    SetExtended($lastError[0])
    SetError(1)
    Return 0
EndIf
return 1
EndFunc

;===============================================================================
;
; 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=False,$force=true)
    $result = DllCall("PowrProf.dll", "long", "SetSuspendState", "long",$mode, "long",$force, "long", false)
EndFunc

Func _Monitor_ON()
    Local $Progman_hwnd = WinGetHandle('[CLASS:Progman]')
        Local $lciWM_SYSCommand = 274
        Local $lciSC_MonitorPower = 61808
        Local $lciPower_On = -1
    DllCall('user32.dll', 'int', 'SendMessage', _
                                                'hwnd', $Progman_hwnd, _
                                                'int', $lciWM_SYSCommand, _
                                                'int', $lciSC_MonitorPower, _
                                                'int', $lciPower_On);kn007
EndFunc

Func Go_to_Sleep()
SetWakeUpTime(@HOUR,@min+1); wakeup the system in 1 minutes from now
SetSuspend(); go to hibernate mode#cs ----------------------------------------------------------------------------
_Monitor_ON()
;~ MouseMove(705,378,30)
;~ MouseClick("left")
EndFunc

Func My_capture()
                                _ScreenCapture_Capture( @DesktopDir & "\Testing Pic" & $x &".jpg")
EndFunc

Func _sleep()
Dim $i=1
While $i<=1000

WinWaitActive($AppName)
WinActivate ($AppName)
Select_160x120tentimes();
                         DirCreate(@DesktopDir & "\Testing Pic")
                        My_capture()
                         _TestLog_Event("pic for 160x120", "", @DesktopDir & "\Testing Pic" & $x &".jpg")
                        $x+=1
Go_to_Sleep()
                        My_capture()
                         _TestLog_Event("resume from sleep", "", @DesktopDir & "\Testing Pic" & $x &".jpg")
                        $x+=1
Select_160to1280();
                        My_capture()
                         _TestLog_Event("resume from HD", "", @DesktopDir & "\Testing Pic" & $x &".jpg")
                        $x+=1
MsgBox(1,"Times","Have finished "& $i &"times",5)
        $i=$i+1
        WEnd
EndFunc
我说下我的情况吧

我设置好系统然后进入待机状态  回来后会停在欢迎界面 但是等会又会再次进入待机(循环) 之后 回来又停在欢迎界面 进不去系统 但是代码一直在执行

奇怪 就奇怪在 我试了2太电脑 一台电脑可以进 另外一台不可以进 弄的我一头雾水
发表于 2010-7-16 10:55:10 | 显示全部楼层
很迷糊
 楼主| 发表于 2010-7-19 09:06:33 | 显示全部楼层
还没研究出来 为什么需要点击下用户名才会有Welcome出现
发表于 2010-7-19 16:09:20 | 显示全部楼层
写入到系统服务..
 楼主| 发表于 2010-7-19 16:16:13 | 显示全部楼层
回复 22# lin0308

Sounds good ! 但是我不会
发表于 2010-7-19 17:54:15 | 显示全部楼层
运行control userpasswords2命令,打开用户账户窗口。去掉要使用本机,用户必须输入用户名和密码(E)
选择需要自动登录的用户名,点击应用输入用户密码即可!!!
 楼主| 发表于 2010-7-19 17:57:47 | 显示全部楼层
回复 24# hnzzlzj


    我试了 可以用 感谢
 楼主| 发表于 2010-7-27 16:45:57 | 显示全部楼层
知道什么现象了
1是不能打开显示器
2是不能点击Welcome
发表于 2010-7-28 20:59:32 | 显示全部楼层
运行control userpasswords2命令,打开用户账户窗口。去掉要使用本机,用户必须输入用户名和密码(E)
选择需要自动登录的用户名,点击应用输入用户密码即可--这个方法可以实现
 楼主| 发表于 2010-8-2 11:34:47 | 显示全部楼层
回复 27# menfan1


    没有设置密码 待机5次后 回来就停在了欢迎界面 必须点击用户名才能进去 还遇到一次待机回来显示器不能点亮
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-18 12:11 , Processed in 0.072888 second(s), 15 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表