Scripts


FileType 変更

なんだか FileType を変更する Tool というのが FAQ のようなので、ここにも書いておくとしよう。

MacPerl Droplet type.pl

#!/usr/bin/env perl
MacPerl::SetFileInfo('ttxt', 'TEXT', @ARGV);
MacPython Droplet type.py

#!/usr/bin/env python
import MacOS, macostools, sys
if __name__ == '__main__':
    for x in sys.argv[1:]:
        MacOS.SetCreatorAndType(f, 'ttxt', 'TEXT')
        macostools.touched(f)
AppleScript Droplet type.applescript

on open argv
    tell application "Finder"
        repeat with i in argv
            set i's file type to "TEXT"
        end repeat
    end tell
end open

File 連結

勿論 Classic 環境用。

MacPerl Droplet concat.pl

#!/usr/bin/env perl
open CAT, "> dogCow.cat" or die;
print CAT <>;
close CAT;
MacPython Droplet concat.py

#!/usr/bin/env python
import sys
if __name__ == '__main__':
    o = open('dogCow.cat', 'w')
    o.write(sys.stdin.read())
    o.close()
AppleScript Droplet concat.applescript

on open argv
    open for access (choose file name) with write permission returning total
    repeat with i in argv
        open for access i returning part
        write (read part) to total
        close access part
    end repeat
    close access total
end open

後始末

"Mpack" Folder 内の ゴミを捨てる AppleScript.

tell application "Finder"
    tell preferences folder's folder "Mpack"
        if exists it then delete folders
    end tell
end tell