I’m having this strange problem with my code. I can’t see what’s wrong, but obviously there’s something wrong. It shows up with an “Internal script error.” Here it is:
on runPilot()
if state of button "PilotDailyCheck" of tab view item "PilotTab" of tab view "Tabs" of window "main" is 1 then
set runDailyPilot to true
end if
if state of button "PilotWeeklyCheck" of tab view item "PilotTab" of tab view "Tabs" of window "main" is 1 then
set runWeeklyPilot to true
end if
if state of button "PilotMonthlyCheck" of tab view item "PilotTab" of tab view "Tabs" of window "main" is 1 then
set runMonthlyPilot to true
end if
if state of button "PilotUpdatePrebindingsCheck" of tab view item "PilotTab" of tab view "Tabs" of window "main" is 1 then
set runUpdatePrebidingsPilot to true
end if
if state of button "PilotRepairPermissionsCheck" of tab view item "PilotTab" of tab view "Tabs" of window "main" is 1 then
set runRepairPermissionsPilot to true
end if
if the state of button "PilotFlushLogsCheck" of tab view item "PilotTab" of tab view "Tabs" of window "main" is 1 then
set runFlushLogsPilot to true
end if
if the state of button "PilotFlushCachesCheck" of tab view item "PilotTab" of tab view "Tabs" of window "main" is 1 then
set runFlushCachesPilot to true
end if
set theDelta to -300
tell window "main"
set {x1, y1, x2, y2} to bounds
set bounds to {x1, (y1 - theDelta), x2, y2}
set indeterminate of progress indicator "ProgressBar" to true
set uses threaded animation of progress indicator "ProgressBar" to true
start progress indicator "ProgressBar"
set floating to true
end tell
if runDailyPilot is true then
set the contents of text field "StatusText" of window "main" to "Performing Daily Maintenance..."
do shell script "sh /etc/daily" password thePass with administrator privileges
end if
if runWeeklyPilot is true then
set the contents of text field "StatusText" of window "main" to "Performing Weekly Maintenance..."
do shell script "sh /etc/weekly" password thePass with administrator privileges
end if
if runMonthlyPilot is true then
set the contents of text field "StatusText" of window "main" to "Performing Monthly Maintenance..."
do shell script "sh /etc/monthly" password thePass with administrator privileges
end if
if runUpdatePrebindingsPilot is true then
set the contents of text field "StatusText" of window "main" to "Updating Prebindings..."
do shell script "update_prebinding -root / -force -verbose" password thePass with administrator privileges
end if
if runRepairPermissionsPilot is true then
set the contents of text field "StatusText" of window "main" of window "pilot" to "Repairing Disk Permissions..."
do shell script "diskutil repairPermissions /" password thePass with administrator privileges
end if
if runFlushLogsPilot is true then
set the contents of text field "StatusText" of window "main" to "Flushing Logs..."
do shell script "sudo rm -rf /Library/Logs/*.log" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Logs/AppleFileService/*" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Logs/DirectoryService/*" password thePass with administrator privileges
do shell script "sudo rm -rf ~/Library/Logs/*.log" password thePass with administrator privileges
set myshortname to system attribute "USER"
do shell script "sudo rm -rf /private/var/log/*.gz" password thePass with administrator privileges
do shell script "sudo rm -rf /private/var/log/httpd/*.gz" password thePass with administrator privileges
do shell script "sudo rm -rf /private/var/log/cups/*.gz" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Logs/*.gz" password thePass with administrator privileges
do shell script "sudo rm -rf /private/var/log/ppp/*.gz" password thePass with administrator privileges
do shell script "sudo rm -rf /private/var/log/samba/*.gz" password thePass with administrator privileges
do shell script "sudo rm -rf ~/Library/Logs/*.gz" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Logs/DirectoryService/DirectoryService.server.log.*" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Logs/AppleFileService/AppleFileService.log.*" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Logs/AppleFileService/AppleFileServiceError.log.*" password thePass with administrator privileges
do shell script ("sudo rm -rf /Library/Logs/Console/" & myshortname & "/console.log.*") password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Logs/CrashReporter/*" password thePass with administrator privileges
do shell script "rm -rf ~/Library/Logs/CrashReporter/*" password thePass with administrator privileges
end if
if runFlushCachesPilot is true then
set the contents of text field "PilotStatusText" of window "pilot" to "Flushing Caches..."
do shell script "rm -rf ~/Library/Caches/Safari/*"
do shell script "rm -rf ~/Library/Caches/OmniWeb/*"
do shell script "rm -rf ~/Library/Caches/com.omnigroup.OmniWeb5/Cache*"
do shell script "rm -rf ~/Library/Caches/MS*Internet*/*"
do shell script "rm -rf ~/Library/Preferences/MS*Internet/*"
do shell script "rm -rf ~/Library/Application*Support/Chimera/Profiles/*/*/Cache/*"
do shell script "rm -rf ~/Library/Preferences/iCab*Preferences/iCab*Cache/"
do shell script "rm -rf ~/Library/Mozilla/Profiles/*/*/Cache/"
do shell script "rm -rf ~/Library/Phoenix/Profiles/*/*/Cache/"
do shell script "rm -rf ~/Library/Preferences/Opera*/Cache*/"
do shell script "rm -rf ~/Library/Preferences/Explorer/Download*"
do shell script "rm -rf ~/Library/Preferences/Explorer*Control/Download*Cache"
do shell script "rm -rf ~/Library/Safari/Downloads.plist"
do shell script "rm -rf ~/Library/Preferences/iCab*Preferences/iCab*DL*"
do shell script "rm -rf ~/Library/Mozilla/Profiles/*/*/downloads.rdf"
do shell script "rm -rf ~/Library/Phoenix/Profiles/*/*/downloads.rdf"
do shell script "rm -rf /Library/Caches/com.apple.SoftwareUpdate/*"
do shell script "rm -rf ~/Library/Application*Support/WebFoundation/Cookies.plist"
do shell script "rm -rf ~/Library/Application*Support/Chimera/Profiles/*/*/cookies.txt"
do shell script "rm -rf ~/Library/Preferences/iCab*Preferences/iCab*Cookies"
do shell script "rm -rf ~/Library/Mozilla/Profiles/*/*/cookies.txt"
do shell script "rm -rf ~/Library/Application*Support/OmniWeb/Cookies.xml"
do shell script "rm -rf ~/Library/Preferences/Opera*/cookies*"
do shell script "rm -rf ~/Library/Phoenix/Profiles/*/*/cookies.txt"
do shell script "rm -rf ~/Library/Cookies/*"
do shell script "rm -rf ~/Library/Caches/com.apple.ATSServer.*"
do shell script "rm -rf ~/Library/Caches/com.apple.FCache*"
do shell script "rm -rf ~/Library/Caches/com.apple.helpui/*"
do shell script "rm -rf ~/Library/Caches/Mail/*"
do shell script "rm -rf ~/Library/Caches/com.apple.AddressBook/*"
do shell script "rm -rf ~/Library/Caches/Sherlock/*"
do shell script "rm -rf ~/Library/Caches/Calculator/*"
do shell script "rm -rf ~/Library/Caches/Software*/*"
do shell script "rm -rf ~/Library/Caches/System*/*"
do shell script "rm -rf ~/Library/Caches/iPhoto*/*"
do shell script "rm -rf ~/Library/Caches/com.apple.iCal/Temporary*/*"
do shell script "rm -rf ~/Library/Caches/com.apple.LaunchServices.UserCache.csstore"
do shell script "rm -rf ~/Library/Caches/com.apple.preferencepanes.cache"
do shell script "rm -rf ~/Library/Preferences/.LS*"
do shell script "rm -rf ~/Library/Caches/Desktop/*"
do shell script "sudo rm -rf /System/Library/Extensions.kextcache" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Caches/com.apple.ATS/*" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Caches/com.apple.colorsync.*" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Caches/com.apple.Components.*" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Caches/com.apple.dock.*" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Caches/com.apple.IntlDataCache.*" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Caches/com.apple.FCache*" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Caches/Desktop*Pictures/*" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Caches/com.apple.LaunchServices.*" password thePass with administrator privileges
do shell script "sudo rm -rf /System/Library/Caches/com.apple.FCacheSystemDomain" password thePass with administrator privileges
do shell script "sudo rm -rf /System/Library/Extensions.kextcache" password thePass with administrator privileges
do shell script "sudo rm -rf /Library/Caches/*" password thePass with administrator privileges
do shell script "sudo rm -rf /System/Library/Caches/*" password thePass with administrator privileges
do shell script "sudo rm -rf /private/var/vm/swapfile*" password thePass with administrator privileges
end if
set theDelta to 300
tell window "main"
set floating to false
stop progress indicator "ProgressBar"
set indeterminate of progress indicator "ProgressBar" to true
set the contents of progress indicator "ProgressBar" to 0
set the contents of text field "StatusText" to "Idle..."
set {x1, y1, x2, y2} to bounds
set bounds to {x1, (y1 - theDelta), x2, y2}
end tell
end runPilot