- 投稿日 : 2006-10-02
- 更新日 : 2006-10-02
- AppleScript
文字列の最後に出現するセミコロン以降を削除する AppleScript のサンプルです。パス操作用?
Macintosh HD:Users:USERNAME:Desktop:test.scpt
こんなパス(文字列)を
Macintosh HD:Users:USERNAME:Desktop:
こうしたくて書いてみました。
set x to "Macintosh HD:Users:USERNAME:Desktop:test.scpt"
log (MyFilePath(x))
on MyFilePath(this_text)
set y to 0
repeat with thisChar in this_text
set y to y + 1
set x to the offset of thisChar in ":"
if x is not 0 then
set z to y
end if
end repeat
return (text from character 1 to z of this_text)
end MyFilePath
動作確認:Mac OS 10.4.7
Comments:0
Trackbacks:0
- Trackback URL for this entry
- http://bowz.info/1244/trackback
- Listed below are links to weblogs that reference
- [ AppleScript ] 文字列の最後に出現するセミコロン以降を削除するサブルーチン from Bowz::Notebook