Using AppleScript, I need to check if Adblock Plus (ABP) is installed in the Chrome Browser.
After numerous attempts at trying to figure out how, I have come to the conclusion that it would be relatively easy to check if the ABP "firstRun.html" exists.
Or is there a more reliable script to check if this specific extension is installed?
Here is my script, however it always returns true. Please Help.
if checkIfABPInstalled() is true then
log "FOUND"
else
log "NOT FOUND"
end if
on checkIfABPInstalled()
try
tell application "Google Chrome"
if ("chrome-extension://cfhdojbkjhnklbpkdaibdccddilifddb/firstRun.html") exists then
return true
else
return false
end if
end tell
on error
return false
end try
end checkIfABPInstalled
Best Answer
Google Chrome's AppleScript Dictionary doesn't have a direct method to check for extensions, so you need to test for the Adblock Plus extension in a different way.
If the Adblock Plus extension is installed, then the
adblockplus.js
file will exist within the"$HOME/Library/Application Support/Google/Chrome/Default/Extensions/
directory structure. So I'd test for its existence and the example AppleScript code below does that.