ITunes Apple Script question
Any thoughts why the following script generates will only force a refresh of the smart playlist "Random Country" if Live Updating is turned off. This script works for the other two playlists shown which have Live Updating turned on.
on run
tell application "iTunes"
--delete every track of playlist "Random Christian"
--delete every track of playlist "Mainstream"
delete every track of playlist "Random Country"
end tell
end run
I get the following error why I run the script with Live Updating activated.
error "iTunes got an error: every track of playlist \"Random Country\" doesn’t understand the delete message." number -1708 from every track of playlist "Random Country"
I am currently running iTunes 11.0.2 on OSX 10.8.2
Thanks Winston Churchill. I was missing purchased content (cloud stuff) on my ATV2. The problem was with iTunes and many others were having similar problems. I asked them to fix iTunes so it worked, but they insisted on giving me outdated instructions that had no relevance to me. It is very frustrating dealing with them. I intentionally shortened my question when I asked it here just to find out what the directions they gave meant and you have answered that. Thanks again. This is the thread about missing shows:
https://discussions.apple.com/message/16486299#16486299
Similar Messages
-
display dialog "Username" default answer ""
set the target_username to the text returned of the result
display dialog "Password" default answer "" with hidden answer
set the pass to the text returned of the result
when i use this i get two differnt windows one asking for the username and then one for the password after the username has been entered
is there a way to make them appear on the same window??While some who peruse these particular forums have applescript knowledge, most really do not. I'm not ashamed to admit I am relatively new to applescript and can only do basics
Perhaps asking [here|http://discussions.apple.com/forum.jspa?forumID=724] would be more beneficial as those forums are specific to your issue... -
Apple Script "Folder Contents to UPPER or lowercase"
So I use the apple script "Change Case of Item Names" from the "Script Menu" all the time when I need to convert a handful of files because of my OCD organization techniques. One thing that frustrates me is that it will not change ALL files within a folder, within a folder and so on. Say I have a folder with 25 folders, and within each of those folders there are 200 files. I'd like to set the script on that very fist folder to change ALL the contents within it to either UPPER or lower case. Can anyone help me out by giving me a script or navigate me to a script that I've overlooked?
Thanks,
-Zachin the future please post apple script questions in the Apple script forum under mac os x technologies.
the following modification of the built in script should do what you want
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px; height: 335px;
color: #000000;
background-color: #ADD8E6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
try
tell application "Finder" to set the source_folder to (folder of the front window) as alias
on error -- no open folder windows
set the source_folder to path to desktop folder as alias
end try
display dialog "Change case to:" buttons {"Cancel", "UPPER", "lower"}
set the button_pressed to the button returned of the result
tell application "Finder"
repeat with this_item in entire contents of source_folder
set the current_name to the name of this_item as text
if the button_pressed is "lower" then
set the name of this_item to my change_case_of(the current_name, "lower")
else
set the name of this_item to my change_case_of(the current_name, "upper")
end if
end repeat
end tell
beep 2
on change_case_of(this_text, this_case)
if this_case is "lower" then
set the comparison_string to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set the source_string to "abcdefghijklmnopqrstuvwxyz"
else
set the comparison_string to "abcdefghijklmnopqrstuvwxyz"
set the source_string to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
end if
set the new_text to ""
repeat with thisChar in this_text
set x to the offset of thisChar in the comparison_string
if x is not 0 then
set the new_text to (the new_text & character x of the source_string) as string
else
set the new_text to (the new_text & thisChar) as string
end if
end repeat
return the new_text
end change_case_of</pre>
paste it into script Editor and save it in /Library/scripts/Finder Scripts. call it something like "recursive change of names". -
Open & close iTunes every night via Apple Script
What I would like to do is have my Mac come out of sleep at 3am, open iTunes and download all my podcasts and then go back to sleep. Is this possible with Apple Script?
In System Preferences>Energy Saver click on 'Schedule' and set 'Start Up or Wake' to 3 AM
In iCal set up an event for 3.05, setting an alarm to Open File and selecting iTunes.
Suppose you want to allow half an hour:
In AppleScript Editor, write
tell application iTunes to quit
tell application "Finder" to sleep
and save it somewhere as a script, not an application.
Set up an event in iCal for 3.35 with an alarm, setting it to Run Script and selecting your script. -
how do i reset my apple security questions when i cant find there is no reset button on my screen and i tried itunes and iclould
See Kappy's previous discussion.
HT5312 How to recover security...: Apple Support Communities -
ITunes, Apple TV, a NAS drive and Time Capsule - an idiot's guide
Hi,
I really need some help, and even though I know the information is already on the web, I just need someone to tell me what to do in my circumstance.
I have a new Macbook with 250GB hard drive which is now almost full! I have an Apple TV box which is also almost full. I have a 320GB Iomega NAS which is not almost full as I haven't really used it properly and I have just got a 1TB Time Capsule as I'm petrified of losing everything!
I have just over 175GB of music and films/tv programmes. I have also just finished making sure all the album artwork is correct (I know - very sad!).
Currently the entire library is on my Macbook. I backed it up to the NAS drive (although I did it via a USB connection rather than over my home network).
With only about 23GB of space left on my Macbook I decided the time was right to use the NAS properly. (I only really want to use the Time Capsule as a back up, although I guess there is probably a problem there as well if I move everything of importance (i.e. the music and films) to the NAS but lets leave that one for the time being.
Basically what I want to know is how to use itunes with the NAS so that the music and films etc are stored on the NAS but not the rest of the information (the itunes database and album art folders).
I tried it before and it kind of worked but the first time it update the library file and having just sorted out all the album artwork I don't want to have to do it again.
I should say that I am the only one in the house who uses itunes, my laptop, am the only one with an ipod and iphone, so there is no issue with someone sharing the library or anything like that.
So, question 1 - how do I set up itunes to work with the NAS.
Question 2 - in doing so, will I have to correct all the artwork again?
Question 3 - if all the music etc is on the NAS, how do I back it up to the Time Capsule?
A more complicated question is can I keep the music on my laptop and films/tv programmes on the NAS?
Will all of this make the Apple TV box stop working?
Finally, I have already found an apple script which automounts the NAS and then starts itunes as I have read that that can cause a problem.
Thanks for any/all your help.
AnthonyThere isn't a solution, the Apple TV will only read your iTunes library if iTunes is running and will only play content through iTunes.
-
Writing apple script to perform actions on specific network shares/servers
Hi Everyone,
I'm new to posting to this forum, but had a few simple questions about writing Apple Script. I've created a few network shares on our home network, and wrote an apple script to automatically mount the shares upon login. However, there's 2 things I'm missing:
1. how to add a password feild to the script, along with the username.
2. how to make the resulting application from the script (or the script itself) ignore the errors that result when i am not at home, and the server is not available (basically I'm saying I don't want to see those errors pop up)
3. I also don't want to see the error from the network agent, about the server being unavailable.
Any help with this would be greatly appreciated. Here is my script so far:
tell application "Finder"
mount volume "smb://mediaserver/automatically add to iTunes/" as user name "Rocco Fiorentino"
mount volume "smb://mediaserver/shared media" as user name "Rocco Fiorentino"
end tell
Thank you in advance for any assistance. Have a great day!John Holley NZ wrote:
More importantly I have found that the names in the list don't match the descriptions!
Let's take one update for example, 061-3405 Pro Application Update 2007-01.
Although this completely defies logical explanation, If you resist sorting the list by anything (i.e. the default random order), the descriptions will in fact be correct. This is something I see from time to time with new Excel users when they try to sort related columns for the first time and forget to select all of the relevant data, but I am totally perplexed as to why this is happening here. It seems as though the descriptions are not actually part of the file, and as such, cannot be sorted (or don't follow around the original file).
For example, on my server, QuickTime Broadcaster 1.5 is followed by Logic Express 7.2.1. If I sort by name, the list starts with an Airport updater, but the first 2 descriptions remain the SAME (QT and Logic)! As I previously stated: this defies all logic and reason.
For me, this seems to be a cosmetic problem; the software update server is successfully serving updates to clients. It is, however, annoying.
Something seems seriously screwed here! I will keep digging but this does not fill me with confidence.
John -
Locked out of iMatch: iMatch/HomeSharing/Apple ID Questions
I purchased an iTunes Match subscription in November (with my Apple ID). We recently gave our son an iPod and set him up on a separate Apple ID. He has a separate log-in on our computer and I used Home Sharing to transfer some songs over to his log-in. We also transferred over some of his purchased via Home Sharing so that I could save them on our external HD. Somehow I have lost the ability to use iTunes Match. It kicked me off and I can't sign back it. I get a message that the "computer is already associated with an Apple ID and I can't associate this computer for 82 days." I did not try to set up iTunes match on my sons account. I only use it for our Apple TV and my iPad. I don't understand how this got messed up. I am not happy waiting for 82 days for it to reset itself as I paid for this service.
Is there anyway I can reset it?
Is there a way to know what I did to cause this issue?
Am I not allowed to have another Apple ID (my son) on the same computer? (but a different log-in).
Am I not suppose to type in his Apple ID on my log-in in order to transfer his purchased on to our HD?
RESPONSE FROM APPLE:
Greetings from Apple iTunes Store Customer Support! My name is Sabrish and I will assist you today.
I understand you have not been able to use iTunes Match as you receive a message "The computer is already associated with an Apple ID and you can't associate this computer for 82 days". I certainly understand your concern.
Once a device or computer is associated with your Apple ID, you cannot associate that device or computer with another Apple ID for 90 days. I'm sorry, but you will need to wait until
you have reached that time period so you can associate a different Apple ID.
For more information, please refer the below article:
iTunes Store: Associating a device for computer to an Apple ID for Automatic Downloads
http://support.apple.com/kb/HT4627
I hope the above information is helpful. Thank you for your interest in the iTunes Store. Have a nice day!
MY RESPONSE SECONDARY TO UNANSWERED QUESTIONS (WITHOUT REPLY)
Thanks for the response. I still don't quite understand what I did wrong. I went to an Apple Store today to discuss this issue and all the techs there were perplexed that I couldn't have more than one Apple ID on my computer. They said that I should be able to have have multiple log-ins on the computer with each log-in having their own iTunes/Apple Id Account. My wife and I have Apple TV, the computer, an iPad and 2 iPods on our log-in. We have 3 boys and would like them to have their own iTunes account so they can make individual purchases.
So… are you saying this is not possible without messing up my iMatch account? I did not try to associate iMatch with their device (only my wife's and my devices).
What do I need to do in the future to keep this from happening again. I am very upset that I purchased a year long agreement for iMatch and have already been locked out for 90 days for not doing anything that I shouldn't be able to do. I don't want this to happen again, when the timer resets.
Can you please provide me with a solution to having multiple family members who have Apple ID's when I only have one computer. Do I need to delete their Apple ID account? (seems ridiculous), or did I put this in motion by doing something like hooking up Family Share to their iTunes.
I fully understand restricting one device to one Apple ID account… but not the computer.
Any help would be greatly appreciated.I'm not sure you can. This explains the "90-day switch rule": iTunes Store: Associating a device or computer to your Apple ID - Apple Support. You can try contacting iTunes store support to see if they can do anything for you: https://www.apple.com/emea/support/itunes/contact.html.
-
I just purchased iPhone 4s. Before setting it up want to ask this question,
Right now I have iPhone 4 with iOS5 installed. When inistially setting up iOS5 on the iPhone4 I had to create a me.com address. This address is being used for iCloud. My normal itunes apple id is being used for only itunes purchases.
Was wondering if I should just change my setup so that it uses the itunes account for the icloud too. This way I would only have the one id. Setting up this one account scenario would then make sure that I would be taking advantage of all the features of the iCloud, right? When using two accounts(one for itunes and another for the iCloud) it causes not all features to be used.
If I do chnage to use one account, I would have to update my Mac OS X to use the onbe account as well, right? And I would aslo have to do the same on my iPad too, right.
What would you recommend in this scenario. When setting up new iPhone 4s should I use one account for Apple ID or should I leave it the way it is and set up new iPhone 4s to use two accounts(one for iCloud and one for iTunes)?
Thanks and I look forward to your reply.
...BruceCheck out this thread:
http://discussions.apple.com/thread.jspa?messageID=2465681�
Joe -
I've been trying to change my icloud apple ID to match my itunes apple ID so i can manage my storage. I haven't turned on the cloud since i got the phone. I've forgotten my password for the icloud apple ID and i do not have access to the OLD OLD OLD email address its trying to send my password to. Can someone please tell me how i can make this change without knowing my old password??? Can't manage storage or buy more without knowing the old apple id for icloud.
Hello, nikkihutchins10.
Thank you for visiting Apple Support Communities.
I understand that you are attempting to reset your Apple ID password. I would try resetting your password via answering the security questions instead of sending the email. The first article will walk you through that process. If you are still unable to reset your Apple ID password, see the steps in the second article.
If you forgot your Apple ID password
Contact Apple for help with Apple ID account security
Cheers,
Jason H. -
I have some problem when I want to download app in iTunes some security question ask me about my visa when I right my visa number I got an errors and on top of the page told me go to iTunes support I do these things and now what should I do
Most of the people on these forums, including myself, are fellow users - you're not talking to iTunes Support here.
You can contact iTunes Support via this link : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption -
Automator or Apple Script To Move Multiple Files to Multiple Folders
I was just wondering, is there any sort of automator workflow or maybe apple script that will allow me to automate the following:
I have a folder named SCANS containing multiple different files that need to go to multiple different folders.
So Say I have:
SCANS
and in this folder I have ten files named A,B,C,D,E,F,G,H,I,J and I want each of these files to be moved to different folders eg.
A I want to go to folder 1
B I want to go to folder 2
C I want to go to folder 3 etc etc.
Anyone know if there is a way of doing this please?
I have tried a workflow where I find finder items in the Scans folder and move to another but that only seems to work for one file. When I add more it does not seem to work.
Any help/guidance would be appreciated.
Thank you!Hi Niel,
Not quite what I wanted because I missed some information from my question....
What I actually want is to search for files containing certain text in the name and if positive to then move that file to the specified folders.
Cheers. -
Apple Script to Sort through the Address Book
Dear All,
I am quite new to Apple and just a learner on Apple-scripts. Its been quite a task to learn.. I would require some help on a few things..
The script will eventually use numbers to send email and get the user inputs and any yet to reach there..
After going through lots of scripts to sort through the address book and make a clean address book, i found they are quite slow in processing takes about 20~30 Minutes to get through 2000 Contacts..
Hence after reading posting of Mr. Koenig & Mr. Hiroto and specifically on deep copy. I have written the following code which does the following on 2000 records within 6~8Mins.
The Script work its way through all the contact is the address List.. and creates Groups
1. Duplicate Email Id's — List of Contacts with same email ID's including Contacts where the email Id is entered twice.. (Strange.. Address Book Issue, copy of the email Id under work & home)
2. Duplicate Phone — List of Contacts with same Phone Numbers including Contacts where the Phone Nos is entered twice.
3. Duplicate Name — List of Contacts with Same Names
4. Duplicate No Name — List of Contacts without the First Name and Last Name
it also sort the Contacts under the following Group which you can edit later with all the information's..
1. Only Email Ids — List of Contacts with Email ID and No Phone Numbers
2. Only Phone — List of Contacts with Phone Numbers and No Email Id's
3. No Email or Phone — List of Contacts with No Email Id's and No Phone numbers (some half completed contacts )
My Question to the forum is why is the following code still taking too much time..
set onlyDupEList to every person of group theGroupEmail
repeat with j from 1 to count of Dup_email
set tempdata to item j of Dup_email
if onlyDupEList does not contain {tempdata} then add tempdata to group theGroupEmail
end repeat
save application "Address Book"
and the scripts slows down when the items in the list is quite large (over 800 or so )..
Any help is appreciated and thanks in advance..
-- the code ---
global MsgTitle
on run
set MsgTitle to "Search for Duplicates in Address Book Contacts"
display dialog ¬
"This Script takes a while to finish" & return & "maybe 10 min or More..." & return & "Depending on the Address Book Contacts." & return & return & "Hence Allow it to run for the while" with title MsgTitle ¬
with icon 1 ¬
buttons {"Continue"} ¬
giving up after 5
set question to display dialog "Select the Duplicate Search Parameter " with icon 1 with title MsgTitle ¬
buttons {"Contact Name", "Contacts on Phone & Email Id's", "Quit"} default button 3
set rtnValue to button returned of question
if rtnValue is "Quit" then
-- tell application "Address Book" to quit
tell me to quit
end if
if rtnValue is "Contact Name" then
-- tell application "Address Book" to quit
GetDup_byName("Duplicate Name")
end if
if rtnValue is "Contacts on Phone & Email Id's" then --Contacts on Phone & Email Id's
-- tell application "Address Book" to quit
Get_dup()
end if
end run
--- Search on Name Field ---
on GetDup_byName(theGroupName)
set question to display dialog "Do you want to search for duplicates based on Names? " with icon 0 with title MsgTitle ¬
buttons {"Continue", "Quit"} default button 1
set rtnValue to button returned of question
if rtnValue is "Quit" then
-- tell application "Address Book" to quit
tell me to quit
end if
tell application "Address Book"
activate
set biglist to {}
set NoNameList to {}
set theGroupNoName to "Duplicates No Names"
set theGroup to theGroupName
-- if not (exists (group "Dupilicate Entries")) then
if not (exists (group theGroup)) then
make new group with properties {name:theGroup}
save
end if
if not (exists (group theGroupNoName)) then
make new group with properties {name:theGroupNoName}
save
end if
set the_names to name of people
repeat with i from 1 to number of items in the_names
set theName to item i of the_names
-- return theName
if theName is not in biglist then
copy theName to end of biglist
else
set counter to (people whose name is theName)
if (count of counter) > 1 then
repeat with i from 1 to number of items in counter
set this_item to item i of counter
-- display dialog this_item
add this_item to group theGroup
end repeat
-- return counter as string
end if
end if
-- captures the Contacts without Name ---
if theName contains "@" then
-- display dialog theName
set counterList to (people whose name is theName)
repeat with i from 1 to number of items in counterList
set this_item to item i of counterList
-- display dialog this_item
add this_item to group theGroupNoName
end repeat
end if
-- save application "Address Book"
end repeat
save application "Address Book"
set peopleCount to (count every person)
-- set peopleCount to 50 -- only for testing --
repeat with i from 1 to peopleCount
set first_name to first name of person i as string
set Last_Name to last name of person i as string
if first_name is equal to "missing value" and Last_Name is equal to "missing value" then
-- display dialog first_name & " : " & Last_Name
set end of NoNameList to (id of person i)
end if
end repeat
repeat with j from 1 to the count of NoNameList
set tempdata to item j of NoNameList
-- set testdata to person id tempdata
-- if (name of groups of testdata does not contain theGroupNoEmail) then
add tempdata to group theGroupNoName
-- end if
end repeat
save application "Address Book"*)
display dialog ¬
"This Script Finished Processing Address Book Contacts the Duplicates are in the group" with title MsgTitle ¬
with icon 1 ¬
buttons {"Continue"} ¬
giving up after 5
end tell
end GetDup_byName
on Get_dup()
set question to display dialog "Do you want to search for duplicates based on Names? " with icon 0 with title MsgTitle ¬
buttons {"Continue", "Quit"} default button 1
set rtnValue to button returned of question
if rtnValue is "Quit" then
-- tell application "Address Book" to quit
tell me to quit
end if
tell application "Address Book"
activate
set theGroupEmail to "Duplicate Email Id's"
set theGroupPhone to "Duplicate Phone"
set theGroupNoEmail to "Only Phone Numbers"
set thegroupNoPhone to "Only Email Id's"
set theGroupNoData to "No Email or Phone"
-- set theGroup to theGroupName
if not (exists (group theGroupEmail)) then
make new group with properties {name:theGroupEmail}
save "Address Book"
end if
if not (exists (group theGroupPhone)) then
make new group with properties {name:theGroupPhone}
save "Address Book"
end if
if not (exists (group theGroupNoEmail)) then
make new group with properties {name:theGroupNoEmail}
save "Address Book"
end if
if not (exists (group thegroupNoPhone)) then
make new group with properties {name:thegroupNoPhone}
save "Address Book"
end if
if not (exists (group theGroupNoData)) then
make new group with properties {name:theGroupNoData}
save "Address Book"
end if
set ListofPeople to people --the_ID
set ListofEmailID to value of emails of people --the_emails
-- return ListofEmailID
set ListofPhones to value of phone of people -- the_phones
-- return ListofPhones
set biglist to {}
set ListEmail_Uniq to {}
set ListEmail_Dup to {}
set No_PhoneList to {}
set No_EmailList to {}
set No_dataList to {}
set FlagEmail to false
set FlagPhone to false
-- repeat with i from 1 to number of items in the_emails
repeat with i from 1 to count of ListofEmailID
set thePersonID to item i of ListofPeople
set theEmails to item i of ListofEmailID
if theEmails is equal to {} then
set end of No_EmailList to thePersonID
else
-- set FlagEmail to true
repeat with j from 1 to count of theEmails
set tmpdata to item j of theEmails
-- return tmpdata
if tmpdata is not in biglist then
set end of biglist to tmpdata
set end of ListEmail_Uniq to {tmpdata} & {thePersonID}
else
set end of ListEmail_Dup to {tmpdata} & {thePersonID}
end if
end repeat
end if
end repeat
-- return ListEmail_Uniq
-- return ListEmail_Dup
-- save application "Address Book"
set biglist to {}
set ListPhone_Uniq to {}
set ListPhone_Dup to {}
-- repeat with i from 1 to number of items in the_emails
repeat with i from 1 to count of ListofPhones
set thePersonID to item i of ListofPeople
set thePhones to item i of ListofPhones
if thePhones is equal to {} then
set end of No_PhoneList to thePersonID
else
-- set FlagPhone to true
repeat with j from 1 to count of thePhones
set tmpdata to item j of thePhones
-- return tmpdata
if tmpdata is not in biglist then
set end of biglist to tmpdata
set end of ListPhone_Uniq to {tmpdata} & {thePersonID}
else
set end of ListPhone_Dup to {tmpdata} & {thePersonID}
end if
end repeat
end if
end repeat
-- return ListPhone_Uniq
-- return ListPhone_Dup
set the Dup_email to {}
-- Find the Duplicates from the sorted list --
repeat with i from 1 to the count of ListEmail_Dup
set tempdata to item i of ListEmail_Dup
set dataEmailDup to item 1 of tempdata
set dataPersonDup to item 2 of tempdata
repeat with j from 1 to the count of ListEmail_Uniq
set tempdata to item j of ListEmail_Uniq
set dataEmailUniq to item 1 of tempdata
set dataPersonUniq to item 2 of tempdata
-- display dialog mainEmail1 & "=" & mainEmail2 & " " & mainID1 & "=" & mainID2
if dataEmailDup is equal to dataEmailUniq then
set end of Dup_email to dataPersonDup -- & "," & dataPersonUniq
set end of Dup_email to dataPersonUniq
end if
(* -- the code takes lot more time if add to group was used --
if dataEmailDup is equal to dataEmailUniq then
set testdata to person id dataPersonDup
add testdata to group theGroup
set testdata to person id dataPersonUniq
add testdata to group theGroup
end if
end repeat
end repeat
-- return Dup_email
set the Dup_Phone to {}
-- Find the Duplicates from the sorted list --
repeat with i from 1 to the count of ListPhone_Dup
set tempdata to item i of ListPhone_Dup
set dataPhoneDup to item 1 of tempdata
set dataPersonDup to item 2 of tempdata
repeat with j from 1 to the count of ListPhone_Uniq
set tempdata to item j of ListPhone_Uniq
set dataPhoneUniq to item 1 of tempdata
set dataPersonUniq to item 2 of tempdata
-- display dialog mainEmail1 & "=" & mainEmail2 & " " & mainID1 & "=" & mainID2
if dataPhoneDup is equal to dataPhoneUniq then
set end of Dup_Phone to dataPersonDup -- & "," & dataPersonUniq
set end of Dup_Phone to dataPersonUniq
end if
(*if dataPhoneDup is equal to dataPhoneUniq then
set testdata to person id dataPersonDup
add testdata to group theGroup
set testdata to person id dataPersonUniq
add testdata to group theGroup
-- save
end if*)
end repeat
end repeat
-- return Dup_Phone
set onlyDupEList to every person of group theGroupEmail
repeat with j from 1 to count of Dup_email
set tempdata to item j of Dup_email
if onlyDupEList does not contain {tempdata} then add tempdata to group theGroupEmail
end repeat
save application "Address Book"
set onlyDupPList to every person of group theGroupPhone
repeat with j from 1 to count of Dup_Phone
set tempdata to item j of Dup_Phone
if onlyDupPList does not contain {tempdata} then add tempdata to group theGroupPhone
end repeat
save application "Address Book"
set onlyPhoneList to every person of group theGroupNoEmail
repeat with j from 1 to the count of No_EmailList
set tempdata1 to item j of No_EmailList
if No_PhoneList does not contain {tempdata1} then
if onlyPhoneList does not contain {tempdata1} then add tempdata1 to group theGroupNoEmail
end if
(*set flagE to false
repeat with i from 1 to the count of No_PhoneList
set tempdata2 to item i of No_PhoneList
if tempdata1 is equal to tempdata2 then
set flagE to true
exit repeat
end if
end repeat
if flagE is false then add tempdata1 to group theGroupNoEmail*)
end repeat
save application "Address Book"
set onlyEmailList to every person of group thegroupNoPhone
repeat with j from 1 to the count of No_PhoneList
set tempdata1 to item j of No_PhoneList
if No_EmailList does not contain {tempdata1} then
if onlyEmailList does not contain {tempdata1} then add tempdata1 to group thegroupNoPhone
end if
end repeat
save application "Address Book"
set onlyList to every person of group theGroupNoData
repeat with i from 1 to count of ListofPeople
if (item i of ListofEmailID is equal to {}) and (item i of ListofPhones is equal to {}) then
set tempdata to item i of ListofPeople
if onlyList does not contain {tempdata} then add tempdata to group theGroupNoData
end if
end repeat
save application "Address Book"
display dialog ¬
"This Script Finished Processing Address Book Contacts the Duplicates are in the group" with title MsgTitle ¬
with icon 1 ¬
buttons {"Continue"} ¬
giving up after 5
end tell
end Get_dup
on quit
--set MsgTitle to "Change Email ID's Domain Name"
save application "Address Book"
display dialog "Contact Srikanth Kamath at [email protected] for any Help" with title MsgTitle with icon 1 buttons "OK"
continue quit
end quitHello Srikanth Kamath,
I'm not sure you're still following this thread, but anyway here's sample code I said I'd post later.
--SCRIPT2
main()
on main()
script o
-- input data
property xx : {1, 2, 3, 4, 5} -- list of parents
property yy : {{"g", "h"}, {"a", "b"}, {"b", "e", "f"}, {"e"}, {"c", "d"}} -- list of children per parent
-- work list
property pp : {} -- list of children tagged by parent; i.e, lits of {child, parent}
property qq : {}
property rr : {}
-- (1) build list of children tagged by parent
repeat with i from 1 to count my xx
set x to my xx's item i
set y to my yy's item i
repeat with p in y
set end of my pp to {p's contents, x}
end repeat
end repeat
--return pp -- {{"g", 1}, {"h", 1}, {"a", 2}, {"b", 2}, {"b", 3}, {"e", 3}, {"f", 3}, {"e", 4}, {"c", 5}, {"d", 5}}
-- (2) sort tagged list by child as key
msort(my by_key1, my pp)
--return pp -- {{"a", 2}, {"b", 2}, {"b", 3}, {"c", 5}, {"d", 5}, {"e", 3}, {"e", 4}, {"f", 3}, {"g", 1}, {"h", 1}}
-- (3) retrieve parents with duplicate child
(* retrieve list of {child, parent} for duplicate child *)
set my qq to uniq(my eq_key1, my pp, {_dup:true})
--return qq -- {{"b", 2}, {"b", 3}, {"e", 3}, {"e", 4}}
(* retrieve list of parent *)
repeat with q in my qq
set r to q's item 2
if r is not in my rr then set end of my rr to r
end repeat
return rr -- {2, 3, 4}
end script
tell o to run
end main
on by_key1(x, y)
msort's comparator for list of lists
key = item 1, ascending
returns true iff x and y are out of order
return x's item 1 > y's item 1
end by_key1
on eq_key1(x, y)
uniq's comparator for list of lists
key = item 1
returns true iff x and y are considered equal
return x's item 1 = y's item 1
end eq_key1
on msort(cmp_, aa) -- v1.2f2
Basic recursive merge sort handler having list sorted in place.
handler cmp_ : comparator
* cmp_(x, y) must return true iff list element x and y are out of order.
list aa : list to be sorted in place
script o
property parent : {} -- limit closure to minimum
property xx : aa -- to be sorted in place
property xxl : count my xx
property yy : {}
property cmp : cmp_
on merge(p, q, r)
property xx: source list
integer p, q, r : absolute indices to specify range to be merged such that
xx's items p thru r is the target range,
xx's items p thru (q-1) is the first sublist,
xx's items q thru r is the second sublist.
(p < q <= r)
local i, j, k, xp, xr, yi, yj, ix, jx
if r - p = 1 then
set xp to my xx's item p
set xr to my xx's item r
if my cmp(xp, xr) then
set my xx's item p to xr
set my xx's item r to xp
end if
return -- exit
else
if p < q - 1 then merge(p, (p + q) div 2, q - 1)
merge(q, (q + r + 1) div 2, r)
end if
At this point, sublits xx[p, q-1] and xx[q, r] have been already sorted (p < q <= r)
if my cmp(my xx's item (q - 1), my xx's item q) then
else -- xx[p, q-1] & xx[q, r] are already sorted
return
end if
set yy to my xx's items p thru r -- working copy for comparison
set ix to q - p
set jx to r - p + 1
set i to 1
set j to q - p + 1
set k to p
set yi to my yy's item i
set yj to my yy's item j
repeat
if my cmp(yi, yj) then
set my xx's item k to yj
set j to j + 1
set k to k + 1
if j > jx then
set my xx's item k to yi
set i to i + 1
set k to k + 1
repeat until k > r
set my xx's item k to my yy's item i
set i to i + 1
set k to k + 1
end repeat
return
end if
set yj to my yy's item j
else
set my xx's item k to yi
set i to i + 1
set k to k + 1
if i > ix then
set my xx's item k to yj
set j to j + 1
set k to k + 1
repeat until k > r
set my xx's item k to my yy's item j
set j to j + 1
set k to k + 1
end repeat
return
end if
set yi to my yy's item i
end if
end repeat
end merge
on cmp(x, y)
(* primary comparator *)
return x > y
end cmp
local d, i, j
if xxl ≤ 1 then return
if cmp_ = {} then set my cmp to cmp -- comparator fallback
my merge(1, (xxl + 1) div 2, xxl)
end script
tell o to run
end msort
on uniq(eq_, aa, {dup:dup}) -- v0.21
handler eq_ : comparator eq_(x, y) that returns true iff x and y are considered equal
list aa : pre-sorted list
(precisely, a list organized such that any duplicate items are adjacent to each other)
boolean _dup : option whether return unique items or duplicate items
return duplicate if true, unique otherwise.
script o
property parent : {} -- limit closure to minimum
property xx : aa
property yy : {}
property eq : eq_
on eq(x, y)
(* primitive comparator *)
x = y
end eq
if eq_ = {} then set my eq to my eq -- comparator fallback
local t, x, _on
if (count my xx) < 2 then return my xx's contents
if _dup then
set _on to false
set t to my xx's item 1
repeat with i from 2 to count my xx
set x to my xx's item i
if eq(x, t) then
set end of my yy to t
set _on to true
else if _on then
set end of my yy to t
set _on to false
end if
set t to x
end repeat
if _on then set end of my yy to x
return my yy's contents -- return duplicate elements
else
set t to my xx's item 1
set end of my yy to t
repeat with i from 2 to count my xx
set x to my xx's item i
if eq(x, t) then
else
set end of my yy to x
set t to x
end if
end repeat
return my yy's contents -- return uinque elements
end if
end script
tell o to run
end uniq
--END OF SCRIPT2
In order to apply it to your current Address Book problem, replace the main() handler with something like the following one.
--SCRIPT2a (part)
on main()
script o
-- input data
property xx : {} -- list of parent; given later
property yy : {} -- list of children per parent; given later
-- work list
property pp : {} -- list of children tagged by parent; i.e, lits of {child, parent}
property qq : {}
property rr : {}
-- (0) get input data from AB
tell application "Address Book"
tell people
set xx to its id
set yy to its every email's value
end tell
end tell
-- (1) build list of children tagged by parent *)
(* omitted (same as the previous) *)
-- (2) sort tagged list by child as key
(* omitted (same as the previous) *)
-- (3) retrieve parents with duplicate child
(* omitted (same as the previous) *)
-- (4) group the retrieved people in AB
tell application "Address Book"
repeat with r in my rr
add person id r to group "duplicate email"
end repeat
end tell
end script
tell o to run
end main
--END OF SCRIPT2a
Good luck,
Hiroto
Message was edited by: Hiroto -
I don't remember my apple ID questions. Until I answer them iTunes won't let me purchase anything. Please help as soon as possible because I've already tried to reset them and it wont let me.
You need to contact Apple, either through the link in that article or by phoning them. Nobody here has inside access to Apple's servers.
(79199) -
Apple Script for deleting podcasts
I subscribe to a lot of podcasts, but I don't want to keep them in my iTunes library after I'm done listening to them. Is there an Apple Script for automatically deleting podcasts? Thanks.
Thanks - once I'm in Automator and select Music, I don't see any options for finding Podcasts. Any suggestions which item/step I should select next in Automator? Thanks.
Maybe you are looking for
-
Notes from my iPhone doesn't push to my air
I have enabled my icloud account on both my iphone and macbook air, but notes that I've saved on my phone will not push to my air. However, my contact information was shared as expected. Any thoughts? Thanks in advance.
-
Shot in the Dark (AU)
MAde a transfer from one comouter to the next (GB and all plug ins). All is fine except for ONE plug in that is not giving out any sound. Its Global volume is on, It Opens up fine in the Sound Generator It is receiving midi signal as per GB The slide
-
No sound from speakers after 10.4.4 update
After doing all the latest updates I'm not getting any sound from the speakers on my powerbook. I can stream music, or listen to sound on my headphones, but not from the speakers. Any ideas?
-
I want to kill a ADOBE product related window that pups up on startup.
-
I use Windows XP and firefox version is upto date.Whenever I open the addon tab it shows the loading sign but fails to load even in a houris it a virus.Please help me in this regard.