Script for deleting from cursor position in a segment?

Dear colleagues,

I have been using the following script to delete all text from cursor position in a target segment, but all of a sudden it's no longer working (maybe a conflict in key assignment after installing new programs on my computer?)  Can someone help me tweak this script to make it work again?  I just took a quick look at Studio 2017's shortcuts and only see a shortcut for clear target text, not exactly what I was looking for.

Thank you!

Chunyi

 

^D:: ; Delete to end of segment
 sendinput, +^{PgDn}
 sendinput, {Delete}
 sleep, 100
 sendinput, {Esc}
 return 

Parents
  • Hi Chunyi,

    A few things:

    - Your script works for me, but I'd try inserting a Sleep 100 between the first 2 SendInputs.

    - Sending an escape character does nothing in Studio... I'd delete that line.

    - There is already a shortcut in Studio that deletes from cursor to the end of segment (and it's CTRL+d by default; in English it says Delete to end of row, check it, please). If you use the same default Studio shorcut as an AutoHotkey hotkey, then your AutoHotkey script should run fine anyway.

    - Check that your script is running (little green  icon in the Windows tray system). Any other color or letter means your script is suspended or paused.

     

    I'd try with this:

    ^d:: ; Delete to end of segment
    sendinput, +^{PgDn}
    sleep, 100
    sendinput, {Delete}

    return

    Good luck!

    … Jesús Prieto …

  • Hi Jesús,

    Thank you so much for your input. Now that you mentioned it, I think I was using the Studio's Ctrl+D shortcut instead of the AHK script! I just replaced my script with yours and tested it, but the issue remains. The issue I am experiencing is, rather than deleting the entire text from cursor position, one Chinese character gets deleted, and "ddddd..." gets inserted. I suspect this shortcut is being used by other plug-ins I recently installed, but I have no idea which one is the culprit.
    Maybe I should try a different shortcut combo?

    Chunyi
  • Why do you need an extra script for that, when Studio has such shortcuts out of the box?
    As I changed them, I cannot exactly remember what which of those does, but:
    The shortcuts are CTRL+D and CTRL+SHIFT+D
    One deletes until the end of the line, the other one to segment end. One stops on tag, the other one does not stop, but deletes even tags.

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

Reply
  • Why do you need an extra script for that, when Studio has such shortcuts out of the box?
    As I changed them, I cannot exactly remember what which of those does, but:
    The shortcuts are CTRL+D and CTRL+SHIFT+D
    One deletes until the end of the line, the other one to segment end. One stops on tag, the other one does not stop, but deletes even tags.

    _________________________________________________________

    When asking for help here, please be as accurate as possible. Please always remember to give the exact version of product used and all possible error messages received. The better you describe your problem, the better help you will get.

    Want to learn more about Trados Studio? Visit the Community Hub. Have a good idea to make Trados Studio better? Publish it here.

Children