Go Back   The macosxhints Forums > OS X Help Requests > Applications



Reply
 
Thread Tools Rating: Thread Rating: 43 votes, 4.98 average. Display Modes
Old 10-22-2004, 07:39 PM   #1
ad_persson
Prospect
 
Join Date: Oct 2004
Posts: 2
Skype Out plugin for Address Book

Hi Everyone,

I wrote a very simple Address Book plugin which allows you to call people using Skype Out (assuming you have the service). This is something I found to be convenient, so maybe some of you will as well.

using terms from application "Address Book"
on action property
return "phone"
end action property

on action title for p with e
return "Call using Skype Out"
end action title

on should enable action for p with e
return true
end should enable action

on perform action for p with e
set phone_num to the value of e
skype_out(phone_num)
end perform action

end using terms from

on skype_out(phone_num)
tell application "Skype"
set call_string to "callto:" & phone_num
get URL call_string
end tell
end skype_out
ad_persson is offline   Reply With Quote
Old 10-23-2004, 11:09 AM   #2
Pieman
Triple-A Player
 
Join Date: Nov 2003
Posts: 154
Sorry to be a dimwit but how do you convert the above code into an address book plugin?

Do you paste the code into textedit as plain text. What extension do you append to the file?

I assume its put in the users/me/Library/application support/address book plug ins

regards

pieman
Pieman is offline   Reply With Quote
Old 10-24-2004, 08:45 PM   #3
ad_persson
Prospect
 
Join Date: Oct 2004
Posts: 2
To install

Just copy the text and save the file as Skype.scpt, the copy the file into ~/Library/Address Book Plug-Ins.

Next time you start up Address Book you should see the option to use Skype out when you Ctrl-click on a phone entry.
ad_persson is offline   Reply With Quote
Old 11-29-2004, 01:39 AM   #4
dysong3
Prospect
 
Join Date: Nov 2004
Posts: 1
Thanks for that applescript. However I was wanting to make one that take a phone number from a Filemaker file and then makes Skype dial it. As, although I have spend many hours persevering, I have never been able to get very far scritping appplescript, you may be able to tell how to tweak your script to make it work with Filemaker.
dysong3 is offline   Reply With Quote
Old 12-04-2004, 12:49 PM   #5
Mr_Ed
Prospect
 
Join Date: Dec 2004
Posts: 2
Thanks for this script! It works as expected but I ran into a slight problem which mostly was due to the fact that most entries in my AddressBook are in the U.S, and I have not provided a country code and/or leading "+" for them. I also synchronize my AddressBook numbers with my Bluetooth cell phone, and for use there, most of my numbers do not require a leading "1" or "+". It's not a problem with the script, but Skype does not like numbers that do not conform to their expected pattern (start with "+" and/or "1" followed by country /area code and number)

My dilemma was that if I alter the numbers to fit Skype's dialing scheme (which would be very time consuming in the first place), I thought I might have problems dialing those numbers from my cell phone (or some other means in the future). I decided to alter the script you provided here to prepend a "+1" to those numbers that are less than 10 digits long, then send it to Skype for dialing. I've tested it with several of my numbers and works as I expect. I also tested with an international number in my address book (+[country code][number]) and it sends it through to Skype untouched.

Disclaimer: I altered this script to fit my specific situation where numbers in my address book are typically just U.S. numbers [ (xxx) xxx-xxxx ] so this script will not work everywhere. However, the modification was simple and it should be easy for anyone to alter it to fit their specific needs.

I'm an AppleScript noob so I swiped a string replace function from an Apple web site for use in this script New script follows. Enjoy!

Code:
using terms from application "Address Book"
	on action property
		return "phone"
	end action property
	
	on action title for p with e
		return "Call using Skype Out"
	end action title
	
	on should enable action for p with e
		return true
	end should enable action
	
	on perform action for p with e
		set phone_num to the value of e
		
		-- Clean up the number from any extraneous characters
		-- like blanks, '(', ')', '-' .
		set phone_num to replace_chars(phone_num, "-", "")
		set phone_num to replace_chars(phone_num, "(", "")
		set phone_num to replace_chars(phone_num, ")", "")
		set phone_num to replace_chars(phone_num, " ", "")
		
		-- See if number already starts with '+'
		if phone_num does not start with "+" then
			-- If not, make sure it is at least 10 digits long
			if length of phone_num < 11 then
				-- If not, prepend "+1" to the number
				set phone_num to "+1" & phone_num
			end if
		end if
		skype_out(phone_num)
	end perform action
	
end using terms from

on skype_out(phone_num)
	tell application "Skype"
		set call_string to "callto:" & phone_num
		get URL call_string
	end tell
end skype_out

-- Text replace function
on replace_chars(this_text, search_string, replacement_string)
	set AppleScript's text item delimiters to the search_string
	set the item_list to every text item of this_text
	set AppleScript's text item delimiters to the replacement_string
	set this_text to the item_list as string
	set AppleScript's text item delimiters to ""
	return this_text
end replace_chars
Mr_Ed is offline   Reply With Quote
Old 02-15-2005, 01:32 AM   #6
hembeck
Triple-A Player
 
Join Date: Jan 2002
Location: NJ
Posts: 172
Quote:
Originally Posted by ad_persson
Just copy the text and save the file as Skype.scpt, the copy the file into ~/Library/Address Book Plug-Ins.

Next time you start up Address Book you should see the option to use Skype out when you Ctrl-click on a phone entry.

Is this directory path for 10.3.x? No such directory exists under 10.2.X.

Thanks,
Fernando
__________________
Health, Wealth & Happiness
hembeck is offline   Reply With Quote
Old 02-15-2005, 09:52 AM   #7
ShavenYak
Major Leaguer
 
Join Date: Dec 2004
Posts: 274
Mr. Ed: who is your cellular service provider? With T-Mobile USA, I have several numbers in my address book which have a 1 on the front - in fact, the caller ID info coming from the phone has a 1 on front - and I have no problem dialing them. My phone (Nokia 6600) seems to ignore non-numeric characters in phone numbers - in fact, you can't enter them in the phone, they only show up if synced from an outside source - so I'm sure the + won't cause a problem.

hembeck: No problem, just create the directory yourself. If you don't have any add-on addressbook scripts yet, it's normally not there.

Now, what would be really cool is to store folks' Skype names in the addressbook and modify the script to make a Skype-to-Skype call for Skype users or a Skype-out call to the poor saps stuck on the 19th century phone system!
ShavenYak is offline   Reply With Quote
Old 02-15-2005, 11:58 AM   #8
CAlvarez
Hall of Famer
 
Join Date: Sep 2004
Location: Phoenix, AZ
Posts: 4,975
+1 is a completely valid string to send to a cell phone. In many countries, +country code is required for cell dialing. We're just spoiled in the US, being the center of the universe and all, and can ignore this, but I've never seen a phone that will reject a number that does include it.
__________________
--
Carlos Alvarez, Phoenix, AZ

"MacBook Nano" (Lenovo S10) Atom 1.6/2GB/160GB Mac OS X 10.5.6
Gigabyte Quad Core 2.83GHz Hackintosh 4GB/500GB Mac OS X 10.6
MacBook Air 1.8/2GB/64GB SSD

http://www.televolve.com
CAlvarez is offline   Reply With Quote
Old 12-21-2005, 05:20 PM   #9
mark hunte
MVP
 
Join Date: Apr 2004
Location: Hello London Calling
Posts: 1,787
Altered script

Hi All,

I have started to use Skype, but found the plug-in that it installs for the Addressbook.app Was no good.
As it did not fix numbers that start with 0
which skype did not like as well as numbers that started with a leading number like 1 or 2

I found this thread which helped, but realised it needed to be updated for use in the UK. ( most numbers are more than 10 digits , including the leading 0)

99% of my land line numbers in AB start with a leading 0
and the rest with a +
25% of my Mobile numbers in AB start with a leading 0
and the rest with a 0

So I fixed the script to deal with all of these.

If any number has a leading 0 then it will be dialled with a +44
If it has the +44 then it will be dialled with a +44

To get the script running follow the instructions in the thread above.
Also you can change the 44 to your own code.

So now the extra bit.

I wanted to be able to also Call the contacts Computer using their
skype Name (ie, Petersmac)

The script now takes care of that.

To get this function.
go to AB and Edit a card. or template
Select to add a new phone number, but instead of calling it work or home. Go down the list to custom. Now enter as a New label, the case sensitive name;

Skype

Enter the contacts Skype name where the number would normally go. And save.

next time you need to add a skype name the label should be there.



Hi All,
I have started to use Skype, but found the plug-in that it installs for the Addressbook.app
Was no good. As it did not fix numbers that start with 0
which skype did not like as well as numbers that started with a leading number like 1 or 2

I found this thread http://forums.macosxhints.com/showthread.php?t=29709 which helped, but realised it
needed to be updated for use in the UK. ( most numbers are more than 10 digits , including the leading 0)

99% of my land line numbers in AB start with a leading 0 and the rest with a +

25% of my Mobile numbers in AB start with a leading 0 and the rest with a 0

So I fixed the script to deal with all of these.

If any number has a leading 0 then it will be dialled with a +44
If it has the +44 then it will be dialled with a +44

To get the script running follow the instructions in the thread.
Also you can change the 44 to your own code.

So now the extra bit.

I wanted to be able to also Call the contacts Computer using their skype Name (ie, Petersmac)

The script now takes care of that.

To get this function.
go to AB and Edit a card. or template
Select to add a new phone number, but instead of calling it work or home.
Go down the list to custom. Now enter as a New label, the case sensitive name;

Skype

Enter the contacts Skype name where the number would normally go. And save.

next time you need to add a skype name the label should be there.

Now all you have to do is click the contact number/skype name label, and go to the skype dialler.







Code:
using terms from application "Address Book"
	on action property
		return "phone"
	end action property
	
	on action title for p with e
		
		if label of e is equal to "Skype" then
			return "Call Skype Name"
		else
			return "Dial using Skype"
		end if
	end action title
	
	on should enable action for p with e
		return true
	end should enable action
	
	on perform action for p with e
		set _alphabet to {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "¬
		q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "¬
		K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "+"}
		set phone_num to the value of e
		
		set phoneC to character 1 of phone_num as string
		
		if phoneC is not in _alphabet then
			
			set phone_num to "+44" & characters 2 thru -1 of phone_num --addplus(phone_num, _alphabet)
			
		else
			
		end if
		
		
		-- Clean up the number from any extraneous characters
		-- like blanks, '(', ')', '-' .
		set phone_num to replace_chars(phone_num, "-", "")
		set phone_num to replace_chars(phone_num, "(", "")
		set phone_num to replace_chars(phone_num, ")", "")
		set phone_num to replace_chars(phone_num, " ", "")
		skype_out(phone_num)
		
	end perform action
	
	on addplus(phone_num, _alphabet)
		--if phone_num does not start with "+" then
		set phone_num to "+44" & characters 2 thru -1 of phone_num
		
		--end if
	end addplus
	
end using terms from

on skype_out(phone_num)
	tell application "Skype"
		activate
		set call_string to "callto:" & phone_num
		get URL call_string
	end tell
end skype_out

-- Text replace function
on replace_chars(this_text, search_string, replacement_string)
	set AppleScript's text item delimiters to the search_string
	set the item_list to every text item of this_text
	set AppleScript's text item delimiters to the replacement_string
	set this_text to the item_list as string
	set AppleScript's text item delimiters to ""
	return this_text
end replace_chars

Last edited by mark hunte; 12-21-2005 at 05:37 PM.
mark hunte is offline   Reply With Quote
Old 03-09-2010, 08:44 PM   #10
princessfiona
Prospect
 
Join Date: Mar 2010
Location: Canberra, Australia
Posts: 2
Hi there

I have used this script with success - so thank you.

I would now like to remove this feature as I don't use Skype often enough to warrant Skype opening every time I open my Address Book. I have tried to find where the script is to delete it without success.

This is all I see when I go into ~/Library/Address Book Plug-Ins all I can see is:

SkypeABSMS.bundle
SkypeABDialer.bundle

Can somebody please give me so tips on how to achieve my objectives?

Many thanks

Princess Fiona
princessfiona is offline   Reply With Quote
Old 03-11-2010, 01:10 AM   #11
princessfiona
Prospect
 
Join Date: Mar 2010
Location: Canberra, Australia
Posts: 2
No sooner did I put up the last post than I discovered where I was going wrong. I was looking in:

Macintosh HD:\Library\Address Book Plug-Ins

Instead of:

[myname]:\Library\Address Book Plug-Ins

Maybe my post won't be a waste as others might make the same mistake.

PF
princessfiona is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 07:47 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.