Sendkeys ?

Hi
I am wondering if I have to script keyboard command ( sendkeys ) like {ALT}+{something}, or is there any other way to do it ?
4,503 views 15 replies
Reply #1 Top
I've been trying to figure this out as well... no luck as yet.  I hope someone who is familiar with the scripting for that pops in.
Reply #2 Top
Not with scripting as far as I'm aware of. For DesktopX you'll have to create an ActiveX, COM or plugin to do such.
Reply #3 Top
Its very easy. Please look at this little example:

Sub Object_OnStateChange(state)
If state = "Command executed" Then
On Error Resume Next
Set objShell = CreateObject("WScript.Shell")
objShell.SendKeys "%{TAB}" '<== this is equivalent for "ALT"+"TAB"
Set objShell = nothing
End If
End Sub

Then go to the MSDN Library: WWW Link

Hope you will found all that you need by this link.

Best Regards.   
Reply #5 Top
Ok, Thanks !,Keyboard Shortcuts can maybe be feature request in upcoming DesktopX

You can already define hotkeys with DesktopX object. Check out Object.RegisterHotkey in the docs.
Reply #6 Top
I found it,it sais, Object.RegisterHotkey hotkeyID, hotkeyValue, Do I register that in the objects script ?, or where ?
Reply #7 Top
You register it in any object you want, just make sure you include the function that handles the callback when the hotkey is pressed.
Reply #9 Top
I think this should work. (Not tested it yes. It's past my bedtime...)


Sub Object_OnScriptEnter
  Object.RegisterHotkey 1, &H0000007B 'Trigger on the F12 key (not tested)
End Sub

Sub Object_OnScriptExit
  Object.UnregisterHotkey 1
End Sub

Sub Object_OnHotkey(id)
  If id = 1 Then
    Object.OnTop
  End If
End Sub
Reply #10 Top
Thanks, I tried it, cant get it to work, what I would like to do is have an object as a shorcut ( open something ), but I would also like to have a keyboard shortcut, to do the same thing, say {Shift}+{A}
Reply #11 Top
Hm.... This is bugging me now. I can't make it work either.
This needs investigation.
Reply #12 Top
Hm, let me know when you figured it out, I tried [Select Case Key] but I had no luck with that either
Reply #13 Top
Look into AutoItv3.dll This can be used with DesktopX objects by registering it in a similar fashion to using the File System Object.

AutoIt has various automated features which could really enhance the scope of DesktopX.

Hopefully someone with more time will either explain how to do it now (otherwise wait forever (never) for me to post an example - sorry to be a ratbag).
Reply #14 Top
The functionality is there, but I dont know how to register hotkeys... what are the codes for the keys?  Yes, the docs say HOW to do it, but I dont know how to figure out what each key's code is.
Reply #15 Top
he functionality is there, but I dont know how to register hotkeys... what are the codes for the keys? Yes, the docs say HOW to do it, but I dont know how to figure out what each key's code is.

Yes, this is one of the few things the docs need to elaborate on.