12,297
edits
Line 35: | Line 35: | ||
end tell | end tell | ||
end if | end if | ||
set | set theNumber to value of e | ||
set amtsholung to true | set amtsholung to true | ||
set | set theNumber to theNumber's words as string | ||
set lengthOfNumber to length of | set lengthOfNumber to length of theNumber | ||
-- the following lines replace the international prefix for germany (+49, or 0049) with 0 | -- the following lines replace the international prefix for germany (+49, or 0049) with 0 | ||
if | if theNumber begins with "+49" then | ||
set | set theNumber to "0" & characters -1 thru -(lengthOfNumber - 3) of theNumber | ||
else if | else if theNumber begins with "0049" then | ||
set | set theNumber to "0" & characters -1 thru -(lengthOfNumber - 4) of theNumber | ||
-- or any other international prefix | -- or any other international prefix | ||
else if | else if theNumber begins with "+" then | ||
set | set theNumber to "00" & characters -1 thru -(lengthOfNumber - 1) of theNumber | ||
else | else | ||
set | set theNumber to theNumber | ||
end if | end if | ||
set lengthOfNumber to length of theNumber | |||
ignoring white space, punctuation, diacriticals and case | ignoring white space, punctuation, diacriticals and case | ||
if character -6 of | -- in case it's a local number ommit the prefix for weimar | ||
if theNumber begins with "03643" then | |||
set theNumber to characters -1 thru -(lengthOfNumber - 5) of theNumber as text | |||
if character -6 of theNumber is "5" then | |||
if character -5 of theNumber is "8" then | |||
set theNumber to characters -1 thru -4 of theNumber as text | |||
set amtsholung to false | |||
end if | |||
end if | end if | ||
end if | end if | ||
Line 64: | Line 68: | ||
if amtsholung is true then | if amtsholung is true then | ||
-- the following line adds a 0 to get the outside line = “Amtsholung” | -- the following line adds a 0 to get the outside line = “Amtsholung” | ||
set | set theNumber to "0" & theNumber as text | ||
end if | end if | ||
tell application "Safari" | tell application "Safari" | ||
Line 76: | Line 80: | ||
end repeat | end repeat | ||
do JavaScript "document.forms['loginForm'].elements['destination'].value ='" & | do JavaScript "document.forms['loginForm'].elements['destination'].value ='" & theNumber & "'" in document 1 | ||
do JavaScript "document.forms['loginForm'].elements['dial'].click()" in document 1 | do JavaScript "document.forms['loginForm'].elements['dial'].click()" in document 1 | ||