Hi,
Okay, I’m a total noob so apologies to begin with (I’m sure I’m not aware of a ton of protocol so forgive me).
Here’s what I’m trying to do. I’d love to be able to tag multiple contacts in address book with Quicksilver.
I’ve been tagging itunes with a great script from Chris Brown and Jesse Newland called tagselected. Then I discovered a post here by Scott Paulus that tagged contacts in Address Book.
In typical noob fashion I attempted to make a franken-script out of the two of them & what do you know - it didn’t work!?! Of course, right? So I’m asking for any help.
What I’d love to do is:
Select multiple contacts in Address book.
In Quicksilver input text to become the tag(s)
Use an Applescript action to add the tag(s) to the end of the note field (ideally with a carriage return before them)
Here’s my feeble Franken-Script
using terms from application "Quicksilver"
on process text theString
tell application "Address Book"
set thePeople to selection
set tagString to my theString
repeat with aPerson in thePeople
set currentNote to the note of aPerson
if currentNote is missing value then set currentNote to ""
set newNote to currentNote & tagString
set note of aPerson to newNote
end repeat
end tell
end process text
end using terms from
Here’s the original TagSelected iTunes script that was one half of the monster:
(*
"tuneTag tag script"
written by Chris Brown:
chrisbro@gmail.com
http://christopholis.com
and Jesse Newland:
jnewland@gmail.com
http://jnewland.com
v1.2, may 2006
TuneTag
By Chris Brown “ chrisbro@gmail.com
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. More information can be found at http://creativecommons.org/licenses/by-nc-sa/2.5/ .
*)
global iTunes_is_running
using terms from application "Quicksilver"
on process text theString
tell application "System Events"
set running_apps to (get name of processes)
end tell
if running_apps contains "iTunes" then
set iTunes_is_running to true
end if
if iTunes_is_running then
tell application "iTunes"
if theString is "" then
activate
display dialog "No text entered. Please enter one or more tags and try again." buttons {"OK"} default button 1
else
set sel to selection
set selected to ""
if sel is not {} then
repeat with theNewT in sel
set tagList to my split(theString, " ")
repeat with singleTag in tagList --> add each tag from quicksilver
set cur_comment to theNewT's comment
set currentTagList to my split(cur_comment, " ")
set singleTag to singleTag as text
set checkTag to "*" & singleTag
set checkTag to checkTag as text
ignoring case
if currentTagList does not contain checkTag then
if cur_comment is not equal to "" then
set theNewT's comment to cur_comment & " *" & singleTag
else
set theNewT's comment to cur_comment & "*" & singleTag
end if
end if
end ignoring
end repeat
end repeat
else
activate
display dialog "No songs are currently selected. No tags saved." buttons {"OK"} default button 1
end if
end if
end tell
else
activate
display dialog "iTunes is not running. Please start iTunes and try again." buttons {"OK"} default button 1
end if
end process text
end using terms from
on split(someText, delimiter)
set AppleScript's text item delimiters to delimiter
set someText to someText's text items
set AppleScript's text item delimiters to {""}
return someText
end split
And here’s the tag Address book script I grabbed from this forum:
tell application "Address Book"
set thePeople to selection
display dialog "What tag would you like to append?" buttons {"Cancel", "Apply"} default button "Apply" default answer "[tag]"
set dialogInfo to result
set selectedButton to button returned of dialogInfo
set tagString to text returned of dialogInfo
if selectedButton is "Apply" then
repeat with aPerson in thePeople
set currentNote to the note of aPerson
if currentNote is missing value then set currentNote to ""
set newNote to currentNote & tagString
set note of aPerson to newNote
end repeat
end if
end tell
Perfect world - I love the way the itunes script checks for each tag and splits them up.
Thanks in advance for any help!!!
Anthony