content: global firstFrontmost, secondFrontmost
  
  set screenWidthMainMonitor to (word 1 of (do shell script "system_profiler SPDisplaysDataType | awk '/Resolution/{print $2}'"))
  set screenHeightMainMonitor to (word 1 of (do shell script "system_profiler SPDisplaysDataType | awk '/Resolution/{print $4}'"))
  --display alert "width: " & screenWidthMainMonitor & " height: " & screenHeightMainMonitor
  
  tell application "System Events"
    tell application "System Events"
      set firstFrontmost to first process where it is frontmost
      set visible of firstFrontmost to false
      repeat while (firstFrontmost is frontmost)
        delay 0.1
      end repeat
      set secondFrontmost to name of first process where it is frontmost
      set frontmost of firstFrontmost to true
    end tell
  end tell
  
  tell application "System Events"
  
    try
      tell process secondFrontmost
        set currentWindow to window 1
        set position of currentWindow to {0, 0}
        set size of currentWindow to {screenWidthMainMonitor, screenHeightMainMonitor}
      end tell
  
    on error errMsg
  
      set txtPlz to "Seems like you haven't granted permission for this script.
  		
  "
      set txtHow to "Close this alert and \"System Preference\" will open. There add this script to the list on the right.
  		
  "
      set txtHowManual to "Otherwise follow these steps:
  1) Go to \"System preference -> Security & Privacy;
  2) Select \"Privacy\" tab;
  3) Select \"Accessibility\" 
  4) Add there this script.
  		
  "
      display alert txtPlz & txtHow & txtHowManual & "err_log: " & errMsg
  
      tell application "System Preferences"
      --get a reference to the Security & Privacy preferences pane
        set securityPane to pane id "com.apple.preference.security"
  
        --tell that pane to navigate to its "Accessibility" section under its Privacy tab
        --(the anchor name is arbitrary and does not imply a meaningful hierarchy.)
        tell securityPane to reveal anchor "Privacy_Accessibility"
  
        --open the preferences window and make it frontmost
        activate
      end tell
  
    end try
  end tell