• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Safari Extension Report
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Safari Extension Report


  • Subject: Safari Extension Report
  • From: Christopher Stone <email@hidden>
  • Date: Fri, 04 May 2012 05:40:46 -0500

Hey Folks,

I fleshed-out the Safari Extensions plist reading code into a report generator.

--
Best Regards,
Chris

------------------------------------------------------------------------------------------------
#       Author: Christopher Stone
#      Contact: email@hidden
#      Created: 2012-05-03 : 10:42
#     Modified: 2012-05-04 : 05:30
#  Application: Safari
#      Purpose: Report installed and enabled extensions.
# Dependencies: none
------------------------------------------------------------------------------------------------
on fDate() # Example: 2010.11.12 » 04.06.58
  set formattedDate to do shell script "date \"+%Y.%m.%d » %H.%M.%S\""
  return formattedDate
end fDate
------------------------------------------------------------------------------------------------
on joinList(listToJoin, deLimiter)
  set {oldTIDS, AppleScript's text item delimiters} to {AppleScript's text item delimiters, deLimiter}
  set joinedList to listToJoin as string
  set AppleScript's text item delimiters to oldTIDS
  return joinedList
end joinList
------------------------------------------------------------------------------------------------
try

  

  set reportPath to "~/Desktop/\"Safari Extension Report " & fDate() & ".txt\""
  set safariExtensionsPlist to "~/Library/Safari/Extensions/Extensions.plist"
  set sep to "------------------------------------------------"

  

  tell application "System Events"
    tell property list file safariExtensionsPlist

      

      tell property list item "Installed Extensions"
        tell (property list items where name of its property list items contains "Enabled")
          set enabledSafariExtansions to get value of property list item "Archive File Name"
        end tell
      end tell

      

      tell property list items of property list item "Installed Extensions"
        set installedSafariExtansions to get value of property list item "Archive File Name"
      end tell

      

    end tell
  end tell

  

  set enabledSafariExtansions to joinList(enabledSafariExtansions, linefeed)
  set enabledSafariExtansions to do shell script "sort <<< " & quoted form of enabledSafariExtansions without altering line endings
  set installedSafariExtansions to joinList(installedSafariExtansions, linefeed)
  set installedSafariExtansions to do shell script "sort <<< " & quoted form of installedSafariExtansions without altering line endings

  

  set reportText to {¬
    sep, ¬
    "SAFARI EXTENSIONS REPORT" & " » " & fDate(), ¬
    sep, ¬
    "ENABLED EXTENSIONS:", ¬
    sep, ¬
    enabledSafariExtansions, ¬
    sep, ¬
    "INSTALLED EXTENSIONS:", ¬
    sep, ¬
    installedSafariExtansions, ¬
    sep, ¬
    ""}

  

  set reportText to joinList(reportText, linefeed)
  do shell script "cat <<< " & (quoted form of reportText) & " > " & reportPath

  

  # Uncomment to open the report in TextEdit.
  # do shell script "open -a TextEdit " & reportPath

  

on error eMsg number eNum
  set {c, s} to {return, "------------------------------------------"}
  set e to s & c & "Error: " & eMsg & c & s & c & "Error Number: " & eNum & c & s
beep
display dialog e
end try
------------------------------------------------------------------------------------------------

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: Cannot open "On My Mac" mailboxes
  • Next by Date: Converting from ASS to ASOC
  • Previous by thread: Re: Create a 1 pdf of assets not using an app first
  • Next by thread: Converting from ASS to ASOC
  • Index(es):
    • Date
    • Thread