dicas

Como lidar com o DDD da Operadoras?

Migrei da Vivo pra TIM e estou experimentando problemas com o código DDD, existe alguma aplicação pra gerências isso no iPhone?

Cada operadora tem o seu jeito de lidar com a forma de fazer ligações interubanas. O Vivo permite o (021) XXXX-XXXX. A Tim não. Tem que ser o 0 41 21 XXXX-XXXX.

Pra resolver isso tem o Minha Operadora. Mas eu uso esse Script pra rodar no AppleScript do OS X meia boca. Mas use esse Script apenas como guia. E saiba como funciona esse papo de Script.

tell application "Address Book"
set phoneList to {}
repeat with i from 1 to (count every person)
set phoneProperties to properties of phones of person i
repeat with j from 1 to (count of phoneProperties)
set phone_number to the value of item j of phoneProperties
#if phone_number begins with "015" then
# if (length of phone_number) is equal to 13 then
#set new_phone_number to "(0" & (text 4 thru 5 of phone_number) & ") " & (text 6 thru 9 of phone_number) & "-" & (text 10 thru 13 of phone_number)
if phone_number begins with "(021) " then
if (length of phone_number) is equal to (length of "(021) 1234-5678") then
set new_phone_number to "015" & (text 3 thru 4 of phone_number) & (text 7 thru 10 of phone_number) & (text 12 thru 15 of phone_number)
set phoneList to phoneList & new_phone_number
#set value of item j of phones of person i to new_phone_number
end if
end if
end repeat
end repeat
save
end tell

#tell application "Address Book"
# set phoneList to {}
# set peopleCount to (count every person)
# repeat with i from 1 to peopleCount
# set phoneList to phoneList & (get value of every phone of person i)
# end repeat
#end tell

set outputFileName to choose file name with prompt "Save phone list:" default name "addressbook-phonelist.txt"
set outputFile to open for access outputFileName with write permission
repeat with p in phoneList
write p & (ASCII character 10) to outputFile
end repeat
close access outputFile

Importante: Sempre faça backup antes desse tipo de brincadeira.

Gustavo Faria

de um tempo em que a UFRJ formava não cientistas da computação, mas bacharéis em informática e acompanhe as Dicas do Coca.
Botão Voltar ao topo