hallo zusammen,
falls grad wer mit ahnung da ist, hätt ich eine kleine bitte.
und zwar möchte ich das (un)capitalizes der scripts in hubis scripts für itunes (hubis scripts for itunes) so modifizieren, dass keine eingabeaufforderungen mehr angezeigt werden, und es automatisch alle felder in kleinbuchstaben umwandelt. letzteres hab ich bereits hingekriegt, bei ersterem find ich mich nicht ganz zurecht.
wär lieb, wenn mir jemand weiterhelfen könnte.
schöne grüße aus regensburg
sebastian
falls grad wer mit ahnung da ist, hätt ich eine kleine bitte.
und zwar möchte ich das (un)capitalizes der scripts in hubis scripts für itunes (hubis scripts for itunes) so modifizieren, dass keine eingabeaufforderungen mehr angezeigt werden, und es automatisch alle felder in kleinbuchstaben umwandelt. letzteres hab ich bereits hingekriegt, bei ersterem find ich mich nicht ganz zurecht.
wär lieb, wenn mir jemand weiterhelfen könnte.
schöne grüße aus regensburg
sebastian
Code:
property special_bigChars : {"Ä", "Å", "Ç", "É", "Ñ", "Ö", "Ü", "À", "Ã", "Õ", "Ÿ", "Â", "Ê", "Á", "Ë", "È", "Í", "Î", "Ï", "Ì", "Ó", "Ô", "Ò", "Ú", "Û", "Ù"}
property special_smallChars : {"ä", "å", "ç", "é", "ñ", "ö", "ü", "à", "ã", "õ", "ÿ", "â", "ê", "á", "ë", "è", "í", "î", "ï", "ì", "ó", "ô", "ò", "ú", "û", "ù"}
property action_list01 : {"Album", "Artist", "Title", "Genre", "Composer", "Comment"}
property action_list02 : {"01-Abcd Efg", "02-Abcd efg", "03-ABCD EFG", "04-abcd efg"}
set action01 to get_selection_index(action_list01, "Which fields (multible selection allowed)", true)
set action02 to 4
tell application "iTunes"
activate
--=============
set do_backup_in_comment to false
--=============
set these_tracks to selection of browser window 1
if these_tracks is {} then error "No tracks are selected in the front window."
end tell
repeat with this_track in these_tracks
repeat with fieldid in action01
tell application "iTunes"
set fieldid to fieldid as integer
if fieldid = 1 then
set thestring to album of this_track
else if fieldid = 2 then
set thestring to artist of this_track
else if fieldid = 3 then
set thestring to name of this_track
else if fieldid = 4 then
set thestring to genre of this_track
else if fieldid = 5 then
set thestring to composer of this_track
else if fieldid = 6 then
set thestring to comment of this_track
end if
end tell
set finalstring to do_string(action02, thestring)
tell application "iTunes"
if fieldid = 1 then
set album of this_track to finalstring
else if fieldid = 2 then
set artist of this_track to finalstring
else if fieldid = 3 then
set name of this_track to finalstring
else if fieldid = 4 then
set genre of this_track to finalstring
else if fieldid = 5 then
set composer of this_track to finalstring
else if fieldid = 6 then
set comment of this_track to finalstring
end if
end tell
end repeat
end repeat
--------------
--=====================================
on do_string(actionid, the_string)
set actionid to actionid as integer
set finalstring to ""
if actionid = 1 then
repeat with i from 1 to count of characters of the_string
set test_char to character i of the_string
if i = 1 then
set finalstring to makebig(test_char)
else
set prev_char to character (i - 1) of the_string --last character of finalstring as text
if followed_by_bigchar(prev_char) = true then
set finalstring to finalstring & makebig(test_char)
else
set finalstring to finalstring & makesmall(test_char)
end if
end if
end repeat
else if actionid = 2 then
set firstchar to makebig(character 1 of the_string)
repeat with i from 2 to count of characters of the_string
set test_char to character i of the_string
set finalstring to finalstring & makesmall(test_char)
end repeat
set finalstring to (firstchar & finalstring) as text
else if actionid = 3 then
repeat with i from 1 to count of characters of the_string
set test_char to character i of the_string
set finalstring to finalstring & makebig(test_char)
end repeat
else if actionid = 4 then
repeat with i from 1 to count of characters of the_string
set test_char to character i of the_string
set finalstring to finalstring & makesmall(test_char)
end repeat
end if
return finalstring
end do_string
on followed_by_bigchar(test_char)
if ((ASCII number of test_char) is greater than 64) and ¬
((ASCII number of test_char) is less than 91) then
return false
else if ((ASCII number of test_char) is greater than 96) and ¬
((ASCII number of test_char) is less than 123) then
return false
else if special_bigChars contains test_char then
return false
else if test_char = "'" then
return false
else
return true
end if
end followed_by_bigchar
on makesmall(test_char)
--when it's a normal character
if ((ASCII number of test_char) is greater than 64) and ¬
((ASCII number of test_char) is less than 91) then
return (ASCII character ((ASCII number of test_char) + 32))
--when it's a special character
else if test_char is in special_bigChars then
repeat with i from 1 to count of special_bigChars
if item i of special_bigChars = test_char then
return item i of special_smallChars
end if
end repeat
--when it's something else
else
return test_char
end if
end makesmall
on makebig(test_char)
--when it's a normal character
if ((ASCII number of test_char) is greater than 96) and ¬
((ASCII number of test_char) is less than 123) then
return (ASCII character ((ASCII number of test_char) - 32))
--when it's a special character
else if test_char is in special_smallChars then
repeat with i from 1 to count of special_bigChars
if item i of special_smallChars = test_char then
return item i of special_bigChars
end if
end repeat
--when it's something else
else
return test_char
end if
end makebig
on get_selection_index(action_list, theprompt, mult_selection)
set theselection to choose from list action_list multiple selections allowed mult_selection with prompt theprompt
set returnlist to {}
repeat with theselected in theselection
set i to 1
repeat with theaction in action_list
if theselected as text = theaction as text then
set returnlist to returnlist & i as list
end if
set i to i + 1
end repeat
end repeat
return returnlist
end get_selection_index
Zuletzt bearbeitet von einem Moderator: