Using AutoHotkey to Send Text Messages in Dentrix

The latest trend in dental office management is utilization of text messaging to remind patients of their upcoming appointments. Text messaging is wildly popular with young patients, but is also growing rapidly with older patients. A recent survey reported that adults between the ages of 55 and 64 send 38 text messages a month.

There are many companies offering text messaging services to dental office, but most are expensive and achieve the same results we can get for free using AutoHotkey and Google Voice with Dentrix.

Google Voice is a free phone service which offers free voicemail services, phone call forwarding, and free text messaging. When you set up your Voice account you have the option to choose a telephone among many available. We chose (919) BRU-SHEM!

AutoHotkey is a scripting application for Windows that allows one to reproduce a stream of keystrokes easily. In order for it to work with Dentrix in Windows 7, specifically, it must be run in XP mode:

  • Install AutoHotkey (use the Instaler for AutoHotkey_L option)
  • Open Windows Explorer (Win-E)
  • Navigate to C:\Program Files\AutoHotkey\
  • Right-click on AutoHotkey.exe, and select Properties
  • Click on the Compatibility tab
  • Select the checkbox for “Run the program in compatibility mode for:”
  • Select Windows XP (Service Pack 3) in the dropdown box
  • Select “OK”, and close Windows Explorer.

Here is how we handle texting with Dentrix in our office:

  • Install AutoHotkey
  • Copy the script at the end of the article to Notepad, and save the document as “texting_recall.ahk” on the Desktop.
  • Double-click on the script on the desktop to load it into memory
  • Open Google Voice and login to your account
  • Open Dentrix Appointment Book
  • For those using Dentrix G4 with Productivity Pack 7 or higher, hover over the target appointment and verify the presence of a mobile phone number. For those not on PP7 yet, hit Ctrl-F. This will activate a part of the script that will show the Family File for that patient for 2 seconds.
  • OPEN THE APPOINMENT CARD (double click on the appointment), and click Ctrl-Win-W. What you will observe is the script copying the date and time, opening the Family File, copying the mobile number, opening Google Voice, and pasting in the information.
  • Once you are sure that the text is filled in correctly, manually hit “Send” and return to the Appointment Book by hitting Alt-Tab.

The script sends a  message such as: “We look forward to seeing you at Dr. McCall’s office on 01/11/2011 at 2:00pm. Please reply with "c" to confirm.”

Patients that get the message can spend a few seconds sending a simple “c” to confirm the appointment. Google Voice will then forward this text message to your front desk person’s email address. They can then manually change the appointment’s status to “FIRM”.

The response from patients has been overwhelmingly positive. They love not being encumbered with answering the phone, and they are impressed with the level of technology we are conveying. There are some patients who are not on a texting plan and have to pay several cents for each text message received. If they complain, we will offer them a $1 credit on their account and make an alert not to use text messaging with them.

The script may need to be fine tuned for the particular computer using it. You may notice that there are sleep commands throughout the script. These are delays required to let Dentrix ready itself for the next command. It is possible that slower computers will require more delay time in order, and you may need to use trial and error to find the correct delay times.

This script works for confirming appointments for appointments coming soon. We can use this method, however, for sending text messages for other purposes. That will be the topic of another article.

Here is the script. You can paste it into a new txt file, but make sure that you remove any of the word wraps that incurred from the posting of it to this blog post:

;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;    Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;

#^w::
; scrapes data from Dentrix appt and FF and pastes it into Google Voice Text Message
;
; Begin with Appt open, scrape data
send !d
Send ^c
ClipSaved_1 = %Clipboard%
sleep 500
Send !t
Send ^c
ClipSaved_2 = %Clipboard%
sleep 500
send !p
sleep 1000
send {Enter}
sleep 500
send !h
sleep 500
Send {TAB 5}
sleep 500
send ^c
ClipSaved_3 = %Clipboard%
sleep 500
send !{F4}
sleep 500
send !{F4}
sleep 500
run https://www.google.com/voice
sleep 3000
send t
send %ClipSaved_3%
send {tab}
send We look forward to seeing you at Dr. McCall’s office on %ClipSaved_1% at %ClipSaved_2%. Please reply with "c" to confirm.
return

^f::
; opens the Family File to verify mobile phone number
send !f
sleep 800
send f
sleep 800
send {ENTER}
sleep 2500
send +{tab}
sleep 500
send {ENTER}
sleep 500
send !{f4}
return

14 Responses to “Using AutoHotkey to Send Text Messages in Dentrix”

  1. Hi Dana, This is a great writeup on how to implement texting easily! I’m coming across one problem that I can’t seem to debug: the appt time shows up as the phone number to be texted. Everything else is working like a charm! Any help to fix this would be greatly appreciated!

  2. Wendy,
    It sounds like the computer is flying through some step before a window is ready. Try replacing all of the code in your ahk file with this code instead:

    #^w::
    ; scrapes data from Dentrix appt and FF and pastes it into Google Voice Text Message
    ;
    ; Begin with APPOINTMENT CARD (in Appt Bk) and Firefox (with Gmail logged in) open
    ; From Appt card, hit Ctrl-Win-w
    send !d ; grab date
    Send ^c
    ClipSaved_1 = %Clipboard%
    sleep 500
    Send !t ; grab time
    Send ^c
    ClipSaved_2 = %Clipboard%
    sleep 500
    send !p
    WinWait, Dentrix Family File
    sleep 500
    send {Enter}
    WinWait, Patient Information
    sleep 500
    send !h
    sleep 500
    Send {TAB 5} ; grab mobile number
    sleep 500
    send ^c
    ClipSaved_3 = %Clipboard%
    sleep 500
    send !{F4}
    sleep 500
    send !{F4}
    sleep 500
    run https://www.google.com/voice
    WinWait, Google Voice
    sleep 3000
    send t
    send %ClipSaved_3%
    send {tab}
    send We look forward to seeing you at Dr. McCall’s office on %ClipSaved_1% at %ClipSaved_2%. Please reply with “c” to confirm.
    return

    If you still have problems with this, then PLEASE let me know. We can break it down a little bit to find where the error is happening.

  3. Dana, the script works great. One question: how does your office manage the replies Google Voice receives, since the reply doesn’t show any patient identifier other than their cell phone number? Thanks!

  4. So glad to hear that, Michael!

    When we get a text response from a patient, we just have to manually look through and see which phone number matches, unfortunately. So far this hasn’t been a problem, though, as G4 Productivity Pack 7 allows a quick pop up of the patient’s info from the Appt Book.

    One workaround, however, could be a change in the script that puts the patient’s preferred name at the beginning of the SMS message (since we aren’t close to using up the max 140 characters). Something like:

    Vanessa, we look forward to seeing you…..

    This way if there is a response to that message, you’ll see the original note in the thread with the preferred name. That’s hard when not everyone has a preferred name, though.

    Another option is to scrape the first and last names, then paste their initials at the end of the message in parentheses:

    We look forward to seeing you at Dr. McCall’s office on 3/31/11 at 8am. Please reply with “c” to confirm.
    return (VN)

    In order to get their initials, you’d copy their first and last names. Somewhere you’d paste a name, hit the {HOME} button, then the right button (to put the cursor to the right of the first letter), then hit ^{DELETE}. This will delete the rest of the word. Then paste the last name, get the cursor to the second letter in the last name, and ^{DELETE}, then put the parenthesis.

    just a few thoughts!!

  5. Thank you for the code. It works great in my case. Really wonderful!!

    One question: Is there a way to include just first name in the text message?

  6. You certainly could alter the script to scrape the first name. The problem, however, is which first name to scrape: the First Name or the Preferred Name? My concern is that improper use of the First Name could sound canned. Secondly, you have a 140 character limit on texts, so brevity is generally a virtue with texting. What are your thoughts on this? You pose a _really_ good question.

  7. I reallly appreciate your posting this info. I had been looking for ways to integrate 2 ways texting for years. The only problem I had with your scripts was that google was breaking up my texts into 3 seperate texts. I also didn’t like the year added as it just seemed to clutter up the message. Lastly I wanted to add a phone number so patients could call easily if they needed to talk to someone about their appt. Below is the script I use which I thank you so much for templating. My computer must be slow so I also added a few extra pauses and the following worked great for me.

    #^w::
    ; scrapes data from Dentrix appt and FF and pastes it into Google Voice Text Message
    ;
    ; Begin with APPOINTMENT CARD (in Appt Bk) and Firefox (with Gmail logged in) open
    ; From Appt card, hit Ctrl-Win-w
    send !d ; grab date
    Send ^c
    ClipSaved_1 = %Clipboard%
    sleep 500
    Send !t ; grab time
    Send ^c
    ClipSaved_2 = %Clipboard%
    sleep 500
    send !p
    WinWait, Dentrix Family File
    sleep 500
    send {Enter}
    WinWait, Patient Information
    sleep 500
    send !h
    sleep 500
    Send {TAB 5} ; grab mobile number
    sleep 500
    send ^c
    ClipSaved_3 = %Clipboard%
    sleep 500
    send !{F4}
    sleep 500
    send !{F4}
    sleep 500
    run https://www.google.com/voice
    WinWait, Google Voice
    sleep 4000
    send t
    sleep 1000
    send %ClipSaved_3%
    sleep 300
    send {tab}
    send Your appt. with Dr. McCall is on %ClipSaved_1%
    sleep 200
    send {BS}
    send {BS}
    send {BS}
    send {BS}
    send {BS}
    send {Space}
    sleep 500
    send at %ClipSaved_2%
    sleep 100
    send . Please reply with ‘C’ to confirm or call us at XXX-XXX-XXXX
    return

  8. Louis,
    So glad this could help you. Removing the year is a _great_ idea…makes it much more personal. I also like the idea of presenting the phone number, however if you route your Google Voice number back to your main number, people _should_ be able to call the texter with a single press, and the call would be routed back to your main number. That isn’t as obvious, though, and it’s likely that number presented in the text becomes a hyperlink to the phone’s dialer screen. So, it probably is a little better customer service to present it like you did.

  9. Can’t remember if I made this point in the article, but the first step in my code changes the appt’s status to “TXT”, a status I set up in the Dentrix status definitions. This lets the office know that the text has been sent (as opposed to a phone call, which is the next phase of confirmation)

    One other note: I added this code to jump through any Patient Alerts that may pop up:

    send !p ; OPENS FAMILY FILE
    sleep 1500
    IfWinExist, Family Alert
    {
    WinActivate, Family Alert
    sleep 300
    Send !d
    sleep 300
    Send {ENTER}
    }
    IfWinExist, Patient Alert
    {
    WinActivate, Patient Alert
    sleep 300
    Send !d
    sleep 300
    Send {ENTER}
    }
    sleep 1000
    click 135, 135, 2
    sleep 300
    WinActivate, Patient Information

    ALSO:
    You can truncate the date, a string that contains 10 digits always from Dentrix’s database (ie MM/DD/YYYY) by using this after saving the clipboard to ClipSaved_1a. This will remove the need for those slow, successive backspaces in your code:

    ClipSaved_1a = %Clipboard%
    StringLeft, ClipSaved_1, ClipSaved_1a, 5

    This will still have leading zeros through September and on the first 9 days of each month, however. To remove those is a lot more complicated and probably not worth it anyway.

  10. Great info Dana!!

    My patients have really loved the simplicity of the text reminders.

    I’ll update my code again to the changes you provided and thank you again for sharing this.

  11. I was using this system since last year. Suddenly it stopped working this may. I have been trying to make changes but wont work. I don’t know if its my comp setting changed.
    When I press the #^t (I use t for text) the cursor does not move to any of the date, time, or any family file, instead jumps over to google voice & types all the date without any date or time or name.

    Please help. I don’t know why its skipping all grab data steps.
    Any suggestions.

  12. Sanjay,
    That IS weird! Have you tried making a new script that only includes, say, the first 6 lines to see if it jumps to the time box?

  13. Hi, Dana, this has been great for me for many years! Thank you!. Recently, Google voice has changed format, and the script does not work as it did anymore. Instead, it prints the message in the address bar, we just copy and pasted to the text area. A bit trouble, but still works. Any suggestions? Thanks!

  14. Ugh. I have been so disappointed with the new Google Voice. The problem is that it can take anywhere from a handful of seconds to over 30 to fully load the page and have a target in which to type. At this point I am stymied and don’t really have a fix. Here are some ideas:

    you could try any of these…
    * Increase the “sleep 3000″ (3.0 seconds) to a high number, but this will be slower _every_ time you run the script.
    * Insert a MsgBox instead of Sleep that you click once the Google Voice page is fully loaded
    * Load some shortcuts for each of the blanks. (Win-Ctrl-p could “send %ClipSaved_3%” while WinCtrl-m could send the prepared message). This would require the user to manually “paste” each of the two messages separately in once the page is loaded.
    * Load just one shortcut for the blanks. truncate the script I posted at the sleep 3000 point, and put the lines that follow into a keyboard shortcut that the user runs when he/she see that Google Voice has fully loaded.

    I’m just throwing a few ideas out there without _any_ testing. While these require a little more interaction by the user, it could at least salvage this as a way to text out of Dentrix without spending hundreds of dollars a month.

Discussion Area - Leave a Comment