feel_x
Aktives Mitglied
Thread Starter
- Dabei seit
- 31.07.2003
- Beiträge
- 706
- Reaktionspunkte
- 10
Hallau,
Ich hab hier ein kleines Script gefunden, das im Library-Ordner Adress book plugins hinterlegt wird und das vom Adressbuch aus zum Wählen von Telefonnummern via X-Lite benutzt wird.
Funktioniert prima; ich habe nur das Problem, dass ich bei vielen Telefonnummern ein +49 davor stehen habe.
Mir fehlt also einfach eine Bereinigungs-Routine, die das "+49" gegen eine "0" austauscht.. eine Routine, die alle überflüssigen Zeichen entfernt und nur die Zahlen da lässt, ist ja schon drin, die neue Funktion sollte natürlich davor ablaufen, damit das +49 noch als solches erkannt und ersetzt wird.
wer kann mir helfen?
Hier das Script:
-----------------
(*
* *XLite dialer
* *The script should be placed in ~/Library/Address Book Plug-Ins (to only use it on your user account) or in
* */Library/Address Book Plug-ins (to offer it to all users on the machine).
* *
* *Right click, or Ctrl click, on a number in Address Book and the menu item
* *"Dial with XLite" will appear.
* ** *
* *The name of the XLite application might need to be changed in the script.
* *
* *The number is dialed with the default SIP server in Xlite after being cleaned of any other characters
* *than numbers.
*)
using terms from application "Address Book"
on action property
return "phone"
end action property
on action title for pers with fone
return "Dial with XLite"
end action title
on should enable action for pers with fone
if label of fone contains "fax" then return false
return true
end should enable action
on perform action for pers with fone
set theNumber to (value of fone) as string
--Erase everything that's not a digit from the phone number
set cleanedNumber to CleanTheNumber(theNumber)
--Change to the appropriate application name below
tell application "X-Lite"
dial cleanedNumber
end tell
end perform action
end using terms from
on CleanTheNumber(numToDial) -- remove punctuation from a string, leaving just the number
set theDigits to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
set cleanedNumber to ""
repeat with i from 1 to length of numToDial
set j to (character i of numToDial)
if j is in theDigits then set cleanedNumber to cleanedNumber & j
end repeat
return cleanedNumber
end CleanTheNumber
----------------
Ich hab hier ein kleines Script gefunden, das im Library-Ordner Adress book plugins hinterlegt wird und das vom Adressbuch aus zum Wählen von Telefonnummern via X-Lite benutzt wird.
Funktioniert prima; ich habe nur das Problem, dass ich bei vielen Telefonnummern ein +49 davor stehen habe.
Mir fehlt also einfach eine Bereinigungs-Routine, die das "+49" gegen eine "0" austauscht.. eine Routine, die alle überflüssigen Zeichen entfernt und nur die Zahlen da lässt, ist ja schon drin, die neue Funktion sollte natürlich davor ablaufen, damit das +49 noch als solches erkannt und ersetzt wird.
wer kann mir helfen?
Hier das Script:
-----------------
(*
* *XLite dialer
* *The script should be placed in ~/Library/Address Book Plug-Ins (to only use it on your user account) or in
* */Library/Address Book Plug-ins (to offer it to all users on the machine).
* *
* *Right click, or Ctrl click, on a number in Address Book and the menu item
* *"Dial with XLite" will appear.
* ** *
* *The name of the XLite application might need to be changed in the script.
* *
* *The number is dialed with the default SIP server in Xlite after being cleaned of any other characters
* *than numbers.
*)
using terms from application "Address Book"
on action property
return "phone"
end action property
on action title for pers with fone
return "Dial with XLite"
end action title
on should enable action for pers with fone
if label of fone contains "fax" then return false
return true
end should enable action
on perform action for pers with fone
set theNumber to (value of fone) as string
--Erase everything that's not a digit from the phone number
set cleanedNumber to CleanTheNumber(theNumber)
--Change to the appropriate application name below
tell application "X-Lite"
dial cleanedNumber
end tell
end perform action
end using terms from
on CleanTheNumber(numToDial) -- remove punctuation from a string, leaving just the number
set theDigits to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
set cleanedNumber to ""
repeat with i from 1 to length of numToDial
set j to (character i of numToDial)
if j is in theDigits then set cleanedNumber to cleanedNumber & j
end repeat
return cleanedNumber
end CleanTheNumber
----------------