-- uncomment the next five lines if you want -- to run this script independent of Adium -- on run -- display dialog "Text to leetify: " default answer "I'm a super-leet hacker dude!" -- set unleet to text returned of result -- substitute(unleet) -- end run -- 13375p33k Xtra version 1.2 -- 02 October 2004 -- by Chris Lawson -- This code is copyright © 2004 by Chris Lawson -- Don't be evil. If you need some code, ask me. on make_leet(unleet_string, substring, leet_replacement) set location_of_sub to the offset of substring in unleet_string -- finds the substring (or individual character) to translate in the 'unleet' text if location_of_sub is 1 then -- if the substring starts at the beginning of the text set first_part to "" -- set to empty string to avoid an error else -- otherwise set first_part to everything up to the substring set first_part to ((characters 1 thru (location_of_sub - 1)) of unleet_string) end if if location_of_sub is ((length of unleet_string) - (length of substring) + 1) then -- if the substring coincides with the end of the text set last_part to "" -- set to empty string to avoid an error else -- otherwise set to last_part everything after the substring set last_part to characters (location_of_sub + (length of substring)) thru (length of unleet_string) of unleet_string end if set unleet_string to first_part & leet_replacement & last_part -- concatenate the first_part, translated substring, and last_part back into the original string return unleet_string as string -- return this lovely new "leetified" string end make_leet on substitute(unleet_phrase) -- this ought to be pretty self-explanatory from here on out, but I've commented one representative example -- begin word substitution section 1 (for words that don't get munged by letter substitution) repeat while unleet_phrase contains "hackers" -- as long as "unleet" text still contains (in this case) "hackers" set unleet_phrase to make_leet(unleet_phrase, "hackers", "h4x0rz") -- "leetify" the word "hackers" into "h4x0rz" end repeat -- (using repeat is much easier than a bunch of -- nested if...then nonsense -- AppleScript loops rock!) repeat while unleet_phrase contains "hacker" set unleet_phrase to make_leet(unleet_phrase, "hacker", "h4x0r") end repeat repeat while unleet_phrase contains "hacks" set unleet_phrase to make_leet(unleet_phrase, "hacks", "h4x0rz") end repeat repeat while unleet_phrase contains "hack" set unleet_phrase to make_leet(unleet_phrase, "hack", "h4x0rz") end repeat repeat while unleet_phrase contains "sucks" set unleet_phrase to make_leet(unleet_phrase, "sucks", "5ux0rz") end repeat repeat while unleet_phrase contains "suck" set unleet_phrase to make_leet(unleet_phrase, "suck", "5ux0rz") end repeat repeat while unleet_phrase contains "nuts" set unleet_phrase to make_leet(unleet_phrase, "nuts", "nu7z0rz") end repeat repeat while unleet_phrase contains "nut" set unleet_phrase to make_leet(unleet_phrase, "nut", "nu7z0r") end repeat repeat while unleet_phrase contains "rocks" set unleet_phrase to make_leet(unleet_phrase, "rocks", "r0x0rz") end repeat repeat while unleet_phrase contains "rock" set unleet_phrase to make_leet(unleet_phrase, "rock", "r0x0rz") end repeat repeat while unleet_phrase contains "owns" set unleet_phrase to make_leet(unleet_phrase, "owns", "pwNz0rz") end repeat repeat while unleet_phrase contains "own" set unleet_phrase to make_leet(unleet_phrase, "own", "pwN") end repeat repeat while unleet_phrase contains "skills" set unleet_phrase to make_leet(unleet_phrase, "skills", "5|