ファイル名を変更しる
set
name
of
theFile
to
NewName
例:
--(1)ファイル選択ダイアログの表示
set
theFile
to
(choose
file
with
prompt
"ファイルを選択しる")
tell
application
"Finder"
activate
set
theName
to
name
of
theFile
--(2)新しい名前の入力を求めるダイアログの表示
set
DialogReply
to
(display
dialog
"このファイルの新しい名前を入力しれ"
buttons
¬
{"変更しないじょ",
"変更"}
default
button
2
default
answer
theName)
set
ButtonName
to
button
returned
of
DialogReply
set
NewName
to
text
returned
of
DialogReply
--(3)ファイル名を変更
if
ButtonName
=
"変更"
and
NewName
≠ ""
then
set
name
of
theFile
to
NewName
end
if
end
tell
※不正な名前を付けるとスクリプトが停止しちゃうぞ。
Posted: 金 - 12月
19, 2003 at 03:49 PM