Created
June 13, 2014 12:29
-
-
Save macmule/a4bb7e05dac8d56ca39f to your computer and use it in GitHub Desktop.
get JSS version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Get the JSS URL | |
set jssURL to "<enter-jss-URL-here" | |
-- Try & get the version of JSS from the supplied URL | |
try | |
-- Get a copy of the jss.html file, for parsing later, append the jssURL to grab the needed html file | |
set jssURLHtml to (do shell script "curl -k " & jssURL & "/jss.html") | |
-- Set delimiters to custom value cutting up html | |
set applescriptsDelims to AppleScript's text item delimiters | |
-- We only need the content between the title tags | |
set startTag to "<meta name=\"version\" content=\"" | |
set endTag to "\">" | |
-- Split at the <title> tag | |
set AppleScript's text item delimiters to startTag | |
set jssVersionCut to text item 2 of jssURLHtml | |
-- Split again at </title> | |
set AppleScript's text item delimiters to endTag | |
set jssVersion to text item 1 of jssVersionCut | |
-- Reset delimiters | |
set AppleScript's text item delimiters to applescriptsDelims | |
log "JSS is: " & jssVersion | |
-- Error if there is an issue | |
on error | |
log "Cannot get JSS Version" | |
end try |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment