Importing Telephone Numbers from Excel into Applescript

The following is the code that I am using to send automated calls scheduled in iCal and using Skype.

Now the problem. If I wish to populate a large calling list, how would I import telephone numbers from the first cell in Excel to the “INSERT_TELEPHONE_NUMBER_HERE” slot? The problem is twofold. First, I need it to duplicate the code found above for each entry appearing in the Excel spreadsheet from the first cell, and secondly, I need the telephone number from that cell to replace the listed variable. Is this possible?

All help is greatly appreciated. Thank you!

Model: MacBook Pro
AppleScript: V 2.1.1 (81), AS 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

smells like a spam dialer :frowning: , but I hope its not =)

So the problem at hand is easy to accomodate, but the question is… Are all the numbers in the first cell itself? And thus need to be seperated? Or are all the numbers in their own cells in the say the first column?

Firstly, to respond to your concern regarding spam, it is for a non profit religious organization to alert congregants of classes, changes in schedules and to update them on events. It is a valid concern, but I assure you that I hate spam as much as the next fellow, and would not stoop to such levels. All members who will receive calls signed up on our signup sheet.

Regarding the cells, Microsoft ™ Excel for Mac has a top arrangement of A, B, C, D, etc. and the cells going down are numbered 1, 2, 3, etc. My list has the numbers input in A1, through A32. I hope this answers your question, because beyond that, I know absolutely nothing of any microsoft program.

Thanks for the quick reply!

well alrighty then, I’m about to hop into work and have a meeting first thing, but as soon as I’m done I’ll have an answer posted for you unless one of the other regulars beat me to it :smiley:

I don’t know anything about Skype, but this will extract the phone numbers from the A column of the currently open Excel document:


set phone_Nums to {}
tell application "Microsoft Excel"
	repeat with r_row from 1 to 32 --These are the rows you want
		copy value of cell 1 of row r_row of active sheet to the end of phone_Nums
	end repeat
end tell

You should now have a list of all the telephone numbers, and can do another repeat for the Skype:

repeat with a_Number in phone_Nums
	tell application "Skype"
	
	send command "CALL +" & a_Number script name "phoneOut"
	
	Etc.
end repeat

Good luck,

Please understand that I am pretty new to this, so I will give you what I have, and hopefully you can give me an idea on what I need to change. I compiled the following from your script.

This is the script unaltered, that you gave me for pulling the numbers. I named it “number_puller”

set phone_Nums to {}
tell application "Microsoft Excel"
	repeat with r_row from 1 to 32
		copy value of cell 1 of row r_row of active sheet to the end of phone_Nums
	end repeat
end tell

This is the main calling application: (Works great when I manually insert the numbers, but I am lazy and the list is growing.)

on run argv
	repeat with a_Number in phone_Nums
		tell application "iTunes"
			activate
			stop
		end tell
		tell application "Skype"
			send command "CALL +" & a_Number script name "phoneOut"
			set calls to send command "SEARCH ACTIVECALLS" script name "phoneOut"
			set callID to last word of calls
			repeat
				set status to send command "GET CALL " & callID & " STATUS" script name "phoneOut"
				if last word of status is not "ROUTING" then exit repeat
			end repeat
			repeat
				set status to send command "GET CALL " & callID & " STATUS" script name "phoneOut"
				if last word of status is "INPROGRESS" then exit repeat
			end repeat
		end tell
		tell application "iTunes"
			activate
			tell source "Library"
				tell playlist "communityevents"
					set toPlay to track "announcement"
					play toPlay
				end tell
			end tell
			set trackTime to duration of toPlay
			delay trackTime
			stop
		end tell
		tell application "Skype"
			send command "SET CALL " & callID & " STATUS FINISHED" script name "phoneOut"
		end tell
	end repeat
end run

The question is, where do I insert the script reference for the initial script which pulls the numbers? And, did I do everything else right?

Thanks so much, and sorry to be a pain! :slight_smile: