|
|
Anyone Get This To Work? Yes, kinda.
Super...got it now :-)
Anyone Get This To Work? Yes, kinda.
Hi sorry that I've seen the posts just wright now, I'm no AppleScript Guru.
Anyone Get This To Work? Yes, kinda.
I think it's great. I tried to make a similar script a month or two ago and failed miserably. I plan to look through some AppleScript tutorials and see if I can make it work with apartment numbers in the address (by stripping them from the query).
Updated Script
I updated the script to strip apartment numbers from the address field. This only works if you list apartment and suite numbers as 123 street #7 and not 123 street apartment 7.
I also changed it to format the query as street, city, state, zip instead of street zip city. Route 66 seems to work fine with either formatting, it was just a personal preference.
property _version : "ROUTE 66 Route 2004"
property _subversion : "ROUTE 66 Route 2004"
using terms from application "Address Book"
on action property
return "address"
end action property
on action title for _person with _address
return "Find Address in Route66"
end action title
on should enable action for _person with _address
return true
end should enable action
on perform action for _person with _address
set theresult to my getaddress_of_selection() as list
if item 1 of theresult is {} and item 2 of theresult is {} and item 3 of theresult is {} and item 4 of theresult is {} then
display dialog "\"No Address entry found\"" buttons {"OK"} default button 1 with icon 2
else
set addr to item 1 of theresult & ", " & item 2 of theresult & ", " & item 3 of theresult & ", " & item 4 of theresult as string
try
tell application _version to activate
end try
tell application "System Events"
repeat 20 times
if application process _subversion exists then
exit repeat
end if
end repeat
end tell
try
tell application _subversion to activate
tell application "System Events"
tell application process _subversion
set value of combo box 1 of tab group 1 of splitter group 1 of splitter group 2 of window 1 to addr
delay 0.5
click button 2 of tab group 1 of splitter group 1 of splitter group 2 of window 1
end tell
end tell
on error
display dialog "ERROR - GUI scripting enabled?" with icon 2
end try
end if
end perform action
end using terms from
on getaddress_of_selection()
tell application "Address Book"
set sellist to selection
set oneentry to item 1 of sellist
set oneentry to id of oneentry
set str to street of address of person id oneentry as string
set thezip to zip of address of person id oneentry
set cit to city of address of person id oneentry
set sta to state of address of person id oneentry
end tell
if str is {missing value} then
set str to "" as string
else
repeat with Num from 1 to length of str by 1
if get character Num of str is equal to "#" then
set str to (get text 1 through (Num - 2) of str)
display dialog "Apartment Number was stripped" with icon 2
exit repeat
end if
end repeat
end if
if thezip is {missing value} then set thezip to "" as string
if cit is {missing value} then set cit to "" as string
if sta is {missing value} then set sta to "" as string
return {str, cit, sta, thezip}
end getaddress_of_selection
Updated Script -- handler attempt for street number
i 'm trying to improve this super script a bit by trying to get the street number and name with this language
but i'm burned out and cannot get it to work
(it should grab whatever comes before the first comma, which should be the street number and the street name before the apartment number or suite number)
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.08 seconds |
|