· software-development skype

Automating Skype's 'This message has been removed'

One of the stranger features of Skype is that that it allows you to delete the contents of a message that you've already sent to someone - something I haven't seen on any other messaging system I've used.

For example if I wrote a message in Skype and wanted to edit it I would press the 'up' arrow:

2014 02 20 23 02 28

Once I've deleted the message I'd see this in the space where the message used to be:

2014 02 20 23 00 41

I almost certainly am too obsessed with this but I find it quite amusing when I see people posting and retracting messages so I wanted to see if it could be automated.

Alistair showed me Automator, a built in tool on the Mac for automating work flows.

Automator allows you to execute Applescript so we wrote the following code which selects the current chat in Skype, writes a message and then deletes it one character at a time:


on run {input, parameters}
	tell application "Skype"
		activate
	end tell
	
	tell application "System Events"
		set message to "now you see me, now you don't"
		keystroke message
		keystroke return
		keystroke (ASCII character 30) --up arrow
		repeat length of message times
			keystroke (ASCII character 8) --backspace
		end repeat
		keystroke return
	end tell
	return input
end run

We wired up the Applescript via the Utilities > Run Applescript menu option in Automator:

2014 02 20 23 12 38

We can then go further and wire that up to a keyboard shortcut if we want by saving the workflow as a service in Automator but for my messing around purposes clicking the 'Run' button from Automator didn't seem too much of a hardship!

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket