Send windows key in vbs?

大憨熊 提交于 2020-02-02 03:08:27

问题


I've looked everywhere for this, is it actually possible to do? If you press WIN + LEFT ARROW it will mount your selected window to the left of your screen, and that's exactly what I'm trying to do.

I have tried things like:

shl.sendkeys "#{LEFT}"

Because I found out that # could be for WIN just like + is for Shift and % is for Alt.

This may be a stupid question but it would help me out so much. Thank you for you time


回答1:


VBScript's SendKeys doesn't support the Windows key.


You can use AutoIt instead:

Send("{#Left}")



回答2:


Set Keys = CreateObject("WScript.Shell")

Keys.SendKeys("^{Esc}")

This should work, it Simulates the push of the Windows key by pushing the CTRL ^ and the ESC {Esc}keys, i don't know how to make the window mount to the left of the screen




回答3:


Oh, so you want to mount the window to the left, I currently don't think there's a way to do that, but there's another shortcut for start menu, as well as windows key, it's Ctrl+Esc, ^{ESC}, you could possibly run the onscreen keyboard, then somehow tab over to the key, but it would be hard, also how about trying Alt+Space, %{SPACE}, to click the window icon then, M for move, then set the cursors position to the left of the screen, somehow? I don't currently need help moving the cursor in V.B.S., but you could Google it. Hash symbol is actually typing the symbol #, hash, tested with this. I also got help on the send-keys function, here. I have way to much researching, but I still can't find a answer. Some-one also said using "Auto hotkey", a third party program, but I don't really trust programs that can take control over your whole PC.


So I guess your options are:

  • Alt+Space to click window icon, then M for move, then move cursor to left side of the screen
  • Auto HotKey, although I don't recommend it.
  • Other commands, but SendKeys, in VBS,
  • Running a file, built in a different language to do so.
  • Or well, waiting-for / asking Microsoft to add it in, in the next version of Windows?!



回答4:


Yes, You can send the windows key in VBS.

Set vb = CreateObject("WScript.Shell")
vb.Sendkeys "^{ESC}"

It's actually alt + Esc work as windows key.



来源:https://stackoverflow.com/questions/23576365/send-windows-key-in-vbs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!