Script to copy SD Version IDs

This is a variation of script from Chris and Shane that puts the SD version and OS version on the clipboard. You can then paste it into a forum message so readers know which SD and OS versions your report relates to. This new version accounts for having two different versions of SD installed (SD6 and SD7) which could be relevant.

This is what the output looks like:
–> Script Debugger 6.0.7 (6A217)
–> Script Debugger 7.0 (7A25)
–> Mac OS 10.11.6 (15G17023)

My version also changes the file name. I run it from the system menu, and that lets me quickly see the SD and OS versions without having to run the script.
This is what the file name looks like:
Copy SD 7.0 (7A25) - OS 10.11.6 (15G17023)

use scripting additions
use framework "Foundation"
use framework "AppKit"
------------------------------------------------------------------------------

set appVersions to {}
set shortAppName to "SD"
set appID to "com.latenightsw.ScriptDebugger7"
set the end of appVersions to GetAppInfo(appID, shortAppName)
set appID to "com.latenightsw.ScriptDebugger6"
set the end of appVersions to GetAppInfo(appID, shortAppName)


set sysVer to (current application's NSProcessInfo's processInfo()'s operatingSystemVersionString())
set sysVer to (sysVer's stringByReplacingOccurrencesOfString:("Version") withString:"")
set sysVer to (sysVer's stringByReplacingOccurrencesOfString:("Build ") withString:"") as text
set appInfo to {}
set infoString to {}

repeat with thisAppInfo in appVersions
	set {fullAppName, appVer, appBundleVer} to thisAppInfo
	set the end of appInfo to {fullAppName, appVer, appBundleVer}
	set the end of infoString to "-->  " & fullAppName & space & appVer & " (" & appBundleVer & ")"
	-->Script Debugger 6.0.4 (6A198) on Mac OS 10.11.6 (15G1217)
end repeat

set the end of infoString to "-->  Mac OS" & sysVer
set AppleScript's text item delimiters to {return}
set infoString to infoString as text
set the clipboard to infoString
set {appName, appVer, appBundleVer} to item 1 of appInfo
set fileNameFormat to {"Copy SD ", "version on", " OSX ", "version"}
set infoString to shortAppName & space & appVer & " (" & appBundleVer & ") - OS " & sysVer
-->SD 6.0.4 (6A198) on Mac OS 10.11.6 (15G1217)
set newFileName to "Copy " & infoString
set thisScript to path to me as alias
--Unnote next line and run script to set script name back to default
--set newFileName to fileNameFormat as text

tell application "Finder"
	set oldFileName to the name of thisScript
	if "Unsaved Script Debugger Document" is in oldFileName then return
	if "Untitled" is in oldFileName then return
	set nameExt to the name extension of thisScript
	set newFileName to newFileName & "." & nameExt
	if oldFileName is not newFileName then set the name of thisScript to newFileName
end tell

return the clipboard
-->  Script Debugger 6.0.7 (6A217)
-->  Script Debugger 7.0 (7A25)
-->  Mac OS 10.11.6 (15G17023)
on GetAppInfo(appID, shortAppName)
	
	set appNSURL to current application's NSWorkspace's sharedWorkspace()'s URLForApplicationWithBundleIdentifier:appID
	set appBundle to current application's NSBundle's bundleWithURL:appNSURL
	set fullAppName to (appBundle's infoDictionary()'s objectForKey:"CFBundleName") as text
	set appVer to (appBundle's infoDictionary()'s objectForKey:"CFBundleShortVersionString") as text
	set appBundleVer to (appBundle's infoDictionary()'s objectForKey:"CFBundleVersion") as text
	set appInfoString to {fullAppName, appVer, appBundleVer}
	return appInfoString
end GetAppInfo


Here’s a newer version of that script that works correctly in the AppleScript Menu and Fast scripts.

It sets the clipboard to the SD and MacOS versions and build, and renames itself, so you can have a quick look in the menu.
→ Script Debugger 8.0.3 (8A49)
→ MacOS 11.6.2

use AppleScript version "2.7"
use script "FileManagerLib" version "2.3.5"
use scripting additions
use framework "Foundation"

------------------------------------------------------------------------------
set appName to "Script Debugger"
set appID to get id of application appName

set SDBundle to current application's NSBundle's bundleWithIdentifier:appID
set appVer to SDBundle's infoDictionary()'s objectForKey:"CFBundleShortVersionString"
set appBuild to SDBundle's infoDictionary()'s objectForKey:"CFBundleVersion"

set macOS to system version of (system info)

set versionString to "--> " & appName & " " & (appVer as text) & ¬
   " (" & (appBuild as text) & ¬
   ")" & return & "--> MacOS " & macOS
set the clipboard to versionString
set newFileName to "COPY --> " & appName & " " & (appVer as text) & "  MacOS " & macOS
-->Safari 10.0.3 (11602.4.8.0.1) on macOS 10.11.6
set thisScript to path to me
set myInfo to parse object thisScript
set oldFileName to name_stub of myInfo
set nameExt to the name_extension of myInfo

if "Unsaved Script Debugger Document" is in oldFileName then return
if "Untitled" is in oldFileName then return

set newFileName to newFileName & "." & nameExt
if oldFileName is not newFileName then
   rename object thisScript ¬
      to name newFileName ¬
      with return path
end if

return the clipboard

--> Script Debugger 8.0.3 (8A49)
--> MacOS 11.6.2
on GetAppInfo(appID, shortAppName)
   
   set appNSURL to current application's NSWorkspace's sharedWorkspace()'s URLForApplicationWithBundleIdentifier:appID
   set appBundle to current application's NSBundle's bundleWithURL:appNSURL
   set fullAppName to (appBundle's infoDictionary()'s objectForKey:"CFBundleName") as text
   set appVer to (appBundle's infoDictionary()'s objectForKey:"CFBundleShortVersionString") as text
   set appBundleVer to (appBundle's infoDictionary()'s objectForKey:"CFBundleVersion") as text
   set appInfoString to {fullAppName, appVer, appBundleVer}
   return appInfoString
end GetAppInfo

One thing that’s missing from this script is the ability to get the system name (High Sierra; Big Sur; Monterray, etc.)

Is that accessible to AppleScript?