スクリプト名:SecurityItemClicker設定
(*
このHTML書類はぴよまるソフトウェアさんの AS Publisher v1.0 を使用して作成されました。
http://www.appleco.jp/piyomarusoft/

このページ下部にある「新規書類にペースト」というリンクをクリックすると
スクリプトエディタが起動して新規にスクリプト書類が作成されます。
適当なファイル名を付けて"スクリプト"形式で保存してください。

このスクリプトは(おそらく)10.4専用です。
*)

tell application "Finder"
  if (exists of file "KTSecurityItemClicker20050802.plist" of folder "preferences" of (path to library folder from user domain)) is false then
    activate
    
open folder "preferences" of (path to library folder from user domain)
    
display dialog "\"~/Library/Preferences/\"に" & return & "\"KTSecurityItemClicker20050802.plist\"という" & return & "名前の設定ファイルを作ります。" buttons {"キャンセル", "作る"} default button 2
    
if button returned of result is "作る" then
      do shell script "defaults write KTSecurityItemClicker20050802 '
    {
    KTSafariCookiesClick = 1;
    KTSafariJavaEnabledClick = 1;
    KTSafariJavaScriptEnabledClick = 1;
    KTSafariPlugInClick = 0;
    KTSafariPopUpWindowClick = 0;
    KTSafariSendFormClick = 0;
    }'"
    
else
      return
    end if
    
display dialog "ファイルを作成しました" buttons {"OK"} default button 1 giving up after 1
    
setClicks() of me
    
tell application "System Events" to if (exists of process "Safari") is true then activate application "Safari"
  else
    setClicks() of me
    
tell application "System Events" to if (exists of process "Safari") is true then activate application "Safari"
  end if
end tell

on setClicks()
  tell application "Finder"
    activate
    
set plugInClick to (convertBool(do shell script "defaults read KTSecurityItemClicker20050802 KTSafariPlugInClick") of me)
    
set javaClick to (convertBool(do shell script "defaults read KTSecurityItemClicker20050802 KTSafariJavaEnabledClick") of me)
    
set javaScriptClick to (convertBool(do shell script "defaults read KTSecurityItemClicker20050802 KTSafariJavaScriptEnabledClick") of me)
    
set popUpWindowClick to (convertBool(do shell script "defaults read KTSecurityItemClicker20050802 KTSafariPopUpWindowClick") of me)
    
set cookiesClick to (convertBool(do shell script "defaults read KTSecurityItemClicker20050802 KTSafariCookiesClick") of me)
    
set sendFormClick to (convertBool(do shell script "defaults read KTSecurityItemClicker20050802 KTSafariSendFormClick") of me)
    
choose from list {"プラグイン設定のチェックボックス: " & plugInClick, "Java設定のチェックボックス: " & javaClick, "JavaScript設定のチェックボックス: " & javaScriptClick, "ポップアップウインドウ設定のチェックボックス:" & popUpWindowClick, "Cookie設定のラジオボタン: " & cookiesClick, "フォーム送信設定のチェックボックス: " & sendFormClick} with prompt "\"YES\"になっている項目のみが" & return & "クリックの対象になります。" default items {"プラグイン設定のチェックボックス: " & plugInClick} OK button name "変更" cancel button name "終了"
    
set theResult to result
    
if theResult is false then
      return
    else
      if theResult is {"プラグイン設定のチェックボックス: " & plugInClick} then
        if plugInClick is "NO" then
          do shell script "defaults write KTSecurityItemClicker20050802 KTSafariPlugInClick -bool true"
        else
          do shell script "defaults write KTSecurityItemClicker20050802 KTSafariPlugInClick -bool false"
        end if
        
display dialog "設定を変更しました" buttons {"OK"} default button 1 giving up after 1
        
setClicks() of me
      else if theResult is {"Java設定のチェックボックス: " & javaClick} then
        if javaClick is "NO" then
          do shell script "defaults write KTSecurityItemClicker20050802 KTSafariJavaEnabledClick -bool true"
        else
          do shell script "defaults write KTSecurityItemClicker20050802 KTSafariJavaEnabledClick -bool false"
        end if
        
display dialog "設定を変更しました" buttons {"OK"} default button 1 giving up after 1
        
setClicks() of me
      else if theResult is {"JavaScript設定のチェックボックス: " & javaScriptClick} then
        if javaScriptClick is "NO" then
          do shell script "defaults write KTSecurityItemClicker20050802 KTSafariJavaScriptEnabledClick -bool true"
        else
          do shell script "defaults write KTSecurityItemClicker20050802 KTSafariJavaScriptEnabledClick -bool false"
        end if
        
display dialog "設定を変更しました" buttons {"OK"} default button 1 giving up after 1
        
setClicks() of me
      else if theResult is {"ポップアップウインドウ設定のチェックボックス:" & popUpWindowClick} then
        if popUpWindowClick is "NO" then
          do shell script "defaults write KTSecurityItemClicker20050802 KTSafariPopUpWindowClick -bool true"
        else
          do shell script "defaults write KTSecurityItemClicker20050802 KTSafariPopUpWindowClick -bool false"
        end if
        
display dialog "設定を変更しました" buttons {"OK"} default button 1 giving up after 1
        
setClicks() of me
      else if theResult is {"Cookie設定のラジオボタン: " & cookiesClick} then
        if cookiesClick is "NO" then
          do shell script "defaults write KTSecurityItemClicker20050802 KTSafariCookiesClick -bool true"
        else
          do shell script "defaults write KTSecurityItemClicker20050802 KTSafariCookiesClick -bool false"
        end if
        
display dialog "設定を変更しました" buttons {"OK"} default button 1 giving up after 1
        
setClicks() of me
      else if theResult is {"フォーム送信設定のチェックボックス: " & sendFormClick} then
        if sendFormClick is "NO" then
          do shell script "defaults write KTSecurityItemClicker20050802 KTSafariSendFormClick -bool true"
        else
          do shell script "defaults write KTSecurityItemClicker20050802 KTSafariSendFormClick -bool false"
        end if
        
display dialog "設定を変更しました" buttons {"OK"} default button 1 giving up after 1
        
setClicks() of me
      end if
    end if
  end tell
end setClicks

on convertBool(x)
  if x is "0" then
    return "NO"
  else
    return "YES"
  end if
end convertBool

▼新規書類にペースト  ▼カーソル位置にペースト  ▼ドキュメント末尾にペースト

AS Publisher v1.0(ぴよまるソフトウェア)