-- TellInfo 1.0
-- Tämä harjoitus näyttää osan tiedoston infosta ja antaa mahdollisuuden kopioida sen.
-- Vaatimukset: Mac OS 8 Standard Additions. Ei testattu 7.*.

-- 1999 Tuomas Rosberg <vanhentunut>
-- Lähdekoodi on ilmaista ja tarkoitettu yleiseen käyttöön (public domain).
-- Sitä lainattessa kirjoittajan nimi on mainittava.
-- Koodilla ei ole mitään takuuta, ja sen sisältävää ohjelmaa käyttävät
-- toimivat omalla vastuullaan.

on run
   tell application "Finder"
      set theList to selection
   end tell
   my tellInfo(theList)
end run

on open theList
   my tellInfo(theList)
end open

on tellInfo(theList)
   tell application "Finder"
      repeat with x in theList
         try
            set theKind to kind of x
            set theInfo to info for x
            set theName to name in theInfo
            set theVers to long version in theInfo
            set theModifD to modification date in theInfo
            set theAnswer to "" & theName & "" & tab & ¬
               theKind & return & theVers & return & "modified " & theModifD
            display dialog ¬
               "To get this info to Clipboard, choose “Copy”" & return & theAnswer buttons {"Copy", "OK"} default button "OK"
            if button returned of result is "Copy" then
               my setCb(theAnswer)
               exit repeat
            end if
         on error
         end try
      end repeat
   end tell
end tellInfo

on setCb(theAnswer)
   tell current application
      set the clipboard to theAnswer
   end tell
end setCb