Friday, December 2, 2022

#1 2022-09-26 12:36:54 pm

luizdsilveira
Member
Registered: 2016-11-10
Posts: 18

PowerPoint - make video Full Screen

Hi.

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:


Applescript:

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.

Any idea?

Thank you,
Luiz

Offline

 

#2 2022-09-26 01:40:29 pm

robertfern
Member
Registered: 2011-11-29
Posts: 224

Re: PowerPoint - make video Full Screen

Here is a script snippet that uses GUI scripting to get to the checkbox.

Play with it as you will

Applescript:

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

Last edited by robertfern (2022-09-26 01:55:37 pm)

Offline

 

#3 2022-09-26 03:45:34 pm

estockly
Member
Registered: 2009-01-03
Posts: 158

Re: PowerPoint - make video Full Screen

luizdsilveira wrote:

Hi.

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:


Applescript:

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.

Any idea?

Thank you,
Luiz



You could also try something like this:

Applescript:

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.

Last edited by estockly (2022-09-26 03:51:11 pm)

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)