This is nothing special, since it just does a direct comparison of the version string with no intelligence.
But someone might get some good out of it.
-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2016/05/14 07:50
# dMod: 2016/05/14 08:21
# Appl: AppleScript, the shell, Safari
# Task: Version Checker for Smile
# Libs: None
# Tags: @Applescript, @Script, @Safari, @Smile, @Version, @Checker
-------------------------------------------------------------------------------------------
set betaFiles to fndUsing(
"<a href="" \\d+\\).*?)</a>",
"\\2\\t\\1",
readtext targetURL,
true,
true)
of me set betaFiles to cng("\\.\\./\\.\\./", baseURL, betaFiles) of me
set betaFiles to join betaFiles using linefeed
# Open betaFiles Report in TextEdit
# set shCMD to "column -t -s'" & tab & "' <<< " & quoted form of betaFiles & " | open -f"
# Creating betaFiles Report Table, since I'm being lazy and reusing the above line
# instead of using find text.
set shCMD to "column -t -s'" & tab & "' <<< " & quoted form of betaFiles
set betaFiles to do shell script shCMD without altering line endings
set smileAppPath to do shell script "mdfind 'kMDItemCFBundleIdentifier == \"com.satimage.Smile\"'"
set smileVersion to paragraph 1 of (long version of (info for smileAppPath))
if paragraph 1 of betaFiles starts with smileVersion then
display notification "" with title smileVersion & " is current." subtitle "" sound name "Tink"
else
display notification "" with title smileVersion & " is out-of-date!" subtitle "" sound name "Tink"
set AppleScript's text item delimiters to {" ", linefeed}
set smileBetaURL to text item 2 of betaFiles
tell application "Safari"
activate
make new document with properties {URL:targetURL}
delay 1
set URL of front document to smileBetaURL
end tell
end if
-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on cng(_find, _replace, _data)
change _find into _replace in _data with regexp without case sensitive
end cng
-------------------------------------------------------------------------------------------
on fndUsing(_find, _capture, _data, _all, strRslt)
try
set findResult to find text _find in _data using _capture all occurrences _all ¬
string result strRslt with regexp without case sensitive
on error
false
end try
end fndUsing
-------------------------------------------------------------------------------------------