ブラウザのヘルパーアプリv3 for Mac OS X 10.5
以下はSnow LeopardにおいてApple社、モジラ財団、双方からなかったことにされました(苦笑)。ので!?、Automator用のhttp://d.hatena.ne.jp/bootblack/20090928に移転しました
【2009.2.11修正 v3】
- 単入力しかこないようですが一応汎用Droplet的に律儀にList入力に対応しました
- 「Archived Debug Symbol File」という「種類」もあるようなので汎用的に
if ((theKind as string) contains "archive") or ((theKind as string) contains "アーカイブ") then
を
if ((theKind as string) ends with "archive") or ((theKind as string) ends with "アーカイブ") then
に修正しました
(2009.2.8)
Ver.2です。微調整しました。ダイアログが隠蔽されbackground only化されました。実はこのアプリ自体が一番ウザかったという(苦笑)
- for Mac X 10.5, 使用するアプリ名をスクリプト中で指定しているので指定有りです?
- ディスクに保存したいだけのファイルをウィルススキャンする
- 以下の安全なファイル(ほんとかよ!?(苦笑))を「普通」に開き、ウィルススキャンも行う。
- 開くためのアプリはPreview.app, DiskImageMounter.app, StuffIt Expander.appでウィルスチェックはclamav, clamav-wrapper.appで行う
- safariの模倣です?
と、clamav-wrapper.appはAppleScriptから切断されたことだし、ここらでホンマモンのAppleScript Studio Dropletっていう芸当を披露しておきますね(苦笑)。Studio用です。
Application.applescriptではダイアログを開かずにログで報告するようにしているので、DropletのInfo.plistで「Appliction is background only」を有効に出来ます。ちなみにStuffIt Expanderはパスワード付きZIPの入力ウィンドゥ等も出るので普通アプリのままで改造?はしない方がいいかと思います、技術的にも(苦笑)、AppleScript Studio Droplet実行時は通常、ドックアイコンに丸がついて跳ねるだけなのでウザくないと思いますし(苦笑)。
また、on will quitイベンツハンドラを追加しているので、IBで以下のチェックを入れる必要があります。
- Application.applescript(上記IB設定も必要)
- DMGはだまされていないかの確認とマウントがメインイベントです、マウントされた実体のウィルスチェックはここではやっていません。ここではマウントしたあとにDMGファイルのウィルスチェックを行います
- アーカイブ系は解凍後のもののみウィルスチェックを行います
- PDFは開いてからウィルスチェクです
- 処理したものにはラベルで色付けします、ダウンロード先に無色のファイルが単体でころがっていたらアクロバティックな芸当が失敗した等、何らかの激ヤバ!?です。血眼になってサクっと手動でチェックします(苦笑)
- ウィルスチェックの結果はclamav-wrapper.appで表示します
- ダウンロード先の内容の表示更新がとどこおっているときは
tell application "Finder"
tell application "System Events" to set downloadsFolderPath to path of (downloads folder)
open downloadsFolderPath
activate
set current view of Finder window 1 to column view
set current view of Finder window 1 to list view
end tell
とかチャッチャと手動で?ボタンを連打してフォルダの表示をカラム表示/リスト表示と切り替えるといいです
property TotalAliasList : {} property endFlag : true on setLabel(aItem) tell application "Finder" to set label index of aItem to 7 end setLabel on doScan(aItem) tell application "/opt/local/etc/clamav-wrapper.app" to open aItem end doScan on doExpand(aItem) try tell application "/Applications/StuffIt/StuffIt Expander.app" launch expand aItem as item with continue to expand set expanded_Item to result as alias tell application "System Events" to set theKind to kind of expanded_Item if theKind as string is "ディスクイメージ" then tell application "DiskImageMounter" to open expanded_Item end if return expanded_Item end tell on error errMes number errNum set logMes to "Expand Error " & (errNum as string) & ": " & errMes & " '" & (POSIX path of file (aItem as string)) & "'" log logMes end try end doExpand on quitExpander() if application "/Applications/StuffIt/StuffIt Expander.app" is running then quit application "/Applications/StuffIt/StuffIt Expander.app" end if end quitExpander on LoggingScriptErrorAndQuit(error_message, error_number) log ("AppleScript Error " & (error_number as string) & ": " & error_message) quit end LoggingScriptErrorAndQuit on open names try set endFlag to false set aliasList to names repeat with aItem in aliasList set end of TotalAliasList to aItem end repeat repeat with tgFile in TotalAliasList tell application "System Events" to set theKind to kind of tgFile if ((theKind as string) ends with "archive") or ((theKind as string) ends with "アーカイブ") then set expandedItem to doExpand(tgFile) doScan(expandedItem) setLabel(tgFile) else if (theKind as string is "ディスクイメージ") then tell application "DiskImageMounter" to open tgFile doScan(tgFile) setLabel(tgFile) else if (theKind as string) contains "PDF" then tell application "Preview" to open tgFile doScan(tgFile) setLabel(tgFile) tell application "Preview" to activate else doScan(tgFile) setLabel(tgFile) end if set TotalAliasList to rest of TotalAliasList end repeat on error error_message number error_number LoggingScriptErrorAndQuit(error_message, error_number) end try end open on idle theObject try if endFlag is true then quit else set endFlag to true end if return 1 on error error_message number error_number LoggingScriptErrorAndQuit(error_message, error_number) end try end idle on will quit theObject try quitExpander() on error error_message number error_number LoggingScriptErrorAndQuit(error_message, error_number) end try end will quit