**This article relates to AirParrot 1. As of September 2016, support for AirParrot 1 has ended. We encourage you to upgrade to AirParrot 2 for the best compatibility with new devices.**


Yes, AirParrot has AppleScript support built right in!

 

Please use the built-in AppleScript dictionary and the code below as an example.


1. Launch AirParrot, Set display to Display 1, connect to Apple TV and enable audio


on connectDevice()

tell application "AirParrot"

repeat until device "Apple TV" exists

 count device #This holds AirParrot from connecting until the AppleTV exists.

end repeat

 

if device "Apple TV" exists then #Checks for detection of the AppleTV

 

set selectedDisplay to display named "Display 1 - (1440x900)" #This is the user's main display if indexing is not needed. Users will have to change the actual resolution within (resolution) to match their readout resolution within AirParrot's menu

 

 

set connectedDevice to device named "Apple TV" #Connects AirParrot to the AppleTV.

 

if audio is disabled then

set audio to enabled #Enables audio if it is not already enabled in AirParrot's menu.

end if

end if

end tell

end connectDevice


tell application "AirParrot"

 activate #Launches AirParrot if it is not already running

end tell


connectDevice()


 

 

 

2. Launch AirParrot, Set it to Display 1 if single screen, Display 2 if duel screen, connects to Apple TV and enables audio


on connectDevice()

tell application "AirParrot"

repeat until device "Apple TV" exists

 count device #This holds AirParrot from connecting until the AppleTV exists.

end repeat

 

if device "Apple TV" exists then #Checks for detection of the AppleTV

 

set selectedDisplay to (display ((count display) - 1)) #monitor 1 if only single monitor, else this is monitor 2 on duel monitors

 

 set connectedDevice to device named "Apple TV" #Connects AirParrot to the AppleTV.


if audio is disabled then

set audio to enabled #Enables audio if it is not already enabled in AirParrot's menu.

end if

end if

end tell

end connectDevice


tell application "AirParrot"

 activate #Launches AirParrot if it is not already running

end tell


connectDevice()

 

 

 


3. Launch AirParrot, Selects Display 1 on duel monitors, connects to Apple TV and enables audio


on connectDevice()

tell application "AirParrot"

repeat until device "Apple TV" exists

 count device #This holds AirParrot from connecting until the AppleTV exists.

end repeat

 

if device "Apple TV" exists then #Checks for detection of the AppleTV

 

 

set selectedDisplay to (display ((count display) - 2)) #monitor 1 if duel monitor


set connectedDevice to device named "Apple TV" #Connects AirParrot to the AppleTV. 


if audio is disabled then

set audio to enabled #Enables audio if it is not already enabled in AirParrot's menu.

end if

end if

end tell

end connectDevice


tell application "AirParrot"

 activate #Launches AirParrot if it is not already running

end tell


connectDevice()

 

 

 


4. Launch AirParrot, set extension, give delay for drivers, connects to Apple TV (Can add the enable audio code from any of the others also)


on connectDevice()

tell application "AirParrot"

repeat until device "Apple TV" exists

 count device #This holds AirParrot from connecting until the AppleTV exists.

end repeat

 

if device "Apple TV" exists then #Checks for detection of the AppleTV

 

 

set selectedDisplay to (display ((count display) - 0)) #sets the display to Extended option, will initialize the Extended display drivers.

 

 delay 2 #This gives a 2 second delay to allow the Extended display driver to initialize, May have to adjust this between 2 to 5 seconds.

 

set connectedDevice to device named "Apple TV" #Connects AirParrot to the AppleTV.

 


end if

end tell

end connectDevice


tell application "AirParrot"

 activate #Launches AirParrot if it is not already running

end tell


connectDevice()