- 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
Trackback+Pingback: 0
- TrackBack URL for this entry
- http://bowz.info/1244/trackback
- Listed below are links to weblogs that reference
- [ AppleScript ] 文字列の最後に出現するセミコロン以降を削除するサブルーチン from Bowz::Notebook