火 - 12月 23, 2003

指定したアプリを非表示にしる


choose from list

例:
tell application "Finder"
activate
set applist to application processes
set nameList to {}
repeat with obj in applist
if (file of obj as text) does not contain ":System:Library:" then ¬
set nameList to nameList & name of obj
end repeat
choose from list nameList with prompt ¬
"非表示にするアプリを選択しる" with multiple selections allowed
set ans to result
if ans = false then return
repeat with obj in ans
set visible of application process (obj as text) to false
end repeat
end tell

※複数選択もできるじょ。

Posted at 12:16 AM    

月 - 12月 22, 2003

IEのキャッシュをデリる


delete file ≪なにがし≫

例:
tell application "Finder"
delete file "IE Cache.waf" of folder "MS Internet Cache" of folder ¬
"Caches" of folder "Library" of home
end tell

※そのまま実行しるだけ

Posted at 04:29 PM    

ドロップしたテキストファイルの中身をクリップボードにコピーする。


set the clipboard to result

例:
on open dropitems
set obj to item 1 of dropitems
open for access obj
read obj
set the clipboard to result
close access obj
end open

※これもデスクトップに常駐させておくと何かと便利だじょ。

Posted at 01:31 PM    

ドロップしたファイル/フォルダのエイリアスを作る


make alias at ≪どこそこ≫

例:
on open dropitems
tell application "Finder"
if not (exists folder "AliasFiles" of desktop) then
make new folder at desktop
set newfolder to result
set name of newfolder to "AliasFiles"
end if
repeat with obj in dropitems
make alias at folder "AliasFiles" of desktop to obj
end repeat
open folder "AliasFiles" of desktop
end tell
end open

※もし「AliasFiles」フォルダがなければ新規に作成するじょ。

Posted at 01:21 PM    

日 - 12月 21, 2003

Dropletを作成しる


「アプリケーション」で保存しる

例:
on open droppedItem
tell application "Finder"
repeat with obj in droppedItem
set x to name of obj
set mdate to modification date of obj
set y to date string of mdate
set name of obj to x & return & y
end repeat
end tell
end open

作成したドロップレットにファイルなんかを落とすと
最終変更日が付け足されるじょ。

※ファイルだと属性が変更されるので実用的ではないじょ。
 フォルダ向けか?

※要はスクリプトを使えば、改行した名前も付けられるってことでする。

Posted at 03:24 PM    

土 - 12月 20, 2003

スクリプトの基本はハンドラなのだ。


on run ー

例:
on run
display dialog "てきとうに数字を入力しる" default answer ""
set ans to result
try
set Str1 to text returned of ans
set x to calc(Str1 as text)
display dialog "1から" & Str1 & "まで足したら、" & x & ¬
"だぴょーん。" as text
end try
end run

on calc(n)
set y to 0
repeat with i from 1 to n
set y to y + i
end repeat
return y
end calc

※runハンドラの途中で、calcハンドラを呼び出しているんだじょ。
 数値の扱いと計算を分けて記述しているのだ。

Posted at 06:25 PM    

Internet Locationファイルを作成しる - その2


make internet location file at ≪どこそこ≫ to ≪メアド≫

例:
tell application "Finder"
activate
make internet location file at desktop ¬
to "mailto:zieg@mac.com"
end tell

これでいつでも瞬時においらにメールが送れるじょ。
※スパムはやめてだじょ。

Posted at 01:04 PM    

Internet Locationファイルを作成しる


make internet location file at ≪どこそこ≫ to ≪URL≫

例:
tell application "Finder"
activate
make internet location file at desktop ¬
to "http://homepage.mac.com/zieg/iblog/index.html"
end tell

これでいつでも瞬時にここに来れるじょ。

Posted at 12:58 PM    

アプリケーションを指定してファイルを開く


open file ≪ファイル名≫ using application file ≪アプリケーション名≫

例:
tell application "Finder"
open file "gonta_030602.rtf" of desktop ¬
using application file "TextEdit.app" of folder "Applications" of startup disk
end tell

これでデスクトップにあるgonta_030602.rtfと言うファイルが
テキストエディットで開く。

Posted at 12:35 PM    

散らかったウィンドウをしまう


set collapsed of Finder windows to true

例:
tell application "Finder"
set collapsed of Finder windows to true
end tell

これでFinderのウィンドウがDockに格納される。

※オイラの場合はその場でちっちゃくなる。

Posted at 12:11 PM    

1から100まで足し算しる


repeat with ≪変数≫ from to

例:
set x to 0
set y to 100
repeat with i from 1 to y
set x to x + i
end repeat
display dialog x as text

※そろばん持ったら、必ずやるアレね。

Posted at 12:36 AM    

気温だって換算しる


摂氏温度=5/9 ×(華氏温度 - 32)なんていう公式は不要だじょ。

例:
set x to 77 as degrees Fahrenheit
x as degrees Celsius

これで華氏77度ってーのが、摂氏何度かわかるじょ。

Posted at 12:23 AM    

計算しる


度量衡だってできるんだじょ

例:
set x to 1 as inches
x as centimeters

これで1インチが何センチかわかるじょ。
結果ウィンドウを見るのだ。

Posted at 12:13 AM    

金 - 12月 19, 2003

名前を指定してフォルダを作るじょ


make folder at ≪どこそこ≫ with properties {name:"なんたらかんたら"}

例:
tell application "Finder"
make folder at desktop with properties {name:"ひみつ"}
end tell

※「ひみつ」といっても、エッチ画像が入っているとは限らないじょ。

Posted at 04:00 PM    

フォルダを作るじょ


make folder at ≪どこそこ≫

例:
tell application "Finder"
make folder at desktop
end tell

これでデスクトップに新しいフォルダができたじょ。

Posted at 03:54 PM    












©