2009-11-03

続・Applescript/HTMLシンタックスカラーリング


以前Applescript/HTMLシンタックスカラーリングで Snow Leopard 非対応で紹介できなかったScript factoryさんの AppleScriptHTML でしたが、10/26のアップデートで Snow Leopard に対応したようですので試してみました。

いち


今回はスクリプトエディタで開いているコードを対象にしたいので、変換したい AppleScript をコンパイルしてカラーリングされた状態にする。



AppleScriptHTML で変換する。

さん


クリップボードに HTML 化された AppleScript が♪


AppleScriptHTML は CSS と HTML が分離しているのが特徴なのですが、Blogger に貼り付ける場合は CSS をタグに埋め込むか、ブログテンプレートの CSS に埋め込んじゃわないといけないのです(たぶん)。
今回は手でタグに埋め込んでみましたが、AppleScript をBlogで公開することがある方ならテンプレートに埋め込んじゃうと良いのではないでしょうか。
私の使用しているテンプレートのせいかもしれませんが、text-indentが効かない、改行幅がとても広くなる等多少調整が必要でしたのでご注意ください。


BloggerのHTML直接編集でも、改行があると表示時に自動的に改行タグを入れられてしまうのが原因でした。
作者様のご指摘で改行を削除してコピペし直すと、無事 text-indent も改行幅も効きました。
(11/28追記)


しかしこのワンボタンで終了の楽さは捨て難いです。

on handle_string(s)
try
set tagString to s

tell application "Finder"
try

set theFiles to selection

repeat with theItem in theFiles

-- Set Label Color On/Off
-- set label index of theItem to 0

-- Set SpotlightComment
set newSptcomString to ""
set sptcomString to comment of theItem
if sptcomString is "" then
set newSptcomString to tagString
else
set newSptcomString to sptcomString & " " & tagString
end if

set comment of theItem to newSptcomString

end repeat

open location "x-launchbar:hide"

on error msg number val
{errMsg:msg, errVal:val}
end try
end tell

end try
end handle_string



byT




☆以下表示確認用 改行削除・CSS別バージョン☆

on handle_string(s)
try
set tagString to s

tell application "Finder"
try

set theFiles to selection

repeat with theItem in theFiles

-- Set Label Color On/Off
-- set label index of theItem to 0

-- Set SpotlightComment
set newSptcomString to ""
set sptcomString to comment of theItem
if sptcomString is "" then
set newSptcomString to tagString
else
set newSptcomString to sptcomString & " " & tagString
end if

set comment of theItem to newSptcomString

end repeat

open location "x-launchbar:hide"

on error msg number val
{errMsg:msg, errVal:val}
end try
end tell

end try
end handle_string

2009-11-01

Xcodeのエラー : The image scaling property should not be used with ...



現在開発中アプリのチェックボックスとラジオボタンでこんな警告が出てました。

ググったところ同様の警告がボタンで出るという記事があって直せました。
Hope is a good thing. : Image scaling is not supported on Mac OS X versions prior to 10.5

原因はOS10.4がデプロイメントターゲットに含まれるからだそう。
10.5から追加された属性のデフォルト値が問題らしいですよ。
なので、scaling属性を「Proportionally Down」から「None」に変更で出なくなります。



xcode3.1.4では出ないのにxcode3.2では出るんですよね、両方で出ないのは不思議。しかし出なくなったので気にしない。


byT