0

Is it possible to find out if the Chrome is running in incognito mode?

if application "Google Chrome" is running then
    tell application "Finder" to display dialog "Chrome is running"
    // --> some condition here to check if it is in incognito ?
       tell application "Finder" to display dialog "Chrome is running in INCOGNITO mode"
end if

Also, I want this script to keep running. That means as soon as user opens Chrome in incognito mode I will show alert. Like this:

set chromeRunning to false
repeat until application "Google Chrome" is running

    if not chromeRunning then
        tell application "Finder" to display dialog "Chrome is started in INCOGNITO mode"
        set chromeRunning to true
        #may be quit the script now..
    end if
    delay 10
end repeat

If this the correct approach?

P.S. Can someone please close the question here @ https://stackoverflow.com/questions/26916480/how-to-check-is-chrome-is-running-in-incognito-mode-using-applescript

  • Please do not double-post. Did you flag the question on SuperUser as off-topic so it could be moved? Also, please allow more than a minute or two after requesting a question be moved, to request it again. – tubedogg Nov 13 '14 at 19:53
  • @tubedogg Yes, I flagged earlier question as off topic before posting here. – Rakesh Juyal Nov 13 '14 at 20:04
1

You can check the mode property:

tell application "Google Chrome"
    if exists window 1 then
        if mode of window 1 = "incognito" then
            -- insert your code here
        end if
    end if
end tell
| improve this answer | |
  • It says can't make *mode of window 1* into type reference – Rakesh Juyal Nov 14 '14 at 0:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .