Automation: Open Terminal on "click on object"

Hi all,

This is about OmniGraffle, Version 7.4 running on macOS 10.12.5

I am trying to open up an SSH shell to objects when people click on them. I have attached an action “execute applescript” on the object. I have the following script included:
> set adress to “”
> display dialog “User name?” default answer “”
> set username to text returned of result
> set ssh_command to "ssh " & username & “@” & adress
> tell application “Terminal”
> activate
> do script with command ssh_command
> end tell

When I run this command from an applescript editor window, it runs just fine. When I run it within OmniGraffle, it prompts for the user name all right, then nothing happens for a few seconds and I get an error message: “Terminal received an error: program not running.”

Can someone point me to my mistake?

Bonus question 1: I have a custom key “IP” set to the ip of the object, how can I read out that value and set the address to that instead of hard coding it into the script?

Bonus question 2: How can I do this so it still works on PDF export? I tried open URL instead, but I cannot have user names added that way.

Thank you for your support!