Title: Re: Dial phone script
on 10/20/2000 11:29 AM, Neil at [EMAIL PROTECTED] wrote:

> on 10/20/00 1:22 PM, Neil at [EMAIL PROTECTED] wrote:
>
>> When I try to run the script I get the following error message:
>>
>>> Can't get text 2 thru -1 of H
>>
>> Does that mean anything to anybody here?
>
> After some experimentation, I've found that I only get that error when the
> contact only has one phone number.  If I add another phone number, the
> script works.

So happens I have only tried the script with contacts having 2 or more numbers; no problem so far. That error message is coming from trying to lop off the first character of a text field, and I guess the field must be empty. Not sure why having just one number would cause that.
>
> By the way, I don't see any way to get Acid Jazz to dial local area codes
> and still add the "1" prefix for long distance.  Here in Miami we have to
> dial the area code for local calls.  Allen, don't you have the same issue in
> Oregon?
>
Yes, I do. I just was messing for over an hour with the script to make it work. Our area codes here are 503 and 971 (covering identical local areas), and we must dial the area code for local calls, but without the 1. It's a limitation in Acid Jazz, all right. I worked around it by making the script turn the "1" prefix on and off, and faking it out by changing what it thinks is the local area code to "555". So it sees a 503 number as a long distance call, but since there is no LD prefix, it just dials the ten digits. You would have to edit and substitute your two area codes.

This version of the script still does not handle the situation completely. If I try to dial a 971 number with the script it should work. But other software that recognizes only a single local area code is going to break on 971 numbers if I have 503 specified as local; it will think 971 is long distance. There is a lot of software that is going to have to change.

My revision of David's script looks like this:

--- Dial Phone Number (503 and 971 local calls) ---
set phoneList to {}
set errString to "This script only works with one contact selected in a list
view.
"

tell application "Microsoft Entourage"
    
try
       set s to the selection
       set t to item 1 of s
       if the class of t is contact then set theContact to t
   on error theErr
       display dialog theErr & return & return & errString with icon 1 buttons {"OK"} default button "OK"
        
return
   end try
   
    
try
       set homeNumber to home phone number of theContact
       set workNumber to business phone number of theContact
       set otherHomeNumber to other home phone number of theContact
       set otherWorkNumber to other business phone number of theContact
       set mobileNumber to mobile phone number of theContact
       set mainNumber to main phone number of theContact
       set assistantNumber to assistant phone number of theContact
       set pagerNumber to pager phone number of theContact
       set homeFaxNumber to home fax phone number of theContact
       set workFaxNumber to business fax phone number of theContact
       set custom1 to custom phone number one of theContact
       set custom2 to custom phone number two of theContact
       set custom3 to custom phone number three of theContact
       set custom4 to custom phone number four of theContact
       
        
if homeNumber � "" then set phoneList to phoneList & ("Home: " & homeNumber)
        
if workNumber � "" then set phoneList to phoneList & ("Work: " & workNumber)
        
if otherHomeNumber � "" then set phoneList to phoneList & ("Home 2:
" & otherHomeNumber)
        
if otherWorkNumber � "" then set phoneList to phoneList & ("Work 2:
" & otherWorkNumber)
        
if mobileNumber � "" then set phoneList to phoneList & ("Mobile: " & mobileNumber)
        
if mainNumber � "" then set phoneList to phoneList & ("Main: " & mainNumber)
        
if assistantNumber � "" then set phoneList to phoneList & ("Assistant: " & assistantNumber)
        
if pagerNumber � "" then set phoneList to phoneList & ("Pager: " & pagerNumber)
        
if homeFaxNumber � "" then set phoneList to phoneList & ("Home Fax: " & homeFaxNumber)
        
if workFaxNumber � "" then set phoneList to phoneList & ("Work Fax: " & workFaxNumber)
        
if custom1 � "" then set phoneList to phoneList & ("Custom 1: " & custom1)
        
if custom2 � "" then set phoneList to phoneList & ("Custom 2: " & custom2)
        
if custom3 � "" then set phoneList to phoneList & ("Custom 3: " & custom3)
        
if custom4 � "" then set phoneList to phoneList & ("Custom 4: " & workFaxNumber)
        
        
set theName to name of theContact
       if theName = "" then set theName to company of theContact
   on error theErr
       display dialog theErr & return & return & errString with icon 1 buttons {"OK"} default button "OK"
        
return
   end try
end
tell

if (count of phoneList) = 1 then
   set theResult to item 1 of phoneList
   
    
else
   
    
    
try
       set theResult to choose from list phoneList with prompt "Choose a
phone number to dial for
" & theName & ¬
            "
:" default items {(item 1 of phoneList)} without multiple selections allowed and empty selection allowed
   on error
       display dialog "This script requires a scripting addition that is not
installed on your computer.
" & ¬
            "
You must have OS 8.5 or greater in order to use this script." with icon 1 buttons {"OK"} default button "OK"
    
end try
end
if

if theResult = {} then return
set
t to item 1 of theResult
set
i to offset of ": " in t
set
theNumber to text (i + 2) thru -1 of t
(*
Portland requires dialing area code without a 1 prefix for
local calls.
*)
if (theNumber begins with "503") then
    
set ldPrefix to "" --
No long distance prefix
   set myArea to "555" -- Force dialing local area code
else if theNumber begins with "971" then
   set ldPrefix to "" -- No long distance prefix
   set myArea to "971" -- Force dialing local area code
else
   set ldPrefix to "1" -- Normal long distance prefix if not 503 or 971
   set myArea to "503"
end if
display dialog "Click OK, then pick up phone as soon as you hear dialing."
tell application "Acid Jazz"
    
Do Script "long " & ldPrefix
   Do Script "local " & myArea
   Do Script "port modem"
    
Dial Phone theNumber
end
tell
--- End Script ---


> Also, it doesn't pause for the comma.  I use them for pager phone numbers.
> I add the pause and my phone number.  Am I missing something?  Thanks in
> advance,
>
> Neil
>

--
Peace,
Allen Watson <[EMAIL PROTECTED]> XNS name: =Allen Watson
A Mac family since 1984
My web page: <http://home.earthlink.net/~allenwatson/>

Reply via email to