Jump to content

"Key press exchange"?


Herskar
 Share

Recommended Posts

Hi, all!

Background: I have been subtitling since 1995, using professional software. I've set my Preferences up in three applications, and since 1995 I've been using the same key presses for the same functions. Hello, New World, we're using browser solutions, and they've all got their own settings. I'm just not in the mood to retrain my fingers every other day, I need a way to make all those we solutions think that I press "their" key combos when I actually press "mine".

Example:
I press "Numpad5" to play/stop video. If the web solution I'm using wants me to press "Ctrl-Space", how would I get AutoIt to "fool" the web thingy into thinking I've just pressed Ctrl-Space when I in fact pressed good old "Numpad5"

Using AutoHotKey, it seems I should go with:
Numpad5::

^Space

And a return to finish it off.

Fine, I got the above one to work. But the following does not:

^b::
!+I

 

I have gotten used to pressing Ctrl-B in order to have the thing happening that the browser solution calls "Alt-Shift-I".

All of the above is AutoHotKey, mind.

I've read all kinds of tutorials on AutoIt, and I might be dense, but I just can't figure out how to make "my command act like your command".
 

What's "Alt" in AutoIt? Exclamation mark?
Shift is + ?

Control is ^?

How do I note "their command" Alt-U in my script? {Altu}?

Again, sorry if I am dense.

Link to comment
Share on other sites

You can edit your original post to change "we solutions" to "web solutions" rather than making a new post.

I used to use AutoHotKey maybe twelve years ago but switched to AutoIt when I discovered it was eminently more suitable.

Just type "Send" into your Scite editor and then hit F1 for help. All is explained. But yes, "+" is shift "^" is CONTROL and "!" is ALT.

So to send CONTROL F4 you would use ,  Send("^{F4}")

To trap your desired HotKey, use for example, HotKeySet("{F10}", "F10Handler") and then write a suitable handler, Func F10Handler(), for that hotkey, in this case F10.

Try running the example found in the Send help.

 

Edited by pseakins

Phil Seakins

Link to comment
Share on other sites

; press shift+ESC to exit
_HotKey("+{ESC}")
_HotKey("{Numpad5}")
_HotKey("^b")
Func _HotKey($hotkey = "")
;       ! ALT  + SHIFT  ^ CONTROL  # WinKey
    Switch @HotKeyPressed
        Case "+{ESC}"
            Exit 0*MsgBox(64 + 262144, Default, "Exit", 1)
        Case "{Numpad5}"
             send("^{Space}")
        Case "^b"
             send("!+i")
        Case Else
            If Not IsDeclared("hotkey") Then Return MsgBox(16 + 262144, Default, "No CASE statement defined for hotkey " & @HotKeyPressed,15)
            If HotKeySet($hotkey, "_Hotkey") = 0 Then Return MsgBox(16 + 262144, Default, "Hotkey " & $hotkey & " invalid or set by another application.",15)
    EndSwitch
EndFunc   ;==>_HotKey

While Sleep(100)     ; here should be your application.
WEnd                 ; meanwhile, here is a dummy loop.

 

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

Thanks, if I'd seen an "Edit" button anywhere, I'd've used it.

I typed "Send" and hit F1. I am sorry, but not a thing happened.

Let's say I would like "Numpad5" to be understood as "Ctrl-Space"  - how would I type that out? 

(Command I want to use)

(what I want it to be understood as)

(Anything in before, inbetween or after)

Ie:
Numpad5 (or is it Numpad 5, or Num Pad 5?)

(something, like "::" saying "the previous is to be understood as the following")


^Space (or ^ Space or {^Space} or {^ Space}

 

Link to comment
Share on other sites

8 minutes ago, Exit said:
; press shift+ESC to exit
_HotKey("+{ESC}")
_HotKey("{Numpad5}")
_HotKey("^b")
Func _HotKey($hotkey = "")
;       ! ALT  + SHIFT  ^ CONTROL  # WinKey
    Switch @HotKeyPressed
        Case "+{ESC}"
            Exit 0*MsgBox(64 + 262144, Default, "Exit", 1)
        Case "{Numpad5}"
             send("^{Space}")
        Case "^b"
             send("!+i")
        Case Else
            If Not IsDeclared("hotkey") Then Return MsgBox(16 + 262144, Default, "No CASE statement defined for hotkey " & @HotKeyPressed,15)
            If HotKeySet($hotkey, "_Hotkey") = 0 Then Return MsgBox(16 + 262144, Default, "Hotkey " & $hotkey & " invalid or set by another application.",15)
    EndSwitch
EndFunc   ;==>_HotKey

While Sleep(100)     ; here should be your application.
WEnd                 ; meanwhile, here is a dummy loop.

 

And after:

"Case "^b"

send ("!+i")
 

 

I'll just pour in whatever else I need my script to do, like Ctrl-PageUp act like Alt-U, I would guess:

Case "{ ^PgUp}

send("!u")

Yes?
Do I really need the half-a-novella beginning Case Else?  Or, actually, anything at all but a list of what commands I'd like read as what other commands?

Link to comment
Share on other sites

9 minutes ago, Herskar said:

Thanks, if I'd seen an "Edit" button anywhere, I'd've used it.

There are certain restrictions depending on your user status. I'm not sure, but "new members" may not have the EDIT option available yet.

forum-information

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

47 minutes ago, Herskar said:

I typed "Send" and hit F1. I am sorry, but not a thing happened.

Perhaps you don't have the full Scite4AutoIt3 installation. It has brilliant, context sensitive help. This _may_ be the correct download link.

https://www.autoitscript.com/site/autoit-script-editor/downloads/?new

@Exit's post is much more useful than mine. Follow his script, you'll get the idea.

Phil Seakins

Link to comment
Share on other sites

I tried to use Exit's script, I sawed this part off:

Func _HotKey($hotkey = "")
;       ! ALT  + SHIFT  ^ CONTROL  # WinKey
    Switch @HotKeyPressed
        Case "+{ESC}"
            Exit 0*MsgBox(64 + 262144, Default, "Exit", 1)
        Case "{Numpad5}"
             send("^{Space}")
        Case "^b"
             send("!+i")
        Case Else
            If Not IsDeclared("hotkey") Then Return MsgBox(16 + 262144, Default, "No CASE statement defined for hotkey " & @HotKeyPressed,15)
            If HotKeySet($hotkey, "_Hotkey") = 0 Then Return MsgBox(16 + 262144, Default, "Hotkey " & $hotkey & " invalid or set by another application.",15)
    EndSwitch
EndFunc   ;==>_HotKey

 

And Numpad5 just splendidly takes Ctrl-Space's seat, yay! However, Ctrl-B does not manage to do Alt-Shift-I's job. Alt-Shift-I does, though. Just for the heck of it, I replaced "i" with "I" in the 'send ("!+i")' bit, but still no go. It's the exact same result I've been getting with AutoHotkey: Some switches work, some don't.

I guess I'll just have to give up, and be the script myself. Each and every time A Streaming Service update their tool, I'll redo "Keyboard Short cuts". It's the Jurassic Digital Age, and it irks me to bits. Thank you, all - I'll go drink lots of beer now.

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...