hello I asked help for this http://bbs.applescript.net/viewtopic.php?pid=58434#p58434
using terms from application "Address Book"
on action property
return "phone"
end action property
on action title for p with e
return "Dial with eyeBeam"
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 newPhone to characters of (value of e as string)
repeat with i in newPhone
if contents of i = "+" then set contents of i to "00"
end repeat
repeat with i in newPhone
if contents of i = " " then set contents of i to ""
end repeat
repeat with i in newPhone
if contents of i = "-" then set contents of i to ""
end repeat
repeat with i in newPhone
if contents of i = "(" then set contents of i to ""
end repeat
repeat with i in newPhone
if contents of i = ")" then set contents of i to ""
end repeat
repeat with i in newPhone
if contents of i = "." then set contents of i to ""
end repeat
tell application "X-Lite"
activate
dial (newPhone as string)
end tell
return true
end perform action
end using terms from
so I thought to do this :
using terms from application "Address Book"
on action property
return "phone"
end action property
on action title for p with e
return "Cerca con Pagine Bianche"
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 newPhone to characters of (value of e as string)
repeat with i in newPhone
if contents of i = "+" then set contents of i to ""
end repeat
repeat with i in newPhone
if contents of i = " " then set contents of i to ""
end repeat
repeat with i in newPhone
if contents of i = "-" then set contents of i to ""
end repeat
repeat with i in newPhone
if contents of i = "(" then set contents of i to ""
end repeat
repeat with i in newPhone
if contents of i = ")" then set contents of i to ""
end repeat
repeat with i in newPhone
if contents of i = "." then set contents of i to ""
end repeat
repeat with i in newPhone
if contents of i = "" then set contents of i to "http://www.paginebianche.it/execute.cgi?btt=1&tl=2&tr=106&cb=&qs="
end repeat
tell application "Safari"
activate
open location (newPhone as string)
end tell
return true
end perform action
end using terms from
That should add phone nunber to “http://www.paginebianche.it/execute.cgi?btt=1&tl=2&tr=106&cb=&qs=” + (newPhone as string) - +39 …
but it’s all wrong
I thought that if contents of i = “” then the contest should be “http://www.paginebianche.it/execute.cgi?btt=1&tl=2&tr=106&cb=&qs=” so newPhone should be now "http://www.paginebianche.it/execute.cgi?btt=1&tl=2&tr=106&cb=&qs=(newPhone as string)
but the final resul change all the time depending on numbers .
if number is : +39 066789376 it’s ok
if number is : +39066789376 it’s bad
But the script say : if contents of i = " " then set contents of i to “”
so why in number “+39 066789376” +39 get removed
and in number “+39066789376” only plus get removed ?
I can’t understand it .
Pls Help
Thanks