Sunday, 25 March 2012

Start a Skype chat from a shortcut

Ever wanted to open a Skype conversation from the command line?
Once you've established the contact, you can reference it as follows:
For example, if you have me automation_man as one of your Skype contacts, you can open a chat session to me from the command line using this syntax
"c:\Program Files\Skype\Phone\Skype.exe /uri:skype:Automation_Man?chat"
Obviously you may need to alter the path to the executable to suit your installation.

Why might you want to do this?
Well in my case, I get my system to send me a Skype message every time it starts, goes into or comes out of standby, or one of it's backup routines finishes
Note that I have found it works more reliably running it from explorer using a utility such as "Runfromprocess.exe"
Copyright: Nir Sofer (
e.g. the full command lin in my cmd file looks like this:

c:\RunfromProcess.exe explorer.exe "c:\Program Files\Skype\Phone\Skype.exe /uri:skype:Automation_Man?chat"

Using another Nir Sofer command NirCmd, I also send the text to the chat session
NirCmd Sendkey S press
NirCmd Sendkey t press
NirCmd Sendkey a press
NirCmd Sendkey r press
NirCmd Sendkey t press
NirCmd Sendkey P press
NirCmd Sendkey C press
NirCmd Sendkey 1 press
nircmd wait 5000

Then Send the message (ctrl-enter)

NirCmd sendkey ctrl down
NirCmd Sendkey enter press
NirCmd sendkey ctrl up
nircmd wait 12000

Rem Close chat dialog (alt-S-L)

NirCmd sendkey alt down
nircmd wait 500
nircmd sendkey s press
nircmd wait 500
nircmd sendkey l press
nircmd wait 500
NirCmd sendkey alt up
nircmd wait 1000

Rem Add entry to the Application event log
eventcreate /l APPLICATION /so "*** NirCmdStart ***" /t INFORMATION /id 997 /d "System Resume Notification - command triggered from scheduled AM/PM events to wake computer"
nircmd wait 500

And audibly announce the system is online

rem 0 = unmute
NirCmd mutesysvolume 0

rem 0 (silence) ~ 65535 (full volume). (32767=half, 16383=quarter)
NirCmd setsysvolume 28000

Rem  Rate of speech between -10 (very slow) and 10 (very fast). volume of the Speech between 0 and 100
NirCmd speak text "P C 01 online now" 1 80

And finally reset the system volume to something respectable
NirCmd setsysvolume 10000

No comments: