;这是一个设置OutLook获取LDAP服务器邮件列表程序
;服务器端使用ADAM软件
;设置OutLook2003启动路径
$OutLookPath="C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE /recycle"
;设置LDAP服务器名,连接用户名与密码
$ComputerName="ym-wsus"
$UserName="ym-wsus\administrator"
$Password="abc.123"
;设置LDAP服务器的搜索路径
$ADAMPath="ou=chtcontact,dc=mailaddress,dc=local"
;设置outlook在通讯簿中的名称
$MailListName="OutLook Contactor"
$info=0
if @DesktopWidth<>1024 then
$Width=@DesktopWidth
$Height=@DesktopHeight
$Depth=@DesktopDepth
$Refresh=@DesktopRefresh
$vRes = _ChangeScreenRes(1024, 768, 16, 60)
$info=1
If @error Then
MsgBox(262160, "ERROR", "Unable to change screen - check parameters")
EndIf
EndIf
;~ BlockInput(1)
sleep(2000)
run($OutLookPath)
sleep(5000)
WinWait("Microsoft Outlook")
send("!TO")
MouseClick("left")
MouseClick("left",395,188,1)
sleep(1000)
MouseClick("left",621,259,1)
sleep(1000)
send("!DN")
sleep(1000)
send("!N")
sleep(1000)
MouseClick("left",553,382,1)
send($ComputerName)
send("!i")
send("{Tab}")
send($UserName)
send("{Tab}")
send($Password)
send("!l")
send("!m")
MouseClick("left",521,430,1)
sleep(1000)
send("{Delete}")
MouseClick("left",456,444,1)
send($MailListName)
sleep(1000)
MouseClick("left",437,372,1)
sleep(1000)
MouseClick("left",403,534,1)
send($ADAMPath)
send("{Enter}")
sleep(1000)
send("!n")
sleep(1000)
MouseClick("left",878,660,1)
sleep(1000)
MouseClick("left",522,572,1)
sleep(1000)
if $info=1 then
$vRes = _ChangeScreenRes($Width, $Height, $Depth, $Refresh)
$info=0
If @error Then
MsgBox(262160, "ERROR", "Unable to change screen - check parameters")
EndIf
endif
BlockInput(0)
Func _ChangeScreenRes($i_Width = @DesktopWidth, $i_Height = @DesktopHeight, $i_BitsPP = @DesktopDepth, $i_RefreshRate = @DesktopRefresh)
Local Const $DM_PELSWIDTH = 0x00080000
Local Const $DM_PELSHEIGHT = 0x00100000
Local Const $DM_BITSPERPEL = 0x00040000
Local Const $DM_DISPLAYFREQUENCY = 0x00400000
Local Const $CDS_TEST = 0x00000002
Local Const $CDS_UPDATEREGISTRY = 0x00000001
Local Const $DISP_CHANGE_RESTART = 1
Local Const $DISP_CHANGE_SUCCESSFUL = 0
Local Const $HWND_BROADCAST = 0xffff
Local Const $WM_DISPLAYCHANGE = 0x007E
If $i_Width = "" Or $i_Width = -1 Then $i_Width = @DesktopWidth ; default to current setting
If $i_Height = "" Or $i_Height = -1 Then $i_Height = @DesktopHeight ; default to current setting
If $i_BitsPP = "" Or $i_BitsPP = -1 Then $i_BitsPP = @DesktopDepth ; default to current setting
If $i_RefreshRate = "" Or $i_RefreshRate = -1 Then $i_RefreshRate = @DesktopRefresh ; default to current setting
Local $DEVMODE = DllStructCreate("byte[32];int[10];byte[32];int[6]")
Local $B = DllCall("user32.dll", "int", "EnumDisplaySettings", "ptr", 0, "long", 0, "ptr", DllStructGetPtr($DEVMODE))
If @error Then
$B = 0
SetError(1)
Return $B
Else
$B = $B[0]
EndIf
If $B <> 0 Then
DllStructSetData($DEVMODE, 2, BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_BITSPERPEL, $DM_DISPLAYFREQUENCY), 5)
DllStructSetData($DEVMODE, 4, $i_Width, 2)
DllStructSetData($DEVMODE, 4, $i_Height, 3)
DllStructSetData($DEVMODE, 4, $i_BitsPP, 1)
DllStructSetData($DEVMODE, 4, $i_RefreshRate, 5)
$B = DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_TEST)
If @error Then
$B = -1
Else
$B = $B[0]
EndIf
Select
Case $B = $DISP_CHANGE_RESTART
$DEVMODE = ""
Return 2
Case $B = $DISP_CHANGE_SUCCESSFUL
DllCall("user32.dll", "int", "ChangeDisplaySettings", "ptr", DllStructGetPtr($DEVMODE), "int", $CDS_UPDATEREGISTRY)
DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, _
"int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width)
$DEVMODE = ""
Return 1
Case Else
$DEVMODE = ""
SetError(1)
Return $B
EndSelect
EndIf
EndFunc
posted on 2007-06-30 12:25
疾风随影 阅读(2477)
评论(3) 编辑 收藏 引用 所属分类:
Script & Batch column