I have a simple script that, when I add a video to a PowerPoint slide, it resizes it to the size and position I need:
tell application "Microsoft PowerPoint"
activate
set theShapeRange to shape range of selection of active window
set n to (count shapes of theShapeRange)
repeat with i from 1 to n
tell shape i of theShapeRange
set properties to {top:{100}, left position:{259}, height:{241}, width:{427}}
end tell
end repeat
end tell
But I also want it to change the video property that make it play full screen. I went to the PowerPoint dictionary and found nothing. I tried click the menu via System Events, but can’t make it click in the specific checkbox.
Here is a script snippet that uses GUI scripting to get to the checkbox.
Play with it as you will
local mt, isnotEnabled
tell application "Microsoft PowerPoint"
activate
set theShapeRange to shape range of selection of active window
set n to (count shapes of theShapeRange)
repeat with i from 1 to n
tell shape i of theShapeRange
if media type is media type movie then
set properties to {top:{100}, left position:{100}, height:{304}, width:{720}}
tell application "System Events"
tell process "PowerPoint"
set isnotEnabled to (value of radio button "Playback" of tab group 1 of window 1) = 0
if isnotEnabled then
perform action "AXPress" of radio button "Playback" of tab group 1 of window 1
end if
repeat until exists checkbox "Play Full Screen" of group 4 of scroll area 1 of tab group 1 of window 1
delay 0.1
end repeat
set isnotEnabled to (value of checkbox "Play Full Screen" of group 4 of scroll area 1 of tab group 1 of window 1) = 0
if isnotEnabled then
perform action "AXPress" of checkbox "Play Full Screen" of group 4 of scroll area 1 of tab group 1 of window 1
end if
end tell
end tell
end if
end tell
end repeat
end tell
use AppleScript version "2.4"
use framework "Foundation"
use scripting additions
set theScreen to (current application's NSScreen's mainScreen()'s valueForKey:"frame") as list
set theWidth to item 1 of item 2 of theScreen
set theHeight to item 2 of item 2 of theScreen
set {theTop, theLeft} to {10, 10}
tell application "Microsoft PowerPoint"
activate
set theShapeRange to shape range of selection of active window
set n to (count shapes of theShapeRange)
repeat with i from 1 to n
tell shape i of theShapeRange
set properties to {top:theTop, left position:theLeft, height:(theHeight - theTop), width:(theWidth - theLeft)}
end tell
end repeat
end tell
I don’t use PowerPoint, but I’ve used this technique to fill the screen in other applications and it seems to work just fine.