Jump to content

How do I send a key to the OS?


Sori
 Share

Recommended Posts

I use a program called InputDirector as a software KVM. It allows me to use a second computer with my mouse and keyboard.

I also use a program called VNC Viewer which allows me to view the secondary computer on my monitor. (in this case, a secondary monitor)

I have my middle mouse button rerouted to run this program...

Dim $currActive

If WinGetState("Computer - VNC Viewer") = 0 Then
   $currActive = WinGetHandle("")
   Run ("C:\Program Files\RealVNC\VNC Viewer\vncviewer.exe")
   While WinActivate("VNC Viewer") = 0
      sleep(200)
      WinActive("VNC Viewer")
   WEnd
   Send("{ENTER}")
   While WinActivate("Computer - VNC Viewer") = 0
      sleep(100)
   WEnd
   ;WinMove("THELUCKYCRANE - VNC Viewer", "", -1280, 100, 1280, 800) ;Monitor on Left
   WinMove("THELUCKYCRANE - VNC Viewer", "", 1600, 0, 1280, 800) ;Monitor on Right
   sleep(100)
   WinActivate (HWnd($currActive))
ElseIf WinGetState("THELUCKYCRANE - VNC Viewer", "") = 5 Then
   WinSetState("THELUCKYCRANE - VNC Viewer", "", @SW_SHOW)
ElseIf WinGetState("THELUCKYCRANE - VNC Viewer", "") = 7 Then
   WinSetState("THELUCKYCRANE - VNC Viewer", "", @SW_HIDE)
EndIf

As you can see, this simply makes VNC appear and disappear.

Now... InputDirector allows you to activate and deactivate "screen-edge transition". Simply put, if screen edges are deactivated, I'm not allowed to move my mouse into the other computer.

Conveniently, you can set up shortcut keys, in order to activate and deactivate screen edges.

I have set up the keys as follows:

Right Shift + Right Control + Y -- activate

Right Shift + Right Control + F -- deactivate

------

How do I get autoit to send these commands, that Windows, or InputDirector will recognize it?

I've tried several different things to no avail.

I also tried having autoit send keys, which I used to create the shortcut keys (I.E. I know the keys being sent are the keys that InputDirector is looking for) But InputDirector still does not recognize the keys as being sent.

If you need help with your stuff, feel free to get me on my Skype.

I often get bored and enjoy helping with projects.

Link to comment
Share on other sites

*Temporarily changed Enable to Right SHIFT + Left CONTROL + Y for testing*

Code tested:

   Send("{CTRLDOWN}")
   sleep(10)
   ControlSend('', '', '', 'Y')
   sleep(10)
   Send("{CTRLUP}")

Only sends "Left Control" to shortcut window of InputDirector

Manually changed shortcut:

shortcut: LCtrl + LShift + Y - Did not succeed

shortcut: LCtrl + RShift + Y - Did not suceed

shortcut: LCtrl + Y - Did not succeed (lowercase y also did not succeed)

Code tested:

Send("^Y")

Did not succeed.

shortcut: LCtrl + y

Code tested:

Send("^y")

Did not succeed.

If you need help with your stuff, feel free to get me on my Skype.

I often get bored and enjoy helping with projects.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...