A simple macro for Autohotkey program

Viewed 52

I work as an audio transriber and I need a script for transcribing interviews. Unfortunately, I have no experience in creating scripts for Autohotkey, so I would like to get a ready-made solution, if that’s even possible. In any case, any help is welcome.

What should the script do?

We have an empty Microsoft Word document in front of us. The first time I press Enter, the following text should be pasted (note, that only “Interviewer: ” text should be pasted (with whitespace in the end), all the other text will be typed by myself):

Screenshot

Then, the next time I press Enter, the text of the following content should be pasted on a new line:

Screenshot

And as you probably already guessed, the next time I press Enter, the text “Interviewer: “ should be pasted again on a new line.

Thus, the contents of the pasted text should change alternately (Interviewer, Respondent, Interviewer, Respondent and so on):

Screenshot

1 Answers
  • To get familiar with AutoHotkey read the Beginner Tutorial.

  • Create a script and add this code to it:

      #NoEnv
      #SingleInstance Force
      SetWorkingDir %A_ScriptDir%
    
    
      #IfWinActive  Word-Title  ; replace Word-Title by the title of the word document
    
          Enter::
              toggle := !toggle ; changes the value of the variable toggle between 1 (true) and 0 (false)
              if (toggle)
                  SendInput, {Enter}Interviewer:{space}
              else
                  SendInput, {Enter}Respondent:{space}
          return
    
      #IfWinActive
    

EDIT

To automatically swap to uppercase the first letter of the text which you will be typing, try this:

#NoEnv
#SingleInstance Force
SetWorkingDir %A_ScriptDir%

#IfWinActive Word-Title  ; replace Word-Title by the title of the word document

    Enter::
        toggle := !toggle ; changes the value of the variable toggle between 1 (true) and 0 (false)
        if (toggle)
            SendInput, {Enter}Interviewer:{space}
        else
            SendInput, {Enter}Respondent:{Space}
        SetCapslockState ON
        SetTimer, Set_CapslockState_OFF,  -1
    return

#IfWinActive

Set_CapslockState_OFF:
    Input, Char, B I L1 V
    SetCapslockState OFF
return
Related