CocoaなMozilla「Camino」! 14that MAC
CocoaなMozilla「Camino」! 14th - 暇つぶし2ch405:名称未設定
09/01/14 20:38:42 U/ibqIqB0
--URLリンク(lostman-worlds-end.blogspot.com)
set editDataType to "script"
set editDataValue to "2" --1=許可  2=停止
set permissions_sqlite_path to "~/Library/Application\\ Support/Camino/permissions.sqlite"
display dialog "スクリプトを停止するドメインを入力してください" default answer "" buttons {"Cancel", "OK"} default button 2
copy the result as list to {theDomain, button_pressed}
set allData to do shell script "sqlite3 " & permissions_sqlite_path & " 'select * from moz_hosts;'" without altering line endings
set inputDataType to "|" & theDomain & "|" & editDataType & "|"
set fullInputData to inputDataType & editDataValue
if allData contains inputDataType then
if allData contains fullInputData then
display alert theDomain & "はすでに登録されています"
return
else
set theDataText to do shell script "echo " & quoted form of allData & " | grep '" & inputDataType & "'"
set theID to do shell script "echo " & quoted form of theDataText & " | perl -ne '/^([0-9]+)/; print $1;'"
do shell script "sqlite3 " & permissions_sqlite_path & " \" update moz_hosts set permission = '" & editDataValue & "' where id = " & theID & ";\""
end if
else
set theLastID to do shell script "echo " & quoted form of allData & " | tail -n 2 | perl -ne '/^([0-9]+)/; print $1;'"
set addID to 1 + theLastID
do shell script "sqlite3 " & permissions_sqlite_path & " \"insert into moz_hosts values(" & addID & ", '" & theDomain & "', '" & editDataType & "', " & editDataValue & ");\""
end if
set allData to do shell script "sqlite3 " & permissions_sqlite_path & " 'select * from moz_hosts;'" without altering line endings
set theDataText to do shell script "echo " & quoted form of allData & " | grep '" & inputDataType & "'"
display dialog "追加・変更後のデータ" & return & theDataText


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch