on run
choose file of type "clpt" with multiple selections allowed without invisibles
open result
end run
on open theFiles
set sigsText to ((path to desktop as Unicode text) & "sigs.txt")
repeat with oneFile in theFiles
if name extension of (info for oneFile) is "textClipping" then
set theFile to quoted form of POSIX path of oneFile
set theData to do shell script "/bin/cat " & theFile & "/..namedfork/rsrc"
set {TID, text item delimiters} to {text item delimiters, ((ASCII character 254) & (ASCII character 255))}
set theData to text items of theData
set theData to item 2 of theData
set text item delimiters to ((ASCII character 0) & (ASCII character 0))
set theData to text item 1 of theData
set text item delimiters to TID
write_to_disk from (theData & return) into sigsText
end if
end repeat
end open
on write_to_disk from theData into theFile
try
set ff to open for access file theFile with write permission
write theData to ff starting at eof
close access ff
return true
on error
try
close access file theFile
end try
return false
end try
end write_to_disk
Here’s a nice variant that uses the Satimage OSAX:
on run
choose file of type "clpt" with multiple selections allowed without invisibles
open (result as list)
end run
on open theItems
set fRef to (open for access file ((path to desktop as Unicode text) & "sigs.txt") with write permission)
try
if ((get eof fRef) is 0) then write «data rdatFEFF» to fRef
repeat with thisItem in theItems
if (file type of (info for thisItem) is "clpt") then
-- The next two lines use the Satimage OSAX.
set rsrcNum to beginning of (list resources "utxt" from thisItem)
set txt to (load resource rsrcNum type "utxt" from thisItem)
write txt & return as Unicode text to fRef starting at eof
end if
end repeat
end try
close access fRef
end open