Loading ...
Sorry, an error occurred while loading the content.

Re: [dejavu-l] Another later version: AHK script for GT and AA results in same row (was Client not happy I used Google Translate)

Expand Messages
  • Bruno Sterckeman
    ... Hi Maureen, I was able to have it running under 7 minutes (I expect Herbert to chime in any moment now ;-), but the problem I have is GT s translation
    Message 1 of 4 , Apr 27 8:25 AM
    View Source
    • 0 Attachment

      program may add them again. Here is a more improved version (for
      Herbert's 7-minute challenge :-D):

      Hi Maureen,

      I was able to have it running under 7 minutes (I expect Herbert to chime in any moment now ;-), but the problem I have is GT's translation appear first, as it should, the cursor appears two lines below and nothing appears where I would expect to see the Autotranslate text.

      Bruno
    • catherinemuir53
      Hi, Maureen, I did as you instructed, but when I hit Ctrl+Alt+p, I get two identical lines of text, separated by a couple of blank lines. Seems like I should
      Message 2 of 4 , May 1, 2012
      View Source
      • 0 Attachment
        Hi, Maureen,

        I did as you instructed, but when I hit Ctrl+Alt+p, I get two identical lines of text, separated by a couple of blank lines. Seems like I should get something different from GT than from AA. Have I done something wrong?

        Cheers and thanks,
        Catherine Muir

        --- In dejavu-l@yahoogroups.com, Maureen Young <maureen.young@...> wrote:
        >
        > At 16:19 27/04/2012, Rob Laumen wrote:
        > >
        > >
        > >Hi,
        > >
        > > > Once you have installed the script, the only thing you need to
        > > > remember is what key combination to use, or if it is not working, to
        > > > rightclick on the AHK icon (green square with an H in the startup
        > > > programs in the bottom right of the screen) to reload it.
        > >
        > >Actually, an important prerequisite for this script to run is to buy a
        > >Google Translate API key.
        >
        > Oops, forgot about that! I had started using the script before it was
        > a requirement. I will add this reminder to the instructions. In any
        > case, this is also a requirement to use GT in DVX2 at all, and all my
        > script does is some copying, pasting and normal DVX2 commands.
        >
        >
        > > > And if you
        > > > do forget the key combination, just open the script text to see the
        > > > included instructions.
        > >
        > >And for people copying the script from your e-mail: delete two
        > >superfluous line breaks to make sure that all lines wrap properly -- I
        > >got two error messages after copying it into a text editor and running
        > >the script, saying that there was was an unrecognized action (first in
        > >line 21, and later line 24) (or words to that effect).
        > >
        > >Just wanted to point that out.
        >
        > Thanks. I think I've removed the extra line breaks, but one's email
        > program may add them again. Here is a more improved version (for
        > Herbert's 7-minute challenge :-D):
        >
        > Save the following (starting with "; to use this macro") in a text
        > file with a descriptive name, but with .ahk as the suffix. Anything
        > after a ; sign is a comment, (including instructions for getting
        > started, and explanations of what each command in the macro does)
        > which you can change freely without affecting the macro. You need to
        > install the free program AutoHotkey_L. Thanks to Dave
        > (asaptraduction) for helping me improve it, and anyone else feel free
        > to suggest other improvements. Be sure to take out all line breaks
        > inserted by the email program, as I am not sure what effect they may have.
        >
        > ; to use this simple macro, install AutoHotkey_L, save a text file
        > with ahk suffix, paste this script (first be sure to remove line
        > breaks that shouldn't be there, inserted by the email program), right
        > click on the file and choose Run to activate the script. After that,
        > when working in DVX2, you can click on the key combo to get the
        > behavior as descibed in the comments below. Put the file in your
        > startup file to make it run every time. Please send me a copy if you
        > add improvements. Maureen Young.
        >
        > ; this is a macro to get Assembly and GT results in a single DVX2 row
        > by pressing press Ctrl+Alt+p. If it stops working, check your
        > internet connection, otherwise rightclick on the little icon (green
        > with an H) in the bottom right in the startup programs, and select
        > Reload This Script. There are two extra commands included at the end
        > of the script, Ctrl+u for eliminating all text before the cursor, and
        > Crtl+d for eliminating all text after the cursor. The combinations
        > can be changed as needed.
        >
        > ^!p::
        > clipboard = ; first empty clipboard
        > Send ^g ; Ctrl+g to get GT translation
        > Sleep 500 ; give GT 500 milliseconds to run
        > Send +^{End} ; shift+Ctrl+end to select all the text
        > Send ^c ; Ctrl+c to copy text
        > ClipWait ; wait until the clipboard actually contains data
        > Send ^a ; Ctrl+a, replace the selected text with DVX2 assembly
        > Send ^v ; paste in the copied GT results
        > Send +{Enter 4} ; Shift + Enter fours time to put space between the paragraphs
        > Send {Up 2} ; up key twice. Vary these last two commands depending on
        > where you want the cursor to land
        > return
        > ; press ctrl+d to delete from cursor position to end of row
        > ^d::
        > Send ^+{End}{Del}
        > Return
        > ; ctrl+u to delete from cursor position to beginning of row
        > ^u::
        > Send ^+{Home}{Del}
        > return
        >
      • catherinemuir53
        With Maureen s help, I have sorted out the problem and have the macro running. The problem with Ctrl+A and Ctrl+G giving the same result was in my Assemble
        Message 3 of 4 , May 2, 2012
        View Source
        • 0 Attachment
          With Maureen's help, I have sorted out the problem and have the macro running. The problem with Ctrl+A and Ctrl+G giving the same result was in my 'Assemble' option, which is now fixed. I now have 'Assemble' set to 'First scan for whole segments' and then 'For portions not found in databases' I've ticked 'Use Machine Translation.

          My GT&AA.ahk script is as follows:
          ________________________________________________

          #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
          #Warn ; Recommended for catching common errors.
          SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
          SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

          ; to use this macro, install AutoHotkey_L, save a text file with ahk suffix, paste this script (first be sure to remove all line breaks inserted by the email program), right click on the file and choose Run to activate the script. After that, when working in DVX2, you can click on the key combo to get the behavior as descibed in the comments below. Put the file in your startup file to make it run every time. Please send me a copy if you add improvements. Maureen Young.

          ; this is a macro to get Assembly and GT results in a single DVX2 row by pressing Ctrl+Alt+p. To use it, you must have Ctrl+G activated in DVX2 by buying a Google Translate API key and inserting the activation code in DVX2. (If you can get GT results by pressing Ctrl+G, then you can use this macro.) If the macro doesn't work properly, make sure all commands are on a new line, and that there are no extra line breaks. I've added periods at the end of comments to make it more clear where a new line should start. If the macro stops working, check your internet connection. If your internet connection is not the problem, rightclick on the little icon (green with an H) in the bottom right in the startup programs, and select Reload This Script.

          ^!p::
          Clipboard = ; Empties the clipboard.
          Send ^g ; Ctrl+g to get GT translation.
          Sleep 500 ; Gives GT 500 milliseconds to run.
          Send +^{End} ; shift+Ctrl+end to select all the text.
          Send ^c ; Ctrl+c to copy text.
          ClipWait ; Waits until the clipboard actually contains data.
          Send ^a ; Ctrl+a, Replaces the selected text with DVX2 assembly.
          Send ^v ; Pastes in the copied GT results.
          Send +{Enter 4} ; Shift + Enter fours time to put space between the paragraphs.
          Send {Up 2} ; up key twice. Vary these last two commands depending on where you want the cursor to land.
          Return
          _________________________________________________

          Works a treat! Thanks, Maureen.


          --- In dejavu-l@yahoogroups.com, "catherinemuir53" <catherine.muir2@...> wrote:
          >
          >
          >
          > Hi, Maureen,
          >
          > I did as you instructed, but when I hit Ctrl+Alt+p, I get two identical lines of text, separated by a couple of blank lines. Seems like I should get something different from GT than from AA. Have I done something wrong?
          >
          > Cheers and thanks,
          > Catherine Muir
          >
          > --- In dejavu-l@yahoogroups.com, Maureen Young <maureen.young@> wrote:
          > >
          > > At 16:19 27/04/2012, Rob Laumen wrote:
          > > >
          > > >
          > > >Hi,
          > > >
          > > > > Once you have installed the script, the only thing you need to
          > > > > remember is what key combination to use, or if it is not working, to
          > > > > rightclick on the AHK icon (green square with an H in the startup
          > > > > programs in the bottom right of the screen) to reload it.
          > > >
          > > >Actually, an important prerequisite for this script to run is to buy a
          > > >Google Translate API key.
          > >
          > > Oops, forgot about that! I had started using the script before it was
          > > a requirement. I will add this reminder to the instructions. In any
          > > case, this is also a requirement to use GT in DVX2 at all, and all my
          > > script does is some copying, pasting and normal DVX2 commands.
          > >
          > >
          > > > > And if you
          > > > > do forget the key combination, just open the script text to see the
          > > > > included instructions.
          > > >
          > > >And for people copying the script from your e-mail: delete two
          > > >superfluous line breaks to make sure that all lines wrap properly -- I
          > > >got two error messages after copying it into a text editor and running
          > > >the script, saying that there was was an unrecognized action (first in
          > > >line 21, and later line 24) (or words to that effect).
          > > >
          > > >Just wanted to point that out.
          > >
          > > Thanks. I think I've removed the extra line breaks, but one's email
          > > program may add them again. Here is a more improved version (for
          > > Herbert's 7-minute challenge :-D):
          > >
          > > Save the following (starting with "; to use this macro") in a text
          > > file with a descriptive name, but with .ahk as the suffix. Anything
          > > after a ; sign is a comment, (including instructions for getting
          > > started, and explanations of what each command in the macro does)
          > > which you can change freely without affecting the macro. You need to
          > > install the free program AutoHotkey_L. Thanks to Dave
          > > (asaptraduction) for helping me improve it, and anyone else feel free
          > > to suggest other improvements. Be sure to take out all line breaks
          > > inserted by the email program, as I am not sure what effect they may have.
          > >
          > > ; to use this simple macro, install AutoHotkey_L, save a text file
          > > with ahk suffix, paste this script (first be sure to remove line
          > > breaks that shouldn't be there, inserted by the email program), right
          > > click on the file and choose Run to activate the script. After that,
          > > when working in DVX2, you can click on the key combo to get the
          > > behavior as descibed in the comments below. Put the file in your
          > > startup file to make it run every time. Please send me a copy if you
          > > add improvements. Maureen Young.
          > >
          > > ; this is a macro to get Assembly and GT results in a single DVX2 row
          > > by pressing press Ctrl+Alt+p. If it stops working, check your
          > > internet connection, otherwise rightclick on the little icon (green
          > > with an H) in the bottom right in the startup programs, and select
          > > Reload This Script. There are two extra commands included at the end
          > > of the script, Ctrl+u for eliminating all text before the cursor, and
          > > Crtl+d for eliminating all text after the cursor. The combinations
          > > can be changed as needed.
          > >
          > > ^!p::
          > > clipboard = ; first empty clipboard
          > > Send ^g ; Ctrl+g to get GT translation
          > > Sleep 500 ; give GT 500 milliseconds to run
          > > Send +^{End} ; shift+Ctrl+end to select all the text
          > > Send ^c ; Ctrl+c to copy text
          > > ClipWait ; wait until the clipboard actually contains data
          > > Send ^a ; Ctrl+a, replace the selected text with DVX2 assembly
          > > Send ^v ; paste in the copied GT results
          > > Send +{Enter 4} ; Shift + Enter fours time to put space between the paragraphs
          > > Send {Up 2} ; up key twice. Vary these last two commands depending on
          > > where you want the cursor to land
          > > return
          > > ; press ctrl+d to delete from cursor position to end of row
          > > ^d::
          > > Send ^+{End}{Del}
          > > Return
          > > ; ctrl+u to delete from cursor position to beginning of row
          > > ^u::
          > > Send ^+{Home}{Del}
          > > return
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.