Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Debug command do not touch!
- --set cmd to ""
- -- Defines Properties (Non volatile variables)
- property ScriptVersion : "2.0alpha"
- property ScriptName : "XSysInfo"
- property ScriptHomepage : "http://xsysinfo.xeon3d.net/"
- property ScriptAuthor : "Xeon4D"
- property Contributors : "Aang"
- property IRCChannel : "irc://irc.wyldryde.org/#textual"
- property LatestVersionChecksumURL : "http://xsysinfo.xeon3d.net/files/textual/latestmd5"
- property ChangelogURL : "http://xsysinfo.xeon3d.net/files/textual/Changelog"
- property LatestScriptVersionURL : "http://xsysinfo.xeon3d.net/files/textual/latestversion"
- property LatestZipURLPrefix : "http://www.xeon3d.net/xsysinfo/files/textual/xsysinfo"
- property TemperatureAppURL : "http://xsysinfo.xeon3d.net/files/both/tempsupport.zip"
- property TemperatureAppChecksumURL : "http://xsysinfo.xeon3d.net/files/both/tempapp.md5"
- on textualcmd(cmd)
- -- Defines Global Variables
- global InAppPath
- global AppSupportFolder
- global TempAppPath
- global ZippedUpdatePath
- -- Initializes Global Variables
- --- Defines the folder where the script is bring run from.
- set InAppPath to the quoted form of (the POSIX path of (path to application id "com.codeux.irc.textual") & "Contents/Resources/Scripts/")
- --- Defines the path to the Scripts' Folder in the Application Support in the current User's Library
- set AppSupportFolder to the quoted form of (the POSIX path of (path to application support from the user domain) & "Textual/Scripts")
- --- Defines the path to the Temperature Reporting App
- set TempAppPath to the quoted form of (the POSIX path of (path to application support from the user domain) & "Textual/Scripts/tempmonitor")
- --- Defines the path to where the zip file containing the update will be downloaded.
- set ZippedUpdatePath to the quoted form of (the POSIX path of (path to temporary items from the user domain) & "update.zip")
- --- Defines the latest available script version
- set LatestScriptVersion to do shell script "curl " & LatestScriptVersionURL
- --- Defines the latest available script version's zip file checksum
- set LatestVersionChecksum to do shell script "curl " & LatestVersionChecksumURL
- --- Defines the zip file URL of the latest version
- set LatestScriptZip to LatestZipURLPrefix & LatestScriptVersionURL & ".zip"
- -- Defines Formatting Stuff
- --- Initializes the Simple variable.
- set Simple to ""
- --- Colors
- set CBlack to (ASCII character 3) & "01"
- set CNBlue to (ASCII character 3) & "02"
- set CGreen to (ASCII character 3) & "03"
- set CRed to (ASCII character 3) & "04"
- set CBrown to (ASCII character 3) & "05"
- set CPurple to (ASCII character 3) & "06"
- set COrange to (ASCII character 3) & "07"
- set CYellow to (ASCII character 3) & "08"
- set CLGreen to (ASCII character 3) & "09"
- set CTeal to (ASCII character 3) & "10"
- set CCyan to (ASCII character 3) & "11"
- set CBlue to (ASCII character 3) & "12"
- set CPink to (ASCII character 3) & "13"
- set CGrey to (ASCII character 3) & "14"
- set CLGrey to (ASCII character 3) & "15"
- set CWhite to (ASCII character 3)
- set NoColor to (ASCII character 0)
- --- Formatting
- set FBold to (ASCII character 2)
- set FItalic to (ASCII character 1)
- -- Defines the Bars' Colors
- set UsedColor to CGreen
- set FreeColor to CRed
- set SeparatorColor to NoColor
- -- Removes formatting from output.
- if (cmd contains "simple") or (Simple is true or Simple is "True") then
- set UsedColor to ""
- set FreeColor to ""
- set CWhite to ""
- set FBold to ""
- set FItalic to ""
- end if
- -- Trying to read user set options, and if not write the default values for them.
- -- This regards showing the final dot/separator.
- try
- set HideFinalDot to do shell script "defaults read xeon3d.xsysinfo hidefinaldot"
- on error
- try
- do shell script ("defaults write xeon3d.xsysinfo hidefinaldot True")
- set HideFinalDot to "True"
- on error
- set msg to "/echo There was an error writing defaults hidefinaldot"
- return msg
- end try
- end try
- -- This regards if it takes into account every mounted disk/net share or just the startupdisk
- try
- set ShowAllDisks to do shell script "defaults read xeon3d.xsysinfo alldisks"
- on error
- try
- do shell script ("defaults write xeon3d.xsysinfo alldisks False")
- set ShowAllDisks to "False"
- on error
- set msg to "/echo There was an error with the ShowAllDisks variable"
- return msg
- end try
- end try
- -- This regards if the Textual Build version is shown or not
- try
- set ViewTextualBuild to do shell script "defaults read xeon3d.xsysinfo viewtextualbuild"
- on error
- try
- do shell script ("defaults write xeon3d.xsysinfo viewtextualbuild False")
- set ViewTextualBuild to "False"
- on error
- set msg to "/echo There was an error with the ViewTextualBuild variable"
- return msg
- end try
- end try
- -- This regards if the script's output is formatted or not
- try
- set Simple to do shell script "defaults read xeon3d.xsysinfo simple"
- on error
- try
- do shell script ("defaults write xeon3d.xsysinfo simple False")
- set Simple to "False"
- on error
- set msg to "/echo There was an error with the Simple variable"
- return msg
- end try
- end try
- -- This regards if the temperatures are shown by default or not
- try
- set EnableTemps to do shell script "defaults read xeon3d.xsysinfo showtemps"
- on error
- try
- do shell script ("defaults write xeon3d.xsysinfo showtemps False")
- set EnableTemps to "False"
- on error
- set msg to "/echo There was an error with the EnableTemps variable"
- return msg
- end try
- end try
- -- This regards if the script should warn the user about an available update at runtime.
- try
- set AutomaticUpdateChecker to do shell script "defaults read xeon3d.xsysinfo autocheckupdate"
- on error
- try
- do shell script ("defaults write xeon3d.xsysinfo autocheckupdate False")
- set AutomaticUpdateChecker to "False"
- on error
- set msg to "/echo There was an error with the AutomaticUpdateChecker variable"
- return msg
- end try
- end try
- if cmd is "" or cmd is "simple" then --Default output when no options or just "simple" is supplied at runtime (edit to taste)
- set ViewMac to true
- set ViewCPU to true
- set ViewCurrentCPUSpeed to false
- set ViewCap to false
- set ViewCache to false
- set ViewFSB to false
- if EnableTemps is "True" then
- set ViewTemp to true
- else
- set ViewTemp to false
- end if
- set ViewRam to true
- set ViewBars to true
- set ViewDisk to true
- set ViewDisplay to true
- set ViewGFXBus to false
- set ViewResolutions to true
- set ViewAudio to false
- set ViewPower to true
- set ViewOSXVersion to true
- set ViewOSXArch to true
- set ViewOSXBuild to true
- set ViewKernel to false
- set ViewKernelBuild to false
- set ViewUptime to true
- set ViewClient to true
- set ViewScriptVersion to true
- --The start of the script (edit below this and I wont help you) - MOST THINGS WILL BREAK IF YOU CHANGE ANYTHING BELOW THIS.
- else --Toggled output
- set ViewMac to (cmd contains "mac")
- set ViewCPU to (cmd contains "cpu")
- if ViewCPU then
- set ViewCurrentCPUSpeed to (cmd contains "speed")
- set ViewCap to (cmd contains "cap")
- set ViewCache to (cmd contains "cache")
- end if
- set ViewFSB to (cmd contains "fsb")
- set ViewTemp to (cmd contains "temp")
- set ViewRam to (cmd contains "ram")
- set ViewBars to (cmd contains "bar")
- set ViewDisk to (cmd contains "disk")
- set ViewDisplay to (cmd contains "gpu" or cmd contains "graphics" or cmd contains "video")
- set ViewGFXBus to (cmd contains "gpu" or cmd contains "graphics" or cmd contains "video" and cmd contains "bus")
- set ViewResolutions to (cmd contains "gpu" or cmd contains "graphics" or cmd contains "video" and cmd contains "res")
- set ViewAudio to (cmd contains "audio" or cmd contains "sound")
- set ViewPower to (cmd contains "power")
- set ViewOSXVersion to (cmd contains "osx")
- set ViewOSXBuild to (cmd contains "osx" and cmd contains "build")
- set ViewOSXArch to (cmd contains "osx" and cmd contains "arch")
- set ViewKernel to (cmd contains "kernel")
- set ViewKernelBuildTag to (cmd contains "kernel" and cmd contains "tag")
- set ViewUptime to (cmd contains "uptime")
- set ViewClient to (cmd contains "client")
- set ViewScriptVersion to (cmd contains "script")
- if cmd is "version" then
- if ScriptVersion contains "beta" or ScriptVersion contains "alpha" then
- set msg to "Script Version: " & ScriptName & space & ScriptVersion & " for Textual by " & ScriptAuthor & " (" & IRCChannel & "). For Beta-Testers Only."
- else
- set msg to "Script Version: " & ScriptName & space & ScriptVersion & " for Textual by " & ScriptAuthor & ". Get it @ " & ScriptHomepage
- end if
- return msg
- end if
- end if
- if cmd is "options" then
- set msg to "/echo Possible Options:" & nl & ¬
- "/echo To change an option type '/xsysinfo <option name> toggle'. Example: /xsysinfo simple toggle " & nl & ¬
- "/echo • hidefinaldot - Defines if the final dot (separator) is shown." & FBold & " - Current Status: " & FBold & CRed & HideFinalDot & nl & ¬
- "/echo • alldisks - Defines if the script considers every mounted disk / net share as available disk space or not." & FBold & " - Current Status: " & FBold & CRed & allDisks & nl & ¬
- "/echo • viewtextualbuild - Defines if the Textual Build version is shown." & FBold & " - Current Status: " & FBold & CRed & ViewTextualBuild & nl & ¬
- "/echo • simple - Defines if the formatting is removed from the output of the script." & FBold & " - Current Status: " & FBold & CRed & Simple & nl & ¬
- "/echo • showtemps - Defines if the script shows temperatures." & FBold & " - Current Status: " & FBold & CRed & showtemps & nl & ¬
- "/echo • autocheckupdate - Defines if the script checks for updates at each time it runs." & FBold & " - Current Status: " & FBold & CRed & autocheckupdate
- return msg
- end if
- if cmd is "hidefinaldot" then
- if HideFinalDot is "True" then
- set msg to "/echo The last dot (separator) is currently " & FBold & "NOT" & FBold & " being shown. To change this type '/xsysinfo hidefinaldot toggle'"
- return msg
- else if HideFinalDot is "False" then
- set msg to "/echo The last dot (separator) is currently " & FBold & "BEING" & FBold & " shown. To change this type '/xsysinfo hidefinaldot toggle'"
- return msg
- end if
- end if
- if cmd is "hidefinaldot toggle" then
- if HideFinalDot is "True" then
- do shell script "defaults write xeon3d.xsysinfo hidefinaldot False"
- return "/echo The final dot (separator) is now being SHOWN!"
- else if HideFinalDot is "False" then
- do shell script "defaults write xeon3d.xsysinfo hidefinaldot True"
- return "/echo The final dot (separator) is now being HIDDEN!"
- end if
- end if
- if cmd is "alldisks" then
- if ShowAllDisks is "True" then
- set msg to "/echo The script will use " & FBold & "All mounted disks" & FBold & ". To change this type '/xsysinfo alldisks toggle'"
- return msg
- else if ShowAllDisks is "False" then
- set msg to "/echo The script will use " & FBold & "the Startup disk only" & FBold & ". To change this type '/xsysinfo alldisks toggle'"
- return msg
- end if
- end if
- if cmd is "alldisks toggle" then
- if ShowAllDisks is "True" then
- do shell script "defaults write xeon3d.xsysinfo alldisks False"
- return "/echo The script will now use the Startup disk only!"
- else if ShowAllDisks is "False" then
- do shell script "defaults write xeon3d.xsysinfo alldisks True"
- return "/echo The script will now use all mounted disks!"
- end if
- end if
- if cmd is "viewtextualbuild" then
- if ViewTextualBuild is "True" then
- set msg to "/echo The script will " & FBold & "show" & FBold & " Textual's Build Version. To change this type '/xsysinfo ViewTextualBuild toggle'"
- return msg
- else if ViewTextualBuild is "False" then
- set msg to "/echo The script " & FBold & "won't show" & FBold & " Textual's Build Version. To change this type '/xsysinfo ViewTextualBuild toggle'"
- return msg
- end if
- end if
- if cmd is "viewtextualbuild toggle" then
- if ViewTextualBuild is "True" then
- do shell script "defaults write xeon3d.xsysinfo viewtextualbuild False"
- return "/echo The script " & FBold & "won't show" & FBold & " Textual's Build Version."
- else
- do shell script "defaults write xeon3d.xsysinfo viewtextualbuild True"
- return "/echo The script will " & FBold & "show" & FBold & " Textual's Build Version."
- end if
- end if
- if cmd is "simple" then
- if Simple is "True" then
- set msg to "/echo The script " & FBold & "will remove" & FBold & " the formatting from the output. To change this type '/xsysinfo simple toggle'"
- return msg
- else if Simple is "False" then
- set msg to "/echo The script " & FBold & "won't remove" & FBold & " the formatting from the output. To change this type '/xsysinfo simple toggle'"
- return msg
- end if
- end if
- if cmd is "simple toggle" then
- if Simple is "True" then
- do shell script "defaults write xeon3d.xsysinfo simple False"
- return "/echo The script " & FBold & "won't remove" & FBold & " the formatting from the output."
- else if Simple is "False" then
- do shell script "defaults write xeon3d.xsysinfo simple True"
- return "/echo The script " & FBold & "will remove" & FBold & " the formatting from the output."
- end if
- end if
- if cmd is "showtemps" then
- if showtemps is "True" then
- set msg to "/echo The script will " & FBold & "show" & FBold & " temperatures. To change this type '/xsysinfo showtemps toggle'"
- return msg
- else if showtemps is "False" then
- set msg to "/echo The script will " & FBold & "not show" & FBold & " temperatures. To change this type '/xsysinfo showtemps toggle'"
- return msg
- end if
- end if
- if cmd is "showtemps toggle" then
- if showtemps is "True" then
- do shell script "defaults write xeon3d.xsysinfo showtemps False"
- return "/echo The script will now " & FBold & "not show" & FBold & " temperatures."
- else if showtemps is "False" then
- do shell script "defaults write xeon3d.xsysinfo showtemps True"
- return "/echo The script will now " & FBold & "show" & FBold & " temperatures."
- end if
- end if
- if cmd is "autocheckupdate" then
- if AutomaticUpdateChecker is "True" then
- set msg to "/echo The script will " & FBold & "check" & FBold & " for updates at runtime. To change this type '/xsysinfo autocheckupdate toggle'"
- return msg
- else if AutomaticUpdateChecker is "False" then
- set msg to "/echo The script will " & FBold & "not check" & FBold & " for updates at runtime. To change this type '/xsysinfo autocheckupdate toggle'"
- return msg
- end if
- end if
- if cmd is "autocheckupdate toggle" then
- if AutomaticUpdateChecker is "True" then
- do shell script "defaults write xeon3d.xsysinfo autocheckupdate False"
- return "/echo The script " & FBold & "will not check" & FBold & " for updates at runtime."
- else if AutomaticUpdateChecker is "False" then
- do shell script "defaults write xeon3d.xsysinfo autocheckupdate True"
- return "/echo The script " & FBold & "will check" & FBold & " for updates at runtime."
- end if
- end if
- if cmd is "installtemp" then
- set tempappMD5 to do shell script "curl http://www.xeon3d.net/xsysinfo/files/both/tempapp.md5"
- set tempappURL to "http://www.xeon3d.net/xsysinfo/files/both/tempsupport.zip"
- do shell script "rm -f " & qtempapppath
- set DownloadNewVersion to do shell script "curl -C - " & tempappURL & " -o /tmp/tempsupport.zip"
- if tempappMD5 is not (do shell script "md5 -q /tmp/tempsupport.zip") then
- if tempappMD5 contains "DOCTYPE" then
- return "/debug echo Error installing Temperature Support. Please try again later or download manually from here: http://xsysinfo.xeon3d.net/files/both/tempsupport.zip " & nl & "/debug echo Cannot access the tempappMD5 file."
- end if
- return "/debug echo Error installing Temperature Support. Please try again later or download download manually from here: http://xsysinfo.xeon3d.net/files/both/tempsupport.zip " & nl & "/debug echo Online MD5: " & LatestVersionMD5 & nl & "/debug echo Local MD5: " & (do shell script "md5 -q /tmp/tempsupport.zip")
- end if
- set InstallUpdateResult to do shell script "unzip -o /tmp/tempsupport.zip -d " & qaspath
- -- Debug command!
- -- return InstallUpdateResult
- if InstallUpdateResult contains "inflating:" then
- set ResultMessage to "/echo Successefully installed Temperature Support!"
- return ResultMessage
- else if InstallUpdateResult contains "cannot" then
- set ResultMessage to "/echo Error installing Temperature Support! Try again later!"
- return ResultMessage
- end if
- end if
- -- Update "engine" 2.2
- if cmd is "update" then
- if LatestScriptVersion contains "DOCTYPE" then
- return "/debug echo Error getting the latest" & ScriptName & " version number. Please try again later or download newest version here: http://xsysinfo.xeon3d.net "
- end if
- if LatestScriptVersion is greater than ScriptVersion then
- do shell script "rm -f " & ZippedUpdatePath
- set DownloadNewVersion to do shell script "curl -C - " & LatestScriptZip & " -o " & ZippedUpdatePath
- if LatestVersionChecksum is not (do shell script "md5 -q " & ZippedUpdatePath) then
- if LatestVersionChecksum contains "DOCTYPE" then
- return "/debug echo Error getting the online checksum for the latest " & ScriptName & "version. Please try again later or download newest version here: http://xsysinfo.xeon3d.net "
- end if
- return "/debug echo Error updating XSysInfo. Please try again later or download newest version here: http://xsysinfo.xeon3d.net " & nl & "/debug echo Checksum's don't match: Online MD5: " & LatestVersionChecksum & nl & "/debug echo Local MD5: " & (do shell script "md5 -q " & ZippedUpdatePath)
- end if
- set InstallUpdateResult to do shell script "unzip -o " & ZippedUpdatePath & " -d " & AppSupportFolder
- -- Debug command!
- -- return InstallUpdateResult
- if InstallUpdateResult contains "inflating:" then
- set ResultMessage to "/echo Successefully updated XSysInfo to version " & LatestScriptVersion & " from " & ScriptVersion & "." & nl & "/echo Changelog: " & ChangelogURL
- return ResultMessage
- else if InstallUpdateResult contains "cannot" then
- set ResultMessage to "/echo Error extracting XSysInfo."
- return ResultMessage
- end if
- else if LatestScriptVersion is equal to ScriptVersion then
- set ResultMessage to "/echo XSysInfo is already up to date. (Your script version: " & ScriptVersion & "; Latest released script version: " & LatestScriptVersion & ")"
- return ResultMessage
- else if ScriptVersion is greater than LatestScriptVersion then
- set ResultMessage to "/echo Your copy of XSysInfo is newer than the last released version. (Your script version: " & ScriptVersion & "; Latest released script version: " & LatestScriptVersion & ")"
- return ResultMessage
- end if
- end if
- if cmd is "refresh" then
- tell application "Finder"
- if exists POSIX file "/tmp/SPHardwareDataType.txt" then
- do shell script "rm -rf /tmp/SPHardwareDataType.txt"
- end if
- if exists POSIX file "/tmp/SPDisplaysDataType.txt" then
- do shell script "rm -rf /tmp/SPDisplaysDataType.txt"
- end if
- end tell
- end if
- if cmd is "help" then
- set helpmsg to "/echo " & FBold & "Usage:" & FBold & " /xsysinfo [labels] [simple]" & nl & ¬
- "/echo If run without arguments, it'll show a predefined set of system details that can be customized by typing '/xsysinfo options'" & nl & ¬
- "/echo Possible labels:" & nl & "/echo mac, cpu, speed, cap, cache, fsb, temp, ram, bar, mem, hd, gpu, res, audio, power, osxversion, osxbuild, kernel, kernarch, kernbuild, uptime, client." & nl & ¬
- "/echo There are also some special labels: 'about' shows some info about the script; " & nl & ¬
- "/echo The 'simple' label makes the script output without any formatting (colors, bold, etc...); " & nl & ¬
- "/echo The 'update' label updates the script and the 'version' label displays the current version."
- return helpmsg
- end if
- if cmd is "about" then
- set helpmsg to "/echo XSysInfo " & currentversion & " - A System Information Script for the Textual IRC Client" & nl & ¬
- "/echo Homepage: http://xsysinfo.xeon3d.net / http://www.xeon3d.net" & nl & ¬
- "/echo Coded by Marcos Alves - xeon3d@xeon3d.net - Xeon3D @ irc://irc.wyldryde.org/#textual" & nl & ¬
- "/echo Loosely based on KSysInfo for Linkinus by KanadaKid" & nl & ¬
- "/echo Some code/fixes by Aang / ePirat @ irc://irc.wyldryde.org/#textual" & nl & ¬
- "/echo Many thanks for the #textual users for testing/using it and reporting bugs. Keep 'em coming!"
- return helpmsg
- end if
- tell application "Finder"
- set msg to ""
- --debug command
- --set viewtemp to true
- if AutomaticUpdateChecker is "True" then
- if LatestScriptVersion is greater than ScriptVersion then
- set msg to "/echo Info: XSysInfo " & FBold & LatestScriptVersion & FBold & " has been released. You're currently running XSysInfo " & FBold & ScriptVersion & FBold & "." & nl & "/echo To update to the latest version type '/xsysinfo update' (without the quotes). To disable this check type '/xsysinfo autocheckupdate'." & nl & msg
- end if
- end if
- if exists POSIX file "/tmp/SPHardwareDataType.txt" then
- else
- set listDataTypes to do shell script "system_profiler -listdatatypes"
- if listDataTypes contains "SPHardwareDataType" then
- do shell script "system_profiler SPHardwareDataType > /tmp/SPHardwareDataType.txt"
- else
- do shell script "system_profiler > /tmp/SPHardwareDataType.txt"
- end if
- end if
- --Temperature support
- if ViewTemp is true then
- -- return quoted form of tempapppath
- try
- set checkfortempsupport to (do shell script "if [ -f " & TempAppPath & " ] ; then exit 0 ; else exit 1 ; fi")
- set tempsupportinstalled to true
- on error theError
- set tempsupportinstalled to false
- end try
- if tempsupportinstalled is true then
- set cpuresult to do shell script TempAppPath & " -l -a -c | grep 'SMC CPU A PROXIMITY' | awk '{print $5}'"
- set hdresult to do shell script TempAppPath & " -l -a -c | grep 'SMART Disk' | head -n1 | awk '{print $5}'"
- else
- return "/echo Temperature Support is not installed. Please run " & FBold & "/xsysinfo installtemp" & FBold & " to install it."
- end if
- --Debug Command
- --set CPUResult to "68"
- end if
- --Mac Model
- if ViewMac is true then
- set machineName to do shell script "sysctl -n hw.model"
- if machineName is "iMac4,1" then
- set MacModel to "iMac (Early 2006)"
- else if machineName is "iMac4,2" then
- set MacModel to "iMac (Mid 2006)"
- else if machineName is "iMac5,2" then
- set MacModel to "iMac (Late 2006 CD)"
- else if machineName is "iMac5,1" then
- set MacModel to "iMac (Late 2006)"
- else if machineName is "iMac6,1" then
- set MacModel to "iMac (24-inch Late 2006)"
- else if machineName is "iMac7,1" then
- set MacModel to "iMac (Mid 2007)"
- else if machineName is "iMac8,1" then
- set MacModel to "iMac (Early 2008)"
- else if machineName is "iMac9,1" then
- set MacModel to "iMac (2009)"
- else if machineName is "iMac10,1" then
- set MacModel to "iMac (Late 2009 C2D)"
- else if machineName is "iMac11,1" then
- set MacModel to "iMac (Late 2009 Core iX)"
- else if machineName is "iMac11,2" then
- set MacModel to "iMac (Mid 2010 21.5')"
- else if machineName is "iMac11,3" then
- set MacModel to "iMac (Mid 2010 27')"
- else if machineName is "iMac12,1" then
- set MacModel to "iMac (Mid 2011 21.5')"
- else if machineName is "iMac12,2" then
- set MacModel to "iMac (Mid 2011 27')"
- -- Mac Minis
- else if machineName is "Macmini1,1" then
- set MacModel to "Mac Mini (2006)"
- else if machineName is "Macmini2,1" then
- set MacModel to "Mac Mini (2007)"
- else if machineName is "Macmini3,1" then
- set MacModel to "Mac Mini (2009)"
- else if machineName is "Macmini4,1" then
- set MacModel to "Mac Mini (2010)"
- -- Mac Pros
- else if machineName is "MacPro1,1" then
- set MacModel to "Mac Pro (Original)"
- else if machineName is "MacPro2,1" then
- set MacModel to "Mac Pro (2007 8-core)"
- else if machineName is "MacPro3,1" then
- set MacModel to "Mac Pro (Early 2008)"
- else if machineName is "MacPro4,1" then
- set MacModel to "Mac Pro (Early 2009)"
- else if machineName is "MacPro5,1" then
- set MacModel to "Mac Pro (Mid 2010)"
- -- MacBooks
- else if machineName is "MacBook1,1" then
- set MacModel to "MacBook (Original 2006)"
- else if machineName is "MacBook2,1" then
- set MacModel to "MacBook (2006/7)"
- else if machineName is "MacBook3,1" then
- set MacModel to "MacBook (Late 2007)"
- else if machineName is "MacBook4,1" then
- set MacModel to "MacBook (2008)"
- else if machineName is "MacBook5,1" then
- set MacModel to "MacBook (Late 2008, Aluminum)"
- else if machineName is "MacBook5,2" then
- set MacModel to "MacBook (2009)"
- else if machineName is "MacBook6,1" then
- set MacModel to "MacBook (Late 2009)"
- else if machineName is "MacBook7,1" then
- set MacModel to "MacBook (Mid 2010)"
- --MacBook Airs
- else if machineName is "MacBookAir1,1" then
- set MacModel to "MacBook Air (Original)"
- else if machineName is "MacBookAir2,1" then
- set MacModel to "MacBook Air (2008/9)"
- else if machineName is "MacBookAir3,1" then
- set MacModel to "MacBook Air (Late 2010, 11')"
- else if machineName is "MacBookAir3,2" then
- set MacModel to "MacBook Air (Late 2010, 13')"
- --MacBook Pros
- else if machineName is "MacBookPro1,1" then
- set MacModel to "MacBook Pro (Original)"
- else if machineName is "MacBookPro1,2" then
- set MacModel to "MacBook Pro (Original 17')"
- else if machineName is "MacBookPro2,2" then
- set MacModel to "MacBook Pro (C2D 15')"
- else if machineName is "MacBookPro2,1" then
- set MacModel to "MacBook Pro (C2D 17')"
- else if machineName is "MacBookPro3,1" then
- set MacModel to "MacBook Pro (2007)"
- else if machineName is "MacBookPro4,1" then
- set MacModel to "MacBook Pro (2008)"
- else if machineName is "MacBookPro5,1" then
- set MacModel to "MacBook Pro (Late 2008)"
- else if machineName is "MacBookPro5,5" then
- set MacModel to "MacBook Pro (Mid 2009, 13')"
- else if machineName is "MacBookPro5,4" then
- set MacModel to "MacBook Pro (Mid 2009, 15')"
- else if machineName is "MacBookPro5,3" then
- set MacModel to "MacBook Pro (Mid 2009, 15')"
- else if machineName is "MacBookPro5,2" then
- set MacModel to "MacBook Pro (2009, 17')"
- else if machineName is "MacBookPro7,1" then
- set MacModel to "MacBook Pro (Mid 2010, 13')"
- else if machineName is "MacBookPro6,2" then
- set MacModel to "MacBook Pro (Mid 2010, 15')"
- else if machineName is "MacBookPro6,1" then
- set MacModel to "MacBook Pro (Mid 2010, 17')"
- else if machineName is "MacBookPro8,1" then
- set MacModel to "MacBook Pro (Early 2011, 13')"
- else if machineName is "MacBookPro8,2" then
- set MacModel to "MacBook Pro (Early 2011, 15')"
- else if machineName is "MacBookPro8,3" then
- set MacModel to "MacBook Pro (Early 2011, 17')"
- -- xServes
- else if machineName is "Xserve1,1" then
- set MacModel to "Xserve (Original)"
- else if machineName is "Xserve2,1" then
- set MacModel to "Xserve (Early 2008)"
- else if machineName is "Xserve3,1" then
- set MacModel to "Xserve (Early 2009)"
- else if machineName is "" then
- set MacModel to "Unknown"
- else
- set MacModel to machineName
- end if
- set msg to msg & FBold & "Mac: " & FBold & MacModel & " • "
- end if
- --CPU Info
- if ViewCPU is true then
- set corecheck to do shell script "sysctl -n machdep.cpu.cores_per_package"
- set msg to msg & FBold & "CPU: " & FBold
- set cputype to do shell script "sysctl machdep.cpu.brand_string | awk '{ print $2,$3,$4,$5,$6,$7,$8,$9 }'"
- repeat
- if cputype contains "@ " then
- set AppleScript's text item delimiters to "@ "
- set cpu1 to text item 1 of cputype
- set cpu2 to text items 2 thru end of cputype
- set cputype to cpu1 & cpu2
- else
- exit repeat
- end if
- end repeat
- repeat
- if cputype contains "(R)" then
- set AppleScript's text item delimiters to "(R)"
- set cpu1 to text item 1 of cputype
- set cpu2 to text items 2 thru end of cputype
- set cputype to cpu1 & cpu2
- else
- exit repeat
- end if
- end repeat
- repeat
- if cputype contains "Processor " then
- set AppleScript's text item delimiters to "Processor "
- set cpu1 to text item 1 of cputype
- set cpu2 to text items 2 thru end of cputype
- set cputype to cpu1 & cpu2
- else
- exit repeat
- end if
- end repeat
- repeat
- if cputype contains "CPU " then
- set AppleScript's text item delimiters to "CPU "
- set cpu1 to text item 1 of cputype
- set cpu2 to text items 2 thru end of cputype
- set cputype to cpu1 & cpu2
- else
- exit repeat
- end if
- end repeat
- repeat
- if cputype contains "(TM)" then
- set AppleScript's text item delimiters to "(TM)"
- set cpu1 to text item 1 of cputype
- set cpu2 to text items 2 thru end of cputype
- set cputype to cpu1 & cpu2
- else
- exit repeat
- end if
- end repeat
- if cputype contains "GHz" then
- set AppleScript's text item delimiters to "GHz"
- set cputype to text item 1 of cputype & "GHz"
- end if
- set msg to msg & cputype
- --Current CPU Speed
- if ViewCurrentCPUSpeed is true then
- set cpufreq to do shell script "sysctl -n hw.cpufrequency"
- if cpufreq / 1000000 ≥ 990 then
- set temp to (cpufreq / 100000000) / 10
- set msg to msg & " @ " & "" & (round temp * 100) / 100 & "GHz"
- else
- set temp to (cpufreq / 1000000)
- set msg to msg & " @ " & "" & (round temp * 100) / 100 & "MHz"
- end if
- end if
- --CPU Features
- if ViewCap is true then
- set features to do shell script "sysctl -n machdep.cpu.features"
- set extfeatures to do shell script "sysctl -n machdep.cpu.extfeatures"
- set logicalcheck to do shell script "sysctl -n machdep.cpu.logical_per_package"
- set msg to msg & " ["
- if features contains "SSE3" then
- set msg to msg & "SSE3"
- else
- set msg to msg & "SSE2"
- end if
- if features contains "SSSE3" then
- set msg to msg & "" & "/SSSE3"
- end if
- if features contains "PAE" then
- set msg to msg & "" & "/PAE"
- end if
- if extfeatures contains "XD" then
- if cputype contains "AMD" then
- set msg to msg & "" & "/NX"
- else
- set msg to msg & "" & "/XD"
- end if
- end if
- if features contains "MMX" then
- if cputype contains "AMD" then
- set msg to msg & "" & "/3DNow!"
- end if
- end if
- if features contains "EST" then
- if cputype contains "AMD" then
- set msg to msg & "" & "/PowerNow!"
- else
- set msg to msg & "" & "/EST"
- end if
- end if
- if features contains "VMX" then
- set msg to msg & "" & "/VMX"
- end if
- if extfeatures contains "EM64T" then
- if cputype contains "AMD" then
- set msg to msg & "" & "/AMD64"
- else
- set msg to msg & "" & "/EM64T"
- end if
- end if
- if logicalcheck contains 2 then
- if corecheck contains 0 then
- if cputype contains "AMD" then
- set msg to msg & "" & "/DualCore"
- else
- set msg to msg & "" & "/HTT"
- end if
- end if
- if corecheck contains 1 then
- if cputype contains "AMD" then
- set msg to msg & "" & "/DualCore"
- else
- set msg to msg & "" & "/HTT"
- end if
- end if
- if corecheck contains 2 then
- if cputype does not contain "Intel Pentium M" then
- set msg to msg & "" & "/DualCore"
- end if
- end if
- end if
- if corecheck is "4" then
- set msg to msg & "" & "/QuadCore"
- end if
- if corecheck contains 6 then
- set msg to msg & "" & "/SixCore"
- end if
- if corecheck contains 8 then
- set msg to msg & "" & "/OctoCore"
- end if
- set msg to msg & "]"
- end if
- --CPU Temps
- if ViewTemp is true then
- if cpuresult is "" then
- set msg to msg
- else
- set msg to msg & FBold & " Temp: " & FBold & cpuresult & "ºC"
- end if
- else
- set msg to msg
- end if
- set msg to msg & " • "
- end if
- -- Note: All the above are inside the ViewCPU block.
- --L2 Cache
- if ViewCache is true then
- set coreicheck to do shell script "sysctl machdep.cpu.brand_string"
- if coreicheck contains "Core(TM) i" then
- set cpucache to do shell script "sysctl -n hw.l3cachesize"
- set msg to msg & FBold & "L3: " & FBold & (round (cpucache / 1024 / 1024)) & "MiB • "
- else
- set cpucache to do shell script "sysctl -n hw.l2cachesize"
- set msg to msg & FBold & "L2: " & FBold & (round (cpucache / 1024 / 1024)) & "MiB • "
- end if
- end if
- --Front Side Bus
- if ViewFSB is true then
- set fsb to do shell script "sysctl -n hw.busfrequency"
- set fsbtype to do shell script "cat /tmp/SPHardwareDataType.txt"
- set temp to round (fsb / 1000000) rounding down
- if cputype contains "AMD" then
- set msg to msg & FBold & "HT:" & FBold
- set msg to msg & " " & temp & "MHz • "
- else if fsbtype contains "Interconnect" then
- set msg to msg & FBold & "QPI:" & FBold
- set msg to msg & " " & (temp / 1000) & " GT/s • "
- else
- set msg to msg & FBold & "FSB:" & FBold
- set msg to msg & " " & temp & " MT/s • "
- end if
- end if
- --Ram
- if ViewRam is true then
- set memtotal to do shell script "sysctl hw.memsize"
- set AppleScript's text item delimiters to ": "
- set memtotal to text item 2 of memtotal
- set memtotal to memtotal / 1024 / 1024 as integer
- set topresult to do shell script "top -l 1 | head -n 7 | tail -n 1"
- set AppleScript's text item delimiters to ", "
- set memitems to text items of topresult
- set AppleScript's text item delimiters to ""
- set usedmem to text item 4 of memitems
- set AppleScript's text item delimiters to "M"
- set usedmem to text item 1 of usedmem
- set mempercent to (usedmem / memtotal) * 100 as integer
- set mempercent to mempercent as text
- set activebar to round (mempercent / 10) rounding to nearest
- set activebar to activebar
- if memtotal ≥ 1024 then
- set memtotal to (memtotal round) / 1024
- set memmeasure to "GiB"
- else
- set memmeasure to "MiB"
- end if
- if usedmem ≥ 1024 then
- set usedmem to usedmem / 1024
- set usedmem to (round (usedmem * 100)) / 100
- set usedmeasure to "GiB"
- else
- set usedmem to (round (usedmem * 100)) / 100
- set usedmeasure to "MiB"
- end if
- set memspeed to do shell script "system_profiler SPMemoryDataType | grep 'Speed:' | awk '{ print $2,$3 }'"
- set AppleScript's text item delimiters to " MHz"
- set memspeed to text item 1 of memspeed
- if memspeed contains "Empty" then
- set AppleScript's text item delimiters to " "
- set memspeed to last text item of memspeed
- end if
- set msg to msg & FBold & "RAM: " & FBold & usedmem & usedmeasure & "/" & memtotal & memmeasure & " @ " & memspeed & "MHz"
- --RAMBar
- if ViewBars is true then
- set countervar to 0
- if activebar > 10 or activebar < 0 then
- return "Error!"
- else
- repeat until countervar = 10
- if activebar = 0 then
- set fullbar to FreeColor & "❙❙❙❙❙❙❙❙❙❙"
- set countervar to 10
- else if activebar = 10 then
- set fullbar to UsedColor & "❙❙❙❙❙❙❙❙❙❙"
- set countervar to 10
- else if activebar > 0 and activebar < 10 then
- set fullbar to UsedColor
- repeat activebar times
- set fullbar to fullbar & "❙"
- set activebar to (activebar - 1)
- set countervar to (countervar + 1)
- end repeat
- set fullbar to fullbar & SeparatorColor & "|" & FreeColor
- repeat (10 - countervar) times
- set fullbar to fullbar & "❙"
- set countervar to (countervar + 1)
- end repeat
- end if
- exit repeat
- end repeat
- end if
- set msg to msg & " [" & fullbar & CWhite & "]"
- end if
- set msg to msg & " • "
- end if
- --HDD
- if ViewDisk is true then
- set allFree to 0
- set allSpace to 0
- if ShowAllDisks is "True" then
- set myList to list disks
- repeat with i in myList
- set diskName to (i as string)
- try
- set freespace to round (the (free space of disk diskName) / 1024 / 1024)
- set totalspace to round (the (capacity of disk diskName) / 1024 / 1024)
- set allFree to allFree + freespace
- set allSpace to allSpace + totalspace
- end try
- end repeat
- set allUsed to allSpace - allFree
- else
- set allUsed to do shell script "df -k | tail +2 | awk '{print $3}' | tail -r | tail -1"
- set allUsed to (allUsed / 1024)
- set allSpace to do shell script "df -k | tail +2 | awk '{print $2}' | tail -r | tail -1"
- set allSpace to (allSpace / 1024)
- end if
- set hdpercent to round ((allUsed / allSpace) * 100) rounding to nearest
- set allUsed to allUsed / 1024
- set allUsed to (round allUsed * 100) / 100
- set allSpace to allSpace / 1024
- set allSpace to (round allSpace * 100) / 100
- if allUsed is greater than 1024 then
- set allUsed to allUsed / 1024
- set allUsed to (round allUsed * 100) / 100
- set usedunit to "TiB"
- else
- set usedunit to "GiB"
- end if
- if allSpace is greater than 1024 then
- set allSpace to allSpace / 1024
- set allSpace to (round allSpace * 100) / 100
- set spaceunit to "TiB"
- else
- set spaceunit to "GiB"
- end if
- if ViewBars is true then
- --Calculate and Draw bar size only if viewbars is true
- set hdbar to round (hdpercent / 10) rounding to nearest
- if hdbar = 0 then
- set hdfullbar to FreeColor & "❙❙❙❙❙❙❙❙❙❙" & CWhite
- else if hdbar = 1 then
- set hdfullbar to UsedColor & "❙" & SeparatorColor & "|" & FreeColor & "❙❙❙❙❙❙❙❙❙" & CWhite
- else if hdbar = 2 then
- set hdfullbar to UsedColor & "❙❙" & SeparatorColor & "|" & FreeColor & "❙❙❙❙❙❙❙❙" & CWhite
- else if hdbar = 3 then
- set hdfullbar to UsedColor & "❙❙❙" & SeparatorColor & "|" & FreeColor & "❙❙❙❙❙❙❙" & CWhite
- else if hdbar = 4 then
- set hdfullbar to UsedColor & "❙❙❙❙" & SeparatorColor & "|" & FreeColor & "❙❙❙❙❙❙" & CWhite
- else if hdbar = 5 then
- set hdfullbar to UsedColor & "❙❙❙❙❙" & SeparatorColor & "|" & FreeColor & "❙❙❙❙❙" & CWhite
- else if hdbar = 6 then
- set hdfullbar to UsedColor & "❙❙❙❙❙❙" & SeparatorColor & "|" & FreeColor & "❙❙❙❙" & CWhite
- else if hdbar = 7 then
- set hdfullbar to UsedColor & "❙❙❙❙❙❙❙" & SeparatorColor & "|" & FreeColor & "❙❙❙" & CWhite
- else if hdbar = 8 then
- set hdfullbar to UsedColor & "❙❙❙❙❙❙❙❙" & SeparatorColor & "|" & FreeColor & "❙❙" & CWhite
- else if hdbar = 9 then
- set hdfullbar to UsedColor & "❙❙❙❙❙❙❙❙❙" & SeparatorColor & "|" & FreeColor & "❙" & CWhite
- else if hdbar = 10 then
- set hdfullbar to UsedColor & "❙❙❙❙❙❙❙❙❙❙" & CWhite
- end if
- --HD Temperature
- if ViewTemp is true then
- if hdresult is "" then
- set msg to msg & FBold & "HD: " & FBold & allUsed & usedunit & "/" & allSpace & spaceunit & " [" & hdfullbar & "]"
- else
- set msg to msg & FBold & "HD: " & FBold & allUsed & usedunit & "/" & allSpace & spaceunit & " [" & hdfullbar & "] " & FBold & "Temp: " & FBold & hdresult & "ºC"
- end if
- else
- set msg to msg & FBold & "HD: " & FBold & allUsed & usedunit & "/" & allSpace & spaceunit & " [" & hdfullbar & "]"
- end if
- else
- if ViewTemp is true then
- if hdresult is "" then
- set msg to msg & FBold & "HD: " & FBold & allUsed & usedunit & "/" & allSpace & spaceunit
- else
- set msg to msg & FBold & "HD: " & FBold & allUsed & usedunit & "/" & allSpace & spaceunit & FBold & " Temp: " & FBold & hdresult & "ºC"
- end if
- else
- set msg to msg & FBold & "HD: " & FBold & allUsed & usedunit & "/" & allSpace & spaceunit
- end if
- end if
- set msg to msg & " • "
- end if
- --Display
- if ViewDisplay is true then
- if exists POSIX file "/tmp/SPDisplaysDataType.txt" then
- else
- do shell script "system_profiler SPDisplaysDataType > /tmp/SPDisplaysDataType.txt"
- end if
- set gfxcard to do shell script "cat /tmp/SPDisplaysDataType.txt | head | grep -a 'Chipset Model:'"
- set AppleScript's text item delimiters to ":"
- set gfxcard to text item 2 of gfxcard
- set msg to msg & FBold & "GPU:" & FBold & gfxcard & " "
- --GFXBus
- if ViewGFXBus is true then
- set bus to do shell script "cat /tmp/SPDisplaysDataType.txt | head | grep -a 'Bus:' | awk '{print $2}'"
- set msg to msg & "[" & bus & "] "
- end if
- --VRAM
- set vram to do shell script "cat /tmp/SPDisplaysDataType.txt | head | grep -a 'VRAM (Total):' | awk '{print $3 $4}'"
- set msg to msg & "[" & vram & "] "
- --Resolutions
- if ViewResolutions is true then
- set displaycheck to do shell script "cat /tmp/SPDisplaysDataType.txt | grep -a 'Resolution:' -c"
- if displaycheck contains "0" then
- set respretty to ""
- else
- if displaycheck contains "1" then
- --set resolution to do shell script "system_profiler SPDisplaysDataType | grep -a 'Resolution:'"
- set respretty to do shell script "cat /tmp/SPDisplaysDataType.txt | grep -a 'Resolution:' | awk '{print $2$3$4}' | head -n1"
- set msg to msg & FBold & "Res: " & FBold & respretty
- else
- --set resolution to do shell script "system_profiler SPDisplaysDataType | grep -a 'Resolution:'"
- set respretty to do shell script "cat /tmp/SPDisplaysDataType.txt | grep -a 'Resolution:' | awk '{print $2$3$4}' | head -n1"
- set respretty2 to do shell script "cat /tmp/SPDisplaysDataType.txt | grep -a 'Resolution:' | awk '{print $2$3$4}' | tail -n 1"
- set msg to msg & FBold & "Res: " & FBold & respretty & " & " & respretty2
- end if
- end if
- end if
- set msg to msg & " • "
- end if
- --Audio
- if ViewAudio is true then
- set kextstat to do shell script "kextstat"
- if kextstat contains "IOAudioFamily" then
- if kextstat contains "AC97" then
- set audio to "AC'97"
- else if kextstat contains "AppleHDA" then
- set audio to "Apple HDA"
- else if kextstat contains "AppleAzaliaAudio" then
- set audio to "Azalia"
- else if kextstat contains "AppleUSBAudio" then
- set audio to "SB Live! 24-Bit External"
- else if kextstat contains "voodoohda" then
- set audio to "VoodooHDA"
- else
- set audio to "Unknown"
- end if
- else
- set audio to "None"
- end if
- set msg to msg & FBold & "Audio: " & FBold & audio & " • "
- end if
- --Power
- if ViewPower is true then
- do shell script "pmset -g ps > /tmp/batstats"
- set pstats to do shell script "cat /tmp/batstats | tail -n1 | awk '{print $2,$3,$4}'"
- if pstats is "drawing from 'AC" then
- set msg to msg
- else
- set AppleScript's text item delimiters to ";"
- set pcharge to text item 1 of pstats
- set pstatus to text item 2 of pstats
- set timeleft to text item 3 of pstats as string
- if pstatus = " charging" then
- if timeleft is " (no" then
- set msg to msg & FBold & "Power: " & FBold & pcharge & " [charging]. • "
- else
- set msg to msg & FBold & "Power: " & FBold & pcharge & " [charging]," & timeleft & " left. • "
- end if
- else if pstatus = " discharging" then
- if timeleft is " (no" then
- set msg to msg & FBold & "Power: " & FBold & pcharge & " • "
- else
- set msg to msg & FBold & "Power: " & FBold & pcharge & "," & timeleft & " left. • "
- end if
- else if pstatus = " charged" then
- set msg to msg & FBold & "Power: " & FBold & pcharge & " • "
- end if
- end if
- end if
- --OS Version
- if ViewOSXVersion is true then
- set osxversion to do shell script "system_profiler SPSoftwareDataType | grep -a 'System Version:' | awk '{print $3,$4,$5,$6}'"
- set msg to msg & FBold & "OS: " & FBold & osxversion & " "
- if ViewOSXArch is true then
- set FindKernelArch to do shell script "uname -a"
- if FindKernelArch contains "x86_64" then
- set KernelArch to "64-bit"
- else if FindKernelArch contains "i386" then
- set KernelArch to "32-bit"
- else
- set KernelArch to "Unknown"
- end if
- set msg to msg & KernelArch & " "
- end if
- if ViewOSXBuild is true then
- set OSXBuild to do shell script "system_profiler SPSoftwareDataType | grep -a 'System Version:' | awk '{print $7}'"
- set msg to msg & OSXBuild & " "
- end if
- set msg to msg & "• "
- end if
- --Kernel Version
- if ViewKernel is true then
- set temp to do shell script "uname -v"
- set AppleScript's text item delimiters to ";"
- set temp to text item 2 of temp
- set AppleScript's text item delimiters to ":"
- set kernbuilder to text item 1 of temp
- if kernbuilder contains "made by" then
- set AppleScript's text item delimiters to "made by"
- set kernbuilder to text item 2 of kernbuilder
- end if
- if kernbuilder contains "root" then
- set kernbuilder to " Darwin"
- end if
- set kernver to do shell script "uname -r"
- set msg to msg & FBold & "Kernel:" & FBold & kernbuilder & " " & kernver
- if ViewKernelBuild = true then
- set xnupre to do shell script "uname -v"
- if xnupre contains "legacy" then
- -- for hacks with legacy kernels
- set xnubuild to do shell script "uname -v | awk '{print $11}' | cut -b 1-31"
- else if xnupre contains "11.0" then
- -- for OS X 10.7 Lion
- set xnubuild to do shell script "uname -v | awk '{print $11}' | cut -b 6-21"
- else
- -- for OS X 10.6 Snow Leopard
- set xnubuild to do shell script "uname -v | awk '{print $11}' | cut -b 6-20"
- end if
- set msg to msg & " " & "(" & xnubuild & ")"
- end if
- set msg to msg & " • "
- end if
- --Uptime
- if ViewUptime is true then
- set uptime to do shell script "uptime | awk '{sub(/.*up[ ]+/,\"\",$0) ; sub(/,[ ]+[0-9]+ user.*/,\"\",$0);sub(/,/,\"\",$0) ;print $0}'"
- repeat
- if uptime contains " " then
- set AppleScript's text item delimiters to " "
- set temp1 to text item 1 of uptime
- set temp2 to text items 2 thru end of uptime
- set uptime to temp1 & " " & temp2
- else
- exit repeat
- end if
- end repeat
- set msg to msg & FBold & "Uptime: " & FBold & uptime & " • "
- end if
- --Client
- if ViewClient is true then
- set linkver to version of application "Textual"
- if ViewTextualBuild is "True" then
- set linkpath to POSIX path of (path to application "Textual")
- set temp to do shell script "cat " & linkpath & "/Contents/Info.plist | grep Reference -A 1"
- set AppleScript's text item delimiters to "<string>"
- set temp to text item 2 of temp
- set AppleScript's text item delimiters to "</string>"
- set linkbuild to text item 1 of temp
- set msg to msg & FBold & "Client: " & FBold & "Textual " & linkver & " [" & linkbuild & "] • "
- else
- set msg to msg & FBold & "Client: " & FBold & "Textual " & linkver & " • "
- end if
- end if
- --Script Version
- if ViewScriptVersion is true then
- set msg to msg & FBold & "Script: " & FBold & "xsysinfo " & ScriptVersion & " • "
- end if
- --Remove last separator
- if HideFinalDot is "True" then
- repeat until msg does not end with " "
- set msg to text 1 thru -2 of msg
- end repeat
- repeat until msg does not end with "•"
- set msg to text 1 thru -2 of msg
- end repeat
- end if
- end tell
- return msg
- end textualcmd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement