AutoHotKey not working

Hi, I use Studio 2019 and have just installed the AutoHotKey Manager plugin (and also the Microsoft program mentioned here: community.sdl.com/.../3171.ahk-plugin), but I cannot get it to work. I have added 2 scripts which I found on other Studio support pages:

#IfWinActive ahk_exe SDLTradosStudio.exe
;------------------------------------------------------------------------------
;Go to next segment
;------------------------------------------------------------------------------
^{Down}::
Send ^{PgDn}
Send {Down}
Send ^{PgUp}
return

and

#IfWinActive ahk_exe SDLTradosStudio.exe
;------------------------------------------------------------------------------
;Go to previous segment
;------------------------------------------------------------------------------
^{Up}::
Send ^{PgUp}
Send {Up}
Send ^{PgDn}
return

Their effect should be to enable Ctrl+Up/Down to move one segment up or down in a text (regardless of whether or not the segment is confirmed or not - for some reason, the default Ctrl+Up/Down keyboard shortcuts in Studio jumps to next/previous unconfirmed segment even though this does not seem to be the intended behaviour), but they do not work. I even disabled the default Ctrl+Up/Down shortcuts in Studio's settings in order to avoid conflicts, but this did not change anything. Can anyone help with this, please? Of course, if anyone can tell me how to get the "normal" Studio shortcuts for "Move to Next/Previous Segment" to do exactly this rather than moving to next/previous unconfirmed segment, that would be great, although I would also like to get AutoHotKey Manager to work!

Thanks a lot in advance.

Best regards,
Dennis

  • Hello  

    Try these which I use all the time:

    ;------------------------------------------------------------------------------
    ; Move to next segment
    ;------------------------------------------------------------------------------
    #IfWinActive SDL Trados Studio
    !right::
    Send, {ctrl down}{pgdn}{ctrl up}
    Send, {down}
    Send, {ctrl down}{pgup}{ctrl up}
    Return
    #IfWinActive

    ;------------------------------------------------------------------------------
    ; Move to previous segment
    ;------------------------------------------------------------------------------
    #IfWinActive SDL Trados Studio
    !left::
    Send, {ctrl down}{pgup}{ctrl up}
    Send, {up}
    Send, {ctrl down}{pgup}{ctrl up}
    Return
    #IfWinActive

    Seems odd... but never fails for me.

  • Thanks Paul,

    After all the years I have used Studio, I had no idea that Ctrl-PgUp and Ctrl-PgDn moved the cursor to the start and of the segment.

    Nice to know. Much easier than my AutoHotkey suggestions in the other forum, as you don't have to check for empty segments :-)

    Best regards,
    Bruce Campbell
  • There's always room to learn Bruce... I didn't know this either and the core part of the script wasn't my own invention!
  • To write code is not so easy work.
    You have to try to cover all possible cases.

    In this code, you missed two of them.
    Both of them are related with silly bug of SDL Trados Studio

    1/2 You are at segment number "1" and AHK code goUp executed.
    2/2 You are at the last segment number and AHK code goDown executed.

    Fortunately, AHK is just outsider of SDL Trados Studio so it doe not make any kind of fatal error.
    If you executed same action from inside of SDL Trados Studio (PlugIn) you will regret.
    SDL should fix this part. Block the Orange numberless segments (Top and Bottom segments).

    regards

     

    [EDIT]

    There is No way to achieve this goal perfectly through AHK.
    Because AHk is blind to SDL's segment (I told you, AHK is just outsider...)

    But, If you use PlugIn, it is so easy and PERFECT. right ?


    It is very strange to me, why any customer never complained about this? This so simple and basic function to be offered by SDL. Not through this kind of amateur codes but by professional engineers touch.

  • and

    It is some rare cases though, You have to consider.

    I have checked with simple AHK codes.

    It jumps "numberless segs" sometimes and the others visited.

    I can not figured out reasonable logic from there.

    But, If you use PlugIn, it works perfectly. I mean, just visits numbered segments.

    Do you want to visit numberless segs too ? I do not know. Looks like PlugIn is Not ready to do it properly too.

    I guess, SDL should try to remove this numberless segments.

  • Hi
    Actually, I cannot remember when Ctrl+Up/Down behaved in any way other than jumping to next/previous unconfirmed segment. It is normal behavior since SDL Trados Studio 2014 as a minimum.
    What regards your script, most probably it 'does not work' because you expect a different effect. This script is for Page Up and Page Down buttons, not for Ctrl+Up/Ctrl+Down.
    I borrowed this script from Nora Diaz (2 lines look different from yours, but your script mentions PgUp and PgDn too, then why do you expect any effect from pressing Ctrl+Up/Down?):

    #IfWinActive ahk_exe SDLTradosStudio.exe
    ;------------------------------------------------------------------------------
    ;Go to next segment
    ;------------------------------------------------------------------------------
    PgDn::
    Send ^{PgDn}
    Send {Down}
    Send ^{PgUp}
    return

    #IfWinActive ahk_exe SDLTradosStudio.exe
    ;------------------------------------------------------------------------------
    ;Go to previous segment
    ;------------------------------------------------------------------------------
    PgUp::
    Send ^{PgUp}
    Send {Up}
    Send ^{PgDn}
    return

     

    It works fine. With Page Up / Page Down buttons

  • Kelly Edward said:

     

    There is No way to achieve this goal perfectly through AHK.

    Who told you that? The PgUp/PgDn script works well no matter what segment you are at.

  • I guess you put your computer speaker OFF
    Don't you hear "Ding" sound ? when you try to "PgUp" at the first segment and try to "PgDn" at the last segment ?
    or you just enjoy the irritating "Ding" sound.

    That "Ding" means, usually, an Error.

  • Hi Stepan Konev,

    I agree that Ctrl+Up/Down have always jumped to next/previous unconfirmed segment, but since the description in Options does not mention "unconfirmed", either the description or the function seems to be wrong. When the descriptions of these hotkeys say that they should cause a jump to "next segment", I expect that - not a jump to next unconfirmed segment. This should be looked at by SDL.

    Yes, I copied the script from Nora Diaz' post on proz.com, but I then changed it in the way I thought would cause the hotkeys Ctrl+Up/Down to work in the same way that PgUp/PgDn worked in Nora Diaz' original script, because I prefer keeping the original functioning of PgUp/PgDn. It was because of these changes that I was expecting a different result from the original script. I guess this is the meaning of scripts - that you can program them the way you want. And since that did not work, I asked for help here.

    I tried the original scripts too. They do not work, either (when pressing PgUp/PgDn). Still hoping for help!
  • Hi Paul,
    Thanks for your reply. I tried your scripts, but I am not sure which hotkeys should activate them? I tried left/right arrows with Ctrl, Alt and Shift, and nothing works. Btw, do you know of a page that explains how to program scripts? I had found one with a few commands, but I seem to have closed that tab in my browser...
  • Ok, but did you see your version of 'Nora Diaz's post on proz.com' differs from what I originally borrowed from her post?
    Line 5 reads ^{Down}:: in your case and PgDn:: in mine. I am not sure if this makes any difference, but what if it does?..
  • Hi

    I guess the first thing is to make sure you actually installed AutoHotkey itself? The plugin is just a way to help manage the scripts, but you still need to have the AutoHotkey application installed in the first place. May be a silly question, but thought I'd check the obvious first.

    The shortcuts can be whatever you like... they are currently these:

    !right::

    That means Alt+right arrow key

    !left::

    Alt+left arrow key

    This might be useful for you:

    www.autohotkey.com/.../Tutorial.htm
  • Paul said:

    !right::
    That means Alt+right arrow key
    !left::
    Alt+left arrow key

    This might be useful for you:
    www.autohotkey.com/.../Tutorial.htm

    For me either. Thank you Paul.

  • Yes, I changed this line on purpose. In Nora Diaz' version, it is the PgDn (Page Down) key that activates the script. I wanted to use Ctrl+Down. The ^ character indicates Ctrl, and {Down} should indicate the down arrow key (I am not sure that the parenthesis should be there, so I just tried with ^Down, but this also does not work). I also tried with the original PgDn, and this does not work, either. Thanks for pointing it out, though.