One of the big problems I have with Skype is its lack of a scheduling feature. I have a Skype dual phone which will ring when someone calls me on Skype, but I donât want the phone ringing in the middle of the night because someone from another time zone sees my status as âOnlineâ decides to call. I use Skype frequently for work with virtual teams, so I canât just turn it off because I donât want to forget to turn it back on. My status should show as âAwayâ when I havenât used my PC for a while, but this isnât always consistent and it doesnât cater for insomnia-induced tinkering on the pc.
Ideally, Skype would have a feature to set âOpening Hoursâ on your accountâI only want to show up as available between 8am and 8pm. I bought the Pamela extra which does some scheduling, but you can set only one event per dayâie. I can set it to go offline at 8pm, but not to turn back on at 8am.
Since Skype offers a client API component, it is possible to create a scheduler to set your online status at different times using Windows Scheduler and a scripting tool. I wrote this before in VBScript, but this being the dawn of Windows 7 with pre-installed PowerShell, I rewrote it as a PowerShell script.
If you are on XP or Vista and havenât installed PowerShell, you will need to do this before you can run these scripts. Installation instructions for PowerShell are here. You will also need to set the execution policy. You can find instructions for this here. I am running XP.
I hope this helps . . .
Step 1: Install the Skype4Com component
Skype still uses a COM component called Skype4Com which needs to be downloaded and registered on your local PC. The component can be found at https://developer.skype.com/Download. Iâm using version 1.0.32, but you can probably use a later version.
Download the component, extract it to a directory (ie. “c:skype”) and type the following into the Run window:
regsvr32Â c:skypeSkype4COM-1.0.32Skype4COM.dll
Make sure the directory point to the actual dll file to you downloaded. You should get a response that it was registered successfully:
Step 2: Write the PowerShell script
Now, write the PowerShell script to use the component. Iâve created two scriptsâone sets my status to âOnlineâ, the other sets it to âOfflineâ. You can probably create a single script with a parameter passed in if you wish (but I couldnât be bothered to figure out how to do this).
In the script, you have to create the Skype object, identify the current user, and change the status.
In my first script, I use the following code:
1: #Create Skype Object
2: $skype = New-Object -COM "Skype4COM.Skype"
3:
4: #Get the logged in user
5: $currentUser = $skype.CurrentUserProfile
6:
7: #Get the Status vars
8: $onlineStatus = $skype.Convert.TextToUserStatus("ONLINE")
9:
10: #Now Change your status
11: $skype.ChangeUserStatus($onlineStatus)
The main Skype call here is the âChangeUserStatusâ method. I named the first script âSetSkypeStatus_on.ps1â.
The second script is almost identical, but it sets the status to âOfflineâ:
1: #Create Skype Object
2: $skype = New-Object -COM "Skype4COM.Skype"
3:
4: #Get the logged in user
5: $currentUser = $skype.CurrentUserProfile
6:
7: #Get the Status vars
8: $offlineStatus = $skype.Convert.TextToUserStatus("OFFLINE")
9:
10: #Now Change your status
11: $skype.ChangeUserStatus($offlineStatus)
I named the second script âSetSkypeStatus_off.ps1â.
There are several other parameters you can pass into the âChangeUserStatusâ method. Here are the values I know about:
Status | Code Sample |
OFFLINE | $skype.Convert.TextToUserStatus(“OFFLINE”) |
ONLINE | $skype.Convert.TextToUserStatus(“ONLINE”) |
RINGING | $skype.Convert.TextToUserStatus(“RINGING”) |
INPROGRESS | $skype.Convert.TextToUserStatus(“INPROGRESS”) |
BUSY | $skype.Convert.TextToUserStatus(“BUSY”) |
Of course, you can automate most actions on the Skype client using the component (not just setting your online status). You can schedule calls, send text messages, etc. But Iâm only concerned with my online status.
Step 3: Set up Windows Scheduled Tasks
Now you have two scripts to go Offline and Online. You just need to have something trigger them. I use Windows Scheduled Tasks. In Control Panel, go to the Scheduled Tasks window. Youâll see a list of scheduled tasks for your pc. Right client and select âAddââ>âScheduled Taskâ (Donât go through the âAdd Scheduled Taskâ wizard). Name your task âSkypeStatusOnâ. Right-click the task and choose âPropertiesâ.
Now, in the âRun:â box, type the following command:
powershell -command “& ‘c:tempSetSkypeStatus_on.ps1’ “
Make sure the path is pointed to you PowerShell script youâve created.
You can now use the âScheduleâ tab to schedule when you want the script to run. Click âOKâ.
Now do the same for the other script. You can test these scripts by right-clicking the task and selecting âRunâ. You should be able to watch your Skype status go from offline to online.
By the way, the first time you run this, Skype will ask if you want PowerShell to have access to Skype. Click âAllowâ.
If everything works successfully, your pc should set your online status and give you the âOpening Hoursâ that Skype forgot.
I hope you find this useful.