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
Reply Children