• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Smile Beta Version Checker
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Smile Beta Version Checker


  • Subject: Smile Beta Version Checker
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 14 May 2016 08:58:14 -0500

Hey Folks,

This is nothing special, since it just does a direct comparison of the version string with no intelligence.

I was just playing with reading remote URLs with readtext and built this as a general proof-of-concept.

But someone might get some good out of it.

--
Best Regards,
Chris

-------------------------------------------------------------------------------------------
# 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
# Osax: Satimage.osax { http://tinyurl.com/dc3soh }
# Tags: @Applescript, @Script, @Safari, @Smile, @Version, @Checker
-------------------------------------------------------------------------------------------

set targetURL to "http://satimage.fr/software/en/downloads/downloads_nextsmile.html"
set baseURL to "http://satimage.fr/software/"
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
-------------------------------------------------------------------------------------------



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: Downloading a file from the internet with a URL
  • Next by Date: ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example
  • Previous by thread: PHOTOSHOP: Set Star Rating in Info
  • Next by thread: ASObjC to Find an App with Bundle-ID and XMLLib.osax Read Plist Example
  • Index(es):
    • Date
    • Thread