Trigger a Skype call

473 views
Skip to first unread message

klaus

unread,
Aug 9, 2013, 4:55:46 AM8/9/13
to comman...@googlegroups.com

I need a button that initiates a Skype call on a separate Mac or PC to a specific address. Is it possible?
Using JavaScript?
Can anybody give me an example as I am not familiar with JavaScript so far? Thanks!

Klaus

Steve

unread,
Aug 9, 2013, 9:19:55 AM8/9/13
to comman...@googlegroups.com
I don't see why not.

From the CF side it would just be a web call to the PC/Mac. You would need something to listen for the call on the Mac/PC eg. Apache. You can install MAMP for Mac or WAMP for the PC (You could just as easily start those services on the Mac but I find MAMP is much easier to work with).

The hard part is getting Skype to start up and call the address. You may like to check into Skype URIs for a way to do this cross platform. Alternatively, on the Mac, you could use PHP to call an OSAScript that would talk (via AppleScript) to the OS to start the Skype application. What I don't know is whether the Skype app is Apple Scriptable to make a call. You would have to download the Skype app and use Script Editor to see what functions are available.

HTH

Steve

Jarrod Bell

unread,
Aug 9, 2013, 9:21:39 AM8/9/13
to comman...@googlegroups.com
Guessing you will need some software running on your mac or PC to listen to network commands and then tell skype to make a call.
The Skype API might allow for something like this - I have worked with it before years ago for control from a Crestron processor (tight integration with contact lists, making calls, receiving call events, etc) so I'm sure it's possible with the right programming on the PC side.

Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commandfusio...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jarrod Bell

unread,
Aug 9, 2013, 9:27:43 AM8/9/13
to comman...@googlegroups.com
But seems Skype has discontinued the desktop API in favor for VERY limited URI integration, but it allows for making calls at least.

So you would need some app on the PC to listen to commands from iViewer, then send them to skype. Something like EventGhost on PC would do the trick.


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


On 9/08/13 6:55 PM, klaus wrote:

klaus

unread,
Aug 9, 2013, 12:23:29 PM8/9/13
to comman...@googlegroups.com
Still don't know which command (or script) I should use (to trigger e.g. EventGost).

But as the possibilities to control Skype seems to be restricted, a new idea came up to my mind:
Using CF to trigger a key (let's say F2) on the keyboard of the PC/Mac could save the problem, as it is then very easy to write a Keystroke-Macro (e.g. with QuicKeys) using the Shortcuts of Skype.

But how can I trigger a key on the keyboard?

Klaus

Jarrod Bell

unread,
Aug 9, 2013, 7:28:17 PM8/9/13
to comman...@googlegroups.com
Google is your friend. Check the event ghost forums, etc...


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


Steve

unread,
Aug 12, 2013, 11:15:39 AM8/12/13
to comman...@googlegroups.com, jar...@commandfusion.com
I just remembered a post a while back by Klaus from Home in Touch. Their product (HitServer) may just be exactly what you need. In the situation where Klaus posted it was for starting up XBMC but could easily be changed to Skype:

======================================================
You could use the HitServer.
The version that can be downloaded from our Website can be registered with serial 123456789

Create a system in Guidesigner that connects to the HitServer via UDP port 49000.
Create a macro in the guidesigner
hitshell_start xbmc
delay
hitshell_execute xbmc open -a XBMC.app

You could do the same on the HitServer side and send from iViewer
hitserver_startmacro xbmcstart

The names are just example.
Doc can be found here.

Regards
Klaus
=======================================================

Clayton Vicente

unread,
Aug 13, 2013, 10:18:55 AM8/13/13
to comman...@googlegroups.com
Hi Klaus
I know how is hard to play with this things sometimes.
I am sending to you my full .xml to control the Eventghost.
You will not only be able to see how to simulate the key press with EG, but there are a lot of others things there. 
- Get feedback from EG.
- Create little python scripts.
- Send commands to Global Cache units (ir and rs232)
- Control the mouse.
- Create tasks and alarms.
- Integrate the EG with the VoxCommando.
- Close or open a program.
- Open a specif site.
- Send Growl notifications.
go on....
This is my personal EventGhost setup.
To show you how to control the EG using CF i make a little example .gui.
To start to use this you need to unzip the file. Then install the EventGhost and open the file HomeCinema.xml.
Open the .gui example in the guiDesigner (you have to unzip the file). Set the ip of your pc tha are running the EG in the system EVENTGHOST.
That´s it.
Start to play with the commands.
To close a program with EG normally i use a little .bat. In the zip file you can see a .bat named killexplorer.bat, its just a example. To use the .bat you have to change the path in the EG, look for" Start Program: killExplorer" change for your path.
Good luck.
Hope that help
Clayton



Date: Fri, 9 Aug 2013 09:23:29 -0700
From: cz...@panascan.de
To: comman...@googlegroups.com
Subject: Re: Trigger a Skype call

Jarrod Bell

unread,
Aug 13, 2013, 9:32:40 PM8/13/13
to comman...@googlegroups.com
Thanks for sharing Clayton!


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


klaus

unread,
Aug 14, 2013, 7:50:08 AM8/14/13
to comman...@googlegroups.com
Hi Clayton, Steve and Jarrod

This all is really unbelievable!!!
I thank you so much for your big help - I never would have expected to get so much help here!
EventGhost is great!
HitServer is great!

My best regards
Klaus (from Munich/Germany)

Steve

unread,
Aug 14, 2013, 3:53:33 PM8/14/13
to comman...@googlegroups.com
You are very welcome Klaus

It appears I am the Apple evangelist around here where most of the other people like WinTel.

I am an Apple guy through and through (Except for the Win 7 PC they make me use at work). I did work for Apple from 1980 through 2000.

klaus

unread,
Sep 20, 2013, 1:45:42 PM9/20/13
to comman...@googlegroups.com
Now I have realized a project using Skype on a Mac:

I followed the hint of Steve and used MAMP and PHP that calls an Osascript that starts an AppleScript that sometimes starts a Service (from Automator).

Sounds complicated and it is much more complicated than using EventGhost on a PC, but I could arrange everything with zero knowledge of this all within 2 weeks!
As the Skype API is very limited I used Automator to create some Services with shortcuts and call these Services from AppleScript.

So far so good, at the end I could make it work!

But now I realized that I ran unto a trap:
If the client plays around with the buttons and fires several scripts at the same time, the scripts will fight against each other - which ends in a spinning wheel and no further command will be accepted (not even "Quit Skype" or "Restart").

Does anybody know if I can stop a running script (by an Osascript?) before performing the next script?
And is there a possibility to send a command that can force the Mac to restart?

This gives me a headache!

Klaus



Steve

unread,
Sep 20, 2013, 4:49:48 PM9/20/13
to comman...@googlegroups.com
Instead of using an osascript to send a command to an application that is hung you would probably be better off killing the process from the command line.

This is untested but here goes:
set myProcess to "Skype"  
tell
application "System Events"  
   
set theID to (unix id of processes whose name is myProcess)  
   
try  
       
-- Should stop the application with no dialogs and no items saved.  
       
do shell script "kill -9 " & theID  
   
end try  
end tell

Just make sure that that is the process name (Try running Terminal and typing top)

That should force quit Skype (Or any other application you want). It will re open the next time an AppleScript targets it.

To restart a Mac you could try:
sudo osascript -e 'tell application "Finder" to restart'

or
do shell script "sudo shutdown -r now"

klaus

unread,
Sep 22, 2013, 10:17:26 AM9/22/13
to comman...@googlegroups.com
Thank you Steve!

Your method to kill the ID works fine as long as Skype is working well.
When Skype is hung it does not work.
So I tried the hard method:

To force-quit Skype:
killall Skype
or in PHP: exec("killall Skype");

To stop an AppleScript or AppleScript Application:
killall applet

To stop a Service (Automator):
killall 'Automator Runner'
But this ends in a message: "The operation couldn't be completed (com.apple.Automator error 0.) Show Workflow / OK" -with no default button.
Now I would be interested to know how I could avoid this message.

To restart the Mac I tried:
sudo shutdown -r now
But there is a request of a password of an admin, who must be logged in first (!) to proceed - not practical.

The last issue is to force-quit Skype at 9 p.m. before the Mac does a shutdown. How could I do that?
(Reason: Often Skype denies to quit when the Mac tries to shutdown; with the result that on the next morning you have this message on the screen...)

Klaus

Steve

unread,
Sep 23, 2013, 9:59:39 AM9/23/13
to comman...@googlegroups.com
For timed events use cron - http://benr75.com/pages/using_crontab_mac_os_x_unix_linux . Remember that, at its core, Mac OS is Unix. There are literally thousands of *nix utilities that work on Mac OS.

For the admin password requirement for the shutdown you can try:
do shell script 'shutdown -h now' password 'insert admin password here' with administrator privileges

To stop an Automator work flow this thread may help - http://lists.apple.com/archives/Automator-dev/2005/May/msg00034.html

Otherwise you can use blocks like:
ignoring application responses
 
-- Do Stuff
end ignoring

Steve

unread,
Sep 23, 2013, 12:50:06 PM9/23/13
to comman...@googlegroups.com
Found another way to do the restart. Here is a bash script:

#!/bin/bash
# OK, just shutdown all ... applications after 2 minutes
sudo reboot
-h +2 &
# Try normal shutdown in the meantime
osascript
-e 'tell application "System Events" to shut down'

You need to edit the /etc/sudoers (and /private/etc/sudoers) file(s) and add the line: ALL=NOPASSWD: /sbin/shutdown

You could use this as the script to run using the crontab mentioned in the previous post.

As an aside, the #! is pronounced "shebang". Just in case anybody mentions it to you, you know what it is. It is to signify the utility you want this script to run. In this case it is bash.

klaus

unread,
Oct 1, 2013, 4:08:21 PM10/1/13
to comman...@googlegroups.com
I found an easy way to stop an Automator Workflow or Automator Service:
killall 'WorkflowServiceRunner'

With the "shebang" I am still struggling.
I have edited the /etc/sudoers file with the line: 
%users ALL=NOPASSWD: /sbin/shutdown -h now

But if I use the Terminal to shutdown -h now, it still asks me for a password of a super-user.
And to be honest, I do not know where to write the #!/bin/bash. Is it just a text file? And how do I activate the script?

Klaus

Steve

unread,
Oct 2, 2013, 1:19:50 PM10/2/13
to comman...@googlegroups.com
Yes, it is just a text file. You would just copy/paste the bash script I mentioned into a text file. You don't want it to have a file extension though. The easiest way would be to copy the lines above for the bash script and then open Terminal and type the following commands:
cd /usr/local
vi myshutdown
(I don't recall if vi starts off in editing mode but you may need to type an i first to get into insert mode. So, just type the i now and if you see an i appear just use the <delete> key to remove it. You should see the word INSERT appear on the screen)
<Command>V (to paste into vi)
<esc>
:w
:q

Line by line:
Change Directory (cd) into /usr/local
Open Unix application vi and create a file in the current directory with the name myshutdown
(i if not in insert mode)
paste the clipboard (The five lines you copied earlier)
Escape out of editing mode
Write the file contents to disk (:w)
Quit out of vi (:q)

To activate it you would either put it into the crontab file mentioned earlier (The whole path - /usr/local/myshutdown) or use PHP to invoke it with a system or exec call

You modified both sudoers files so you would need to type sudo shutdown -h now to have that take effect. You would also probably need to restart for the modified sudoers file to take effect.
Also, the line is wrong (%users ALL=NOPASSWD: /sbin/shutdown -h now). It should be %users ALL=NOPASSWD: /sbin/shutdown .

And, you need to make sure the user you are using is in the users group (That is what you are saying by using %users). To check just type groups at the command prompt. This will show the groups the current user is in. For PHP to run this command you need to check which user it is run as. Most likely it will be apache or www. Either add the user to the users group or add another line to the sudoers file for that group. To find out what user/group PHP is running under create a file named phpinfo.php and

Here are a couple of links that will help you:
Sample sudoers file - http://www.gratisoft.us/sudo/sample.sudoers
groups command - http://www.howtogeek.com/howto/ubuntu/see-which-groups-your-linux-user-belongs-to/

I hope this helps. I may not have explained things well.
Reply all
Reply to author
Forward
0 new messages