My Own Transcription Service

Hey, you are too fast for me. :cold_sweat: I just tested it. You are right, it works wonderfully!! :sunglasses:

I uploaded the new version (see edit note above).

Thanks so much Tom! I was still on the fence regarding buying the software, but this automation already made it worthwhile to purchase it. Nuance offers a cloud service that does pretty much the same as this macro, but with less flexibility (no Evernote integration and no possibility to use 3rd party apps on the iPhone) for a monthly fee of I think 20 USD, which I wouldn’t be able to afford…

THANK YOU! I hope lots of people will be able to make use of this.

1 Like

Fine that it works now :smile:

Have you tested if you also get the occasional Evernote error (“Operation would exceed…”, see above)?

To test it —If you already have downloaded the 2nd version of the macro— you have to comment the line “set HTML content…”. (Commenting in AppleScript is done with --)

If you don’t see this error across several runs, I would recommend that you leave that line commented, because it is a workaround and as such it shouldn’t be used when not necessary.

Another little thing:

You should make sure that all your audio files have distinct names. The note in EN is created with the base name of the audio file as title. That means, if you have two or more notes with the same title in EN the audio file will likely be attached always to the same note, so you’ll end up with one note with several audio attachments and the other with none.

To avoid this you could use for example a timestamp for naming the input audio files.

Have fun!

Hi Tom,
I don’t get the error you mentioned, so I just left it alone. I’ll put in that line as a comment, just in case I end up needing it at some point in the future.

I also managed to add a tag to the note in EN! Yay.

I use an iOS App called Voice Record Pro, which does exactly what you suggest (gives files names based on date and time, so this shouldn’t become an issue in my case)

Thanks for all your help!

Apropos brute-force:

In the Dragon part of your macro there are still very ugly mouse-click and keystroke actions, supposedly to make Dragon send the text to TextEdit(?). Did you check if there really isn’t any other possibility, for example saving the text in Dragon as txt file?

the options I get through the GUI are to save as

  1. Rich Text or
  2. MS Word.

When I chose 1), I can chose between TextEdit and MS Word to open the file
When I chose MS Word (file format I guess), I can chose to open it with TextEdit, MS Word or Pages.

I can chose the folder where these files are saved to, and I can also opt to have the text copied to the clipboard. But it will still open the file in the program specified.

When I look in Apple Script Editor, Dragon has a Dictionary, so I assume it could be done with Applescript. But like I said earlier, I don't have any understanding of programming languages in general. Although, I did manage to get Evernote to add a tag to the Applescript you provided. :astonished:

Here is the Dragon Dictionary (if that even works?) in case you want to try your luck... :wink: Dragon.sdef.zip (4.9 KB)

David

Here is the Dragon Dictionary (if that even works?) in case you want to try your luck..

Heck, it’s all in there what we need!

We could even automatically publish the transcribed text on Facebook and then reimport to Evernote, after having tweeted an excerpt :wink:

the options I get through the GUI are to save as

  1. Rich Text or

OK, so it does save the file. Why are we going through TextEdit then? Rtf can directly be imported to Evernote. If it really forces the rtf to be opened in TextEdit, then it’s completely sufficient to simply close the TextEdit window while the Evernote import is already running. But I really can’t imagine that the force-opening of the file in TextEdit can’t be disabled somehow…

I can try to set up an AppleScript, based on the Dragon dictionary. But this will be a shot in the dark (or at least in the dusk) because I can’t run the script. But it shouldn’t be too complicated, basically:

  1. When triggered, import the audio to Dragon:
  • In AppleScript this will either be simply open or make [document] with data
  1. The transcription process, which I don’t know. But if the preferences are all set, maybe it’s as simple as doing nothing, assuming that the make with data already starts the transcription process. (According to your macro you aren’t doing big stuff here.) You’ll have to check this out and maybe fiddle around a bit…
  2. save in [filename] as [rtf], close window 1
  3. Handover to the Evernote script, etc.

Like this?

tell application "Keyboard Maestro Engine"
	set fileBase to make variable with properties {name:"TS__File base"}
	set fileBase to value of fileBase
	set inFolder to make variable with properties {name:"TS__In folder"}
	set inFolder to value of outFolder
end tell

tell application "Dragon"
	open document with data (inFolder & "/" & fileBase & ".mp3")
    save in (outFolder & "/" & fileBase & ".rtf")
	close window 1
end tell

(now add the portion about append text to file and the next script to import into Evernote, no need for the script to save to a file, since we just did that, right?)
dvd

Voilà, great! Does it work?

You see, it’s less complicated than scripting a dozen mouse clicks and keystrokes :wink:

no need for the script to save to a file, since we just did that, right?

If you mean the TextEdit part, No. You can skip this. Except if Dragon force-opens a TextEdit window, then you should simply close it via AppleScript.

Nope. I get a window Keyboard Maestro - AppleScript Results
The output of the text script is:

/var/folders/k2/5g94lc3s0_1dp78vq33krch40000gn/T/Keyboard-Maestro-Script-8A76ACBC-77BE-4651-9599-1606844228DA:386:387: 
script error: Expected “given”, “with”, “without”, other parameter name, etc. but found “(”. (-2741)

hm. I fiddled with the line “open document with data” (“open document with” and “open document”) but no result. Dragon doesn’t do anything.

I had another error before, re outFolder not being defined, so I added this line under the inFolder line:

set inFolder to make variable with properties {name:"TS__In folder"}

but still doesnt work…

For setting up AppleScripts you should use the Script Editor, which is preinstalled on your Mac.

It gives you more debug info and it autocorrects the syntax in many cases. The important info you find in the bottom part of the window; set it to Events or Replies:

You can even do this with the unmodified KM variables in the AppleScript. You just have to make sure that the variables are correctly set. Currently they will likely be deleted because of the cleanup at the end of the KM macro. Disable the cleanup and run the macro, or run the actions that initialize the variables individually.

You can check the values of the variables in KM’s preferences.

Expected “given”, “with”, “without”, other parameter name, etc. but found “(”. (-2741)

You’ll have to tell it that the expression in the parenthesis is a file. So —probably:

open document POSIX file (inFolder & "/" & fileBase & ".mp3")    

(with or w/o document )

But are you sure it isn’t the make command? Or is this for creating a new voice recording?

inFolder is already defined in your script above. What you want is:

  set outFolder to make variable with properties {name:"TS__Out folder"}
  set outFolder to value of outFolder

still won’t work. I get this error:
"Script Error:
Dragon got an error: Can’t get POSIX file “/Users/david/Dropbox/Apps/Voice Record Pro/20160329-155754 00-28-13-685b.mp3”."
I tried all sorts of combinations:

open POSIX file (inFolder & “/” & fileBase & “.mp3”)
open document POSIX file (inFolder & “/” & fileBase & “.mp3”)
open file
open document
open document file
and all the options with “make” instead.

I get this error, or (I feel like more often when I put in “make”) Dragon closes and wants me to send a bug report to the mothership.

Its ok, I think my ‘brute force’ method is workable, especially once I have moved this to a headless machine…

Well, if the file opening doesn’t work stay with the brute force. What we needed is Dragon user with some scripting experiences. I looked in the Dragon forum, but for “AppleScript” I get exactly 10 (not so competent) search results.

As a last attempt ;), I would try to do at least the save with AppleScript. According to the dictionary this seems to be unambiguous:

Well then… :roll_eyes: --> :grinning:

Hi Thanks so much Tom for your help. This is making it worthwhile for me to purchase KM. I don’t know if you work for KM, but they should be paying you that is sure! :moneybag:

Glad to hear that you are happy with your macro. And no, I don’t work for KM!

@Tom, thanks for sharing all of your hard work here. Looks like you have developed quite a tool.

There a number of folks over in the Evernote forum that have been looking for a solution like this for a long time. I posted a link in the EN forum to your post above where you published the macro.

If you make any further updates to your macro, could you please:

  • Add a date and version# to the post so we know it's been updated
  • Add a new reply to this thread announcing/notifying us of the update (that way we will get an email notification).

Thanks again.

Please note that the final/current/working version of the macro is not in my hands. Since I don’t have the Dragon transcription software on my Mac I could only write and test the parts around Dragon (TextEdit and import of text and audio attachment to Evernote).

The Dragon part is still brute-force (to use your words) and it’s quite possible that @David_Landes will have to tune it. But I’m sure he will post an update here.

Thanks for linking this in another forum. This certainly increases the chances to find a Dragon user who can contribute a proper AppleScript for the Dragon part :wink:

@JMichaelTX Excellent idea to post the link in the Evernote Forum. Would be awesome if anyone comes up with a completely scripted version. For now, the macro uses the GUI of Dragon to start the transcription process.

Here is the latest version. I struggle a bit with having to re-check the mouse coordinates everytime I quit and restart Dragon (I use a laptop and hook it up to a larger screen at the office)

Transcription Service.kmmacros (14.8 KB)

1 Like