51Testing软件测试论坛

标题: 如何进行键盘的组合操作 [打印本页]

作者: lingxin5013    时间: 2008-7-31 11:49
标题: 如何进行键盘的组合操作
我想使用wscript 进行键盘组合性操作如ctrl+alt+delete 如何?
谢谢!
作者: Elephant_leg    时间: 2008-7-31 15:39
Hi,

"it is a Win2k security that only users behind the keyboard (physical) are allowed to do the combination of Ctrl Alt Delete.

MCSE talks about this! "

From http://www.visualbasicscript.com/m_1796/tm.htm

解决方法:
1。 sending a cntrl-alt-del with vnc, weather tightvnc or realvnc, is built into the software and works on all os's. 上面链接中的方法。
2。 你可以用Alt+F4代替么?
    set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.SendKeys ("%(F4)")
作者: lingxin5013    时间: 2008-7-31 16:07
Udon't understand what the means i support ,as u way can resolvetion this question but that's not the key result which i wanted.but also say Thank you for u!
i wanner to use the"wscript" meathod to finish the key-board  combination  operation!
作者: Elephant_leg    时间: 2008-7-31 16:40
标题: 回复 3# 的帖子
Hi lingxin,

我没有看懂你的意思.

1. 你所指的 "wscript" method 是什么? 难道不是WshShell object中的SendKeys method?
2. 正如上面链接中提到的,如果Windows系统(三方软件除外)不支持在非物理键盘上Ctrl+Alt+Del,那么怎么可能不通过三方软件实现呢?我在Vista上试了一下,的确不行。 请高人指点。
作者: ★斌斌※测试☆    时间: 2008-7-31 21:41

作者: lingxin5013    时间: 2008-8-1 08:53
呵呵 你的方法我也没有实现 不过仍然非常感谢你! 呵呵  对我的意思就是使用WshShell object中的SendKeys method 时间键盘的组合性操作!!!!!  SOS ~~~
作者: Elephant_leg    时间: 2008-8-1 10:35
标题: 回复 6# 的帖子
Hi lingxin,

能否明确指出你想通过Ctrl+Alt+Del执行什么操作?

1。 如果你想打开资源管理器TaskManager, 请用这个代替:
set WshShell = CreateObject("Wscript.Shell")
WshShell.SendKeys "^+{ESC}"      
‘ 即CTRL-SHIFT-ESC

2。如果你想在local本地的情况下锁屏,请使用:
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%windir%\System32\rundll32.exe user32.dll,LockWorkStation"

//------------------------------
请参考Microsoft的官方说明:
http://www.microsoft.com/technet ... /nov04/hey1115.mspx
您明显没有仔细阅读我前面回复中提供的链接内容,所以以防万一,我复制过来:
In fact, the only way we could figure out how to lock a computer using a script was to write a script that did nothing more than use Rundll32.exe to call the LockWorkStation method of user32.dll:

On Error Resume Next

Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%windir%\System32\rundll32.exe user32.dll,LockWorkStation"

This works great for the local computer, but doesn’t do you much good if you’re trying to lock a remote computer; you can’t specify a remote computer name when running Rundll32.exe. But that’s OK: if this script only runs locally, then all we have to do is make sure it runs locally on the remote computer.
//----------------------------------------------------

3。 如果你的情况和这个人类似(local, 不使用VNC的情况下):
“I have a nocturne routine, but it's fully User Interface, everithing works  
  
good, but at that hour (2 am) my server is Locked and doesn't Run this  
  
routine, is there any way to put in the script a method to unlock the  
  
computer...  “

官方回复:
“can you write a script that unlocks a workstation? As far as we know, you can’t; in fact, as far as we know the only way to unlock a workstation is to have someone go to the computer, press Ctrl-Alt-Delete and log on.”
from http://www.microsoft.com/technet ... /nov04/hey1115.mspx

个人建议,使用google search你会找到你想要的答案,或者到这个论坛:http://www.sqaforums.com/postlist.php?Cat=0&Board=UBB20  这里高手很多。
作者: lingxin5013    时间: 2008-8-1 16:49
已经搞好了 非常感谢LS提供的资料 Goodjob  guy! 3Q




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2