Using AutoHotKey with Sparx EA, the basics

      No Comments on Using AutoHotKey with Sparx EA, the basics

A few weeks ago I responded to a thread on the Sparx EA forum that was asking Sparx to enable paste special to the Notes field so users can paste unformatted text more easily.

I posted the AutoHotKey script that I use as my current workaround, and was asked to provide a bit more detail about how I use AutoHotKey with Sparx EA.

AutoHotKey

Originally created by Chris Mallett, and now managed by the AutoHotKey Foundation, the program AutoHotKey can be used to to create keyboard shortcuts (Sparx EA also calls them Keyboard Accelerators)

Installation is fairly simple, download the installer or portable version, and run.   AutoHotKey will automatically create a file called AutoHotKey.ahk in your My Documents folder.

This .ahk file contains the scripts that AutoHotKey triggers when the defined key combinations are pressed.

The Script

The following script does 2 things when the 3 keys CTRL + SHIFT + V are pressed at the same time:

  1. It detects that the currently selected Application is Sparx Enterprise Architect
  2. If it is, the content of the clipboard is converted to unformatted text and pasted to the current cursor location.

Simply copy and paste the code below to your AutoHotKey file found in your My Documents, or download my example copy to use.

^+v::
  WinGetActiveTitle title
  if(instr(title,"Enterprise Architect"))
  {
    Clipboard=%Clipboard%
    Clipwait
    Send ^v
  }
exit
  • The symbols ^+v on line 1 tell AutoHotKey to run the script when the 3 keys CTRL + SHIFT + V are pressed at the same time.
  • Lines 2 and 3, tell AutoHotKey to get the title of the currently selected Window, and see if the title contains the text “Enterprise Architect”
  • If it does, on line 5, AutoHotKey converts the contents of the clipboard to unformatted text, waits for the process to finish, and then on line 7 pastes the unformatted text to the current cursor location.

For more information on what AutoHotKey can do, take a look at their online documentation.

I’ve created a more complex script to support extracting statements out of imported documents that I’ll post in my next blog entry.

Leave a Reply

Your email address will not be published. Required fields are marked *