I use MacUpdate to keep current with Mac apps and have been a member for many years now.
I don't especially like their MacUpdate Desktop app, so I don't use it very often.
That means I have to drive by every so often and eyeball the place.
I run through the list and Cmd-Click items to open them in background tabs in Safari.
Then I run through the tabs to see if there's anything I want to scope-out or download.
If I haven't been keeping up with installs I might have one or more old versions in my Downloads folder hierarchy.
I wrote this script, so I could hit a hotkey and immediately list any items in the Downloads folder.
That gives me a quick check to make certain I haven't downloaded the current version before (if I don't know) and lets me clean out old versions quickly before downloading the new one.
The script will open the Downloads folder if it's NOT frontmost in the Finder.
It will reuse the Search window if it is frontmost.
Scripting this makes it too easy not to do, whereas when it was a manual task I often blew it off.
Enjoy.
-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/03/30 12:02
# dMod: 2017/03/30 03:48
# Appl: Safari, Finder, System Events
# Task: Lookup Name from App-Page on
MacUpdate.com in Downloads Folder.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @ASObjC, @Finder, @Safari, @System_Events, @Lookup, @Name, @App-Page, @MacUpdate.com, @Downloads, @Folder, @Spotlight
-------------------------------------------------------------------------------------------
use AppleScript version "2.4"
use framework "Foundation"
use scripting additions
-------------------------------------------------------------------------------------------
set downloadsFolderAlias to path to downloads folder
set appName to doJavaScriptInSafari("document.getElementById('app_info_name').innerText")
if appName = missing value then
set appName to doJavaScriptInSafari("document.getElementById('app_info_name_2').innerText")
end if
set newStr to its cngStr:"[\\n\\r]+" intoString:"" inString:appName
set findText to "kMDItemFSName:" & "\"" & appName & "\""
tell application "System Events"
tell application process "Finder"
if its visible is false then
set its visible to true
delay 0.1
end if
end tell
end tell
tell application "Finder"
try
set frontWindowTarget to target of front window as alias
if frontWindowTarget ≠ downloadsFolderAlias then
open downloadsFolderAlias
delay 0.2
end if
on error
# Window is probably a search window.
if name of front window starts with "Searching " then
# NULL
else
error "Problem with front window!"
end if
end try
end tell
tell application "System Events"
tell application process "Finder"
set frontmost to true --» •••••
tell front window
tell toolbar 1
tell group 6
tell (first text field whose subrole is "AXSearchField")
set selected to true
set focused to true
set value to findText
perform action "AXConfirm"
end tell
end tell
end tell
end tell
end tell
end tell
-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on cngStr:findString intoString:replaceString inString:dataString
set anNSString to current application's NSString's stringWithString:dataString
set dataString to (anNSString's ¬
stringByReplacingOccurrencesOfString:findString withString:replaceString ¬
options:(current application's NSRegularExpressionSearch) range:{0, length of dataString}) as text
end cngStr:intoString:inString:
-------------------------------------------------------------------------------------------
on doJavaScriptInSafari(_javascript_Str)
try
tell application "Safari" to do _javascript_ _javascript_Str in front document
on error e
error "Error in handler doJavaScriptInSafari() of library NLb!" & return & return & e
end try
end doJavaScriptInSafari
-------------------------------------------------------------------------------------------