Jump to content

Recommended Posts

Posted

I use to be a C developer.  These Modern OO languages give me fits.  It have a hard time finding how to call a method properly and struggle to look up correctly :(

I got this VBA code (BELOW)  to work in Powerpoint as a macro.  What is the trick to translate it into autoit code?

 I greatly appreciate the help and  I am slowly picking up on how this stuff works.

- Rich

--------------------------------------------------------------------------

Sub IMAGE_ADJUST()

    Dim curSlide As Slide
    Dim curShape As Shape

    For Each curSlide In ActivePresentation.Slides
        For Each curShape In curSlide.Shapes
            With curShape

                .LockAspectRatio = msoFalse

                .ScaleHeight 3.38, msoTrue
                .ScaleWidth 5.13, msoTrue

                'position:
                .Rotation = 0
                .Left = 0
                .Top = 0

            End With
        Next curShape
    Next curSlide

End Sub

Posted

Should be something like this (untested):

; $oPPT is the PowerPoint application object returned by _PPT_Open

Func IMAGE_ADJUST()

    Local $curSlide, $curShape

    For $curSlide In $oPPT.ActivePresentation.Slides
        For $curShape In $curSlide.Shapes
            With $curShape
                .LockAspectRatio = $msoFalse

                .ScaleHeight(3.38, $msoTrue)
                .ScaleWidth(5.13, $msoTrue)

                'position:
                .Rotation = 0
                .Left = 0
                .Top = 0
            EndWith
        Next ; curShape
    Next ; curSlide

EndFunc

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

You are awesome!  Thanks.  The only thing I changed was I $mosTrue and #msoFalse, I just used the Boolean True and False Constants

Thanks again.  I am going to see if I can add a little more automation to it and traverse a directory and fix all the files I have.   Its for a library of songs we use at my church.  Its an older library and everything is in 4x3.  It would take hours to open every one up and fix them, so I was wanting to use this to fix them all. :)

Have a Happy Newyear!

Posted

Should be easy to do :)
Use
_FileListToArray or _FileListToArrayRec (recursive Version) to get an array with all the files to process.

Happy New Year!

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (edited)

Thought I would share with you the final version I have made.  I need to go out to the church building and run it on our computer out there.  I tested it with a couple scenarios and it seemed to work great!  Thanks again for the help!  I am going to find a way to share this with other churches as well who may own the older versions of the songs and are looking for a way to convert their files.

- Rich

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#Include <PowerPoint.au3>
#include <Constants.au3>
#include <String.au3>
#include <Array.au3>
#include <File.au3>

Global $listing
Global $Total_Files
$directory = FileSelectFolder("Choose Folder to Search for Powerpoint Files", "")
   if @error then Exit

list($directory, 0)
$listing = StringTrimRight($listing, 1)
$listing = _StringExplode($listing, "|", 0)
_ArraySort($listing)

MsgBox($MB_SYSTEMMODAL, "CONVERSION", "  " & $Total_Files & " PowerPoint Files Found" & @CRLF & "  Press OK To Begin")

For $iCount = 0 To $Total_Files - 1
    File_Converter($listing[$iCount])
Next


;This Function builds a List of all the files to be converted including sub directories
Func list($path = "", $counter = 0)
  $counter = 0
  $path &= '\'
  Local $Check_File_Type
  Local $list_files = '', $file, $demand_file = FileFindFirstFile($path & '*')
  If $demand_file = -1 Then Return ''
  While 1
    $file = FileFindNextFile($demand_file)
    If @error Then ExitLoop

    If @extended Then
     If $counter >= 10 Then ContinueLoop
       list($path & $file, $counter + 1)
    Else
       $Check_File_Type = StringRight($file,5)
       if ($Check_File_Type = ".pptx") Then
          $Total_Files = $Total_Files + 1
          $listing &= $path & $file & "|"
        Endif
     EndIf
  WEnd
  FileClose($demand_file)
EndFunc

;This Function Converts the Files from 4x3 to 16x9 and resizes the image in the file
Func File_Converter($File_Name)
   ; Set a variable to represent the 16x9 format
   Local Const $PpSlideSizeOnScreen16x9 = 15
   local $New_File_Name = $File_Name

   ;Create a Powerpoint object
   Local $oPPT = _PPT_Open()

   ;Set a variable with the file path and name to be opened
   Local $sPresentation = "C:\PowerPoint Converter\4by3.pptx"
   Local $sPresentation = $File_Name

   ;Open up the Powerpoint file
   Local $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation, True)
     if @error then ConsoleWrite ("Failed to Open Presentation"& @CRLF )

   ;Change the powerpoint to a 16 x 9 format
   $oPresentation.PageSetup.SlideSize = $PpSlideSizeOnScreen16x9

   ;Loop thtough all images and adjust them to the full screen size
   Local $curSlide, $curShape
     For $curSlide In $oPPT.ActivePresentation.Slides
         For $curShape In $curSlide.Shapes
             With $curShape
                 .LockAspectRatio = False
                 .ScaleHeight(3.38, True)
                 .ScaleWidth(5.13, True)
                 .Rotation = 0
                 .Left = 0
                 .Top = 0
             EndWith
         Next ; curShape
     Next ; curSlide

   ;Parse new File Name
   $New_File_Name = StringTrimRight($New_File_Name, 5)
   ;Save the Powerpoint with a new filename
   $New_File_Name = $New_File_Name & "(16x9).pptx"
   _PPT_PresentationSaveAs($oPresentation, $New_File_Name,$ppSaveAsPresentation, True)
     if @error then ConsoleWrite ("Failed to SaveAs Presentation"& @CRLF )

   ;Close the new Powerpoint file
   _PPT_PresentationClose($oPresentation)
     if @error then ConsoleWrite ("Failed to Close Presentation"& @CRLF )

   ;Close the Powerpoint program
   _PPT_Close($oPPT)
EndFunc

PowerPoint 4x3 to 16x9 Converter.au3

Edited by JLogan3o13
Posted

To speed up processing I suggest to call _PPT_Open once at the top of the script and _PPT_Close before you exit.
At the moment you do this for every presentation.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

Another idea is to add HotKeySet to your script.
This could be used to exit your script any time when you encounter problems.
HotKeySet calls a function which then could close the active presentation, close Powerpoint and then exit the script.

Other issues:

  • The ConsoleWrites should write the name of the file being processed to the Console as well. So you know which file causes the problem.
  • _PPT_PresentationClose should be called with parameter $bSave set to False. When _PPT_PresentationSaveAs returns an error you execute _PPT_PresentationClose with parameter $bSave = True. This will fail as well.

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
33 minutes ago, water said:

To speed up processing I suggest to call _PPT_Open once at the top of the script and _PPT_Close before you exit.
At the moment you do this for every presentation.

Good Advice

Posted (edited)

I added in the ability to convert .ppt and .pptx files in case someone had old powerpoint files.

Did the Open once and close once as well.

-------------------------------------------------------------------------------------------

#Include <PowerPoint.au3>
#include <Constants.au3>
#include <String.au3>
#include <Array.au3>
#include <File.au3>

;Main Code Body
Global $listing
Global $Total_Files
$directory = FileSelectFolder("Choose Folder to Search for Powerpoint Files", "")
   if @error then Exit

;Create an array of Files
list($directory, 0)
$listing = StringTrimRight($listing, 1)
$listing = _StringExplode($listing, "|", 0)
_ArraySort($listing)

;Put a message box up prior to starting the conversion
MsgBox($MB_SYSTEMMODAL, "CONVERSION", "  " & $Total_Files & " PowerPoint Files Found" & @CRLF & "  Press OK To Begin")

;Create a Powerpoint object
Global $oPPT = _PPT_Open()

;Main Loop that goes through each file and converts it from 4x3 to 16x9
For $iCount = 0 To $Total_Files - 1
    File_Converter($listing[$iCount])
Next

;Close the Powerpoint program
_PPT_Close($oPPT)


;This Function builds a List of all the files to be converted including sub directories
Func list($path = "", $counter = 0)
  $counter = 0
  $path &= '\'
  Local $Check_File_Type_ppt
  Local $Check_File_Type_pptx
  Local $list_files = '', $file, $demand_file = FileFindFirstFile($path & '*')
  If $demand_file = -1 Then Return ''
  While 1
    $file = FileFindNextFile($demand_file)
    If @error Then ExitLoop

    If @extended Then
     If $counter >= 10 Then ContinueLoop
       list($path & $file, $counter + 1)
    Else
       $Check_File_Type_pptx = StringRight($file,5)
       $Check_File_Type_ppt = StringRight($file,4)
       if ($Check_File_Type_pptx = ".pptx" or $Check_File_Type_ppt = ".ppt") Then
          $Total_Files = $Total_Files + 1
          $listing &= $path & $file & "|"
        Endif
     EndIf
  WEnd
  FileClose($demand_file)
EndFunc

;This Function converts the files from 4x3 to 16x9 and resizes the image in the file
Func File_Converter($File_Name)
   ; Set a variable to represent the 16x9 format
   Local Const $PpSlideSizeOnScreen16x9 = 15
   local $New_File_Name = $File_Name
   Local $Check_File_Type_ppt

   ;Set a variable with the file path and name to be opened
   Local $sPresentation = $File_Name

   ;Open up the Powerpoint file
   Local $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation, True)
     if @error then ConsoleWrite ("Failed to Open Presentation"& @CRLF )

   ;Change the powerpoint to a 16 x 9 format
   $oPresentation.PageSetup.SlideSize = $PpSlideSizeOnScreen16x9

   ;Loop thtough all images and adjust them to the full screen size
   Local $curSlide, $curShape
     For $curSlide In $oPPT.ActivePresentation.Slides
         For $curShape In $curSlide.Shapes
             With $curShape
                 ;Resize the image in the slide
                 .LockAspectRatio = False
                 .ScaleHeight(3.38, True)
                 .ScaleWidth(5.13, True)
                 .Rotation = 0
                 .Left = 0
                 .Top = 0
             EndWith
         Next ; curShape
     Next ; curSlide

   ;Parse new File Name
   $Check_File_Type_ppt = StringRight($New_File_Name, 3)
   ConsoleWrite ("Last 3 characters of a file"& $Check_File_Type_ppt & @CRLF )
   if ($Check_File_Type_ppt = "ppt") Then
     $New_File_Name = StringTrimRight($New_File_Name, 4)
   else
     $New_File_Name = StringTrimRight($New_File_Name, 5)
   EndIf

   ;SaveAs the Powerpoint with a new filename
   $New_File_Name = $New_File_Name & "(16x9)"
   _PPT_PresentationSaveAs($oPresentation, $New_File_Name,$ppSaveAsPresentation, True)
     if @error then ConsoleWrite ("Failed to SaveAs Presentation"& @CRLF )

   ;Close the new Powerpoint file
   _PPT_PresentationClose($oPresentation)
     if @error then ConsoleWrite ("Failed to Close Presentation"& @CRLF )


EndFunc

 

Edited by JLogan3o13
Posted

Got some feedback on my code formatting :)  I think I cleaned it up based on the editors settings for tab's

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

#Include <PowerPoint.au3>
#include <Constants.au3>
#include <String.au3>
#include <Array.au3>
#include <File.au3>

;Main Code Body
Global $listing
Global $Total_Files
$directory = FileSelectFolder("Choose Folder to Search for Powerpoint Files", "")
    if @error then Exit

;Create an array of files based on the parent directory you choose
list($directory, 0)
$listing = StringTrimRight($listing, 1)
$listing = _StringExplode($listing, "|", 0)
_ArraySort($listing)

;Put a message box up prior to starting the conversion
MsgBox($MB_SYSTEMMODAL, "CONVERSION", "  " & $Total_Files & " PowerPoint Files Found" & @CRLF & "  Press OK To Begin")

;Open Powerpoint Application
Global $oPPT = _PPT_Open()

;Main Loop that goes through each file and converts it from 4x3 to 16x9
For $iCount = 0 To $Total_Files - 1
    File_Converter($listing[$iCount])
Next

;Close the Powerpoint Application
_PPT_Close($oPPT)

;This Function builds a List of all the files to be converted including sub directories
Func list($path = "", $counter = 0)
    $counter = 0
    $path &= '\'
    Local $Check_File_Type_ppt
    Local $Check_File_Type_pptx
    Local $list_files = '', $file, $demand_file = FileFindFirstFile($path & '*')
    If $demand_file = -1 Then Return ''
        While 1
            $file = FileFindNextFile($demand_file)
                If @error Then ExitLoop
            If @extended Then
                If $counter >= 10 Then ContinueLoop
                    list($path & $file, $counter + 1)
                Else
                    $Check_File_Type_pptx = StringRight($file,5)
                    $Check_File_Type_ppt = StringRight($file,4)
                if ($Check_File_Type_pptx = ".pptx" or $Check_File_Type_ppt = ".ppt") Then
                    $Total_Files = $Total_Files + 1
                    $listing &= $path & $file & "|"
                Endif
            EndIf
        WEnd
    FileClose($demand_file)
EndFunc

;This Function converts the files from 4x3 to 16x9 and resizes the image in the file
Func File_Converter($File_Name)
    Local Const $PpSlideSizeOnScreen16x9 = 15 ;Set a variable to represent the 16x9 format
    Local $New_File_Name = $File_Name
    Local $Check_File_Type_ppt

    ;Set a variable with the file path and name to be opened
    Local $sPresentation = $File_Name

    ;Open up the Powerpoint file
    Local $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation, True)
        if @error then ConsoleWrite ("Failed to Open Presentation"& @CRLF )

    ;Change the powerpoint to a 16 x 9 format
    $oPresentation.PageSetup.SlideSize = $PpSlideSizeOnScreen16x9

    ;Loop thtough all images and adjust them to the full screen size
    Local $curSlide, $curShape
    For $curSlide In $oPPT.ActivePresentation.Slides
        For $curShape In $curSlide.Shapes
            With $curShape
                ;Resize the image in the slide
                .LockAspectRatio = False
                .ScaleHeight(3.38, True)
                .ScaleWidth(5.13, True)
                .Rotation = 0
                .Left = 0
                .Top = 0
            EndWith
        Next ; curShape
    Next ; curSlide

    ;Parse new File Name
    $Check_File_Type_ppt = StringRight($New_File_Name, 3)
    ConsoleWrite ("Last 3 characters of a file"& $Check_File_Type_ppt & @CRLF )
    if ($Check_File_Type_ppt = "ppt") Then
        $New_File_Name = StringTrimRight($New_File_Name, 4)
    else
        $New_File_Name = StringTrimRight($New_File_Name, 5)
    EndIf

    ;SaveAs the Powerpoint with a new filename
    $New_File_Name = $New_File_Name & "(16x9)"
    _PPT_PresentationSaveAs($oPresentation, $New_File_Name,$ppSaveAsPresentation, True)
        if @error then ConsoleWrite ("Failed to SaveAs Presentation"& @CRLF )

    ;Close the new Powerpoint file
    _PPT_PresentationClose($oPresentation)
        if @error then ConsoleWrite ("Failed to Close Presentation"& @CRLF )
EndFunc

PowerPoint Converter (4x3 to 16x9).au3

Posted

How to post code is described here:

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
#Include <PowerPoint.au3>
#include <Constants.au3>
#include <String.au3>
#include <Array.au3>
#include <File.au3>

;Main Code Body
Global $listing
Global $Total_Files
$directory = FileSelectFolder("Choose Folder to Search for Powerpoint Files", "")
    if @error then Exit

;Create an array of files based on the parent directory you choose
list($directory, 0)
$listing = StringTrimRight($listing, 1)
$listing = _StringExplode($listing, "|", 0)
_ArraySort($listing)

;Put a message box up prior to starting the conversion
MsgBox($MB_SYSTEMMODAL, "CONVERSION", "  " & $Total_Files & " PowerPoint Files Found" & @CRLF & "  Press OK To Begin")

;Open Powerpoint Application
Global $oPPT = _PPT_Open()

;Main Loop that goes through each file and converts it from 4x3 to 16x9
For $iCount = 0 To $Total_Files - 1
    File_Converter($listing[$iCount])
Next

;Close the Powerpoint Application
_PPT_Close($oPPT)



;This Function builds a List of all the files to be converted including sub directories
Func list($path = "", $counter = 0)
    $counter = 0
    $path &= '\'
    Local $Check_File_Type_ppt
    Local $Check_File_Type_pptx
    Local $list_files = '', $file, $demand_file = FileFindFirstFile($path & '*')
    If $demand_file = -1 Then Return ''
        While 1
            $file = FileFindNextFile($demand_file)
                If @error Then ExitLoop
            If @extended Then
                If $counter >= 10 Then ContinueLoop
                    list($path & $file, $counter + 1)
                Else
                    $Check_File_Type_pptx = StringRight($file,5)
                    $Check_File_Type_ppt = StringRight($file,4)
                if ($Check_File_Type_pptx = ".pptx" or $Check_File_Type_ppt = ".ppt") Then
                    $Total_Files = $Total_Files + 1
                    $listing &= $path & $file & "|"
                Endif
            EndIf
        WEnd
    FileClose($demand_file)
EndFunc



;This Function converts the files from 4x3 to 16x9 and resizes the image in the file
Func File_Converter($File_Name)
    Local Const $PpSlideSizeOnScreen16x9 = 15 ;Set a variable to represent the 16x9 format
    Local $New_File_Name = $File_Name
    Local $Check_File_Type_ppt

    ;Set a variable with the file path and name to be opened
    Local $sPresentation = $File_Name

    ;Open up the Powerpoint file
    Local $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation, True)
        if @error then ConsoleWrite ("Failed to Open Presentation"& @CRLF )

    ;Change the powerpoint to a 16 x 9 format
    $oPresentation.PageSetup.SlideSize = $PpSlideSizeOnScreen16x9

    ;Loop thtough all images and adjust them to the full screen size
    Local $curSlide, $curShape
    For $curSlide In $oPPT.ActivePresentation.Slides
        For $curShape In $curSlide.Shapes
            With $curShape
                ;Resize the image in the slide
                .LockAspectRatio = False
                .ScaleHeight(3.38, True)
                .ScaleWidth(5.13, True)
                .Rotation = 0
                .Left = 0
                .Top = 0
            EndWith
        Next ; curShape
    Next ; curSlide

    ;Parse new File Name
    $Check_File_Type_ppt = StringRight($New_File_Name, 3)
    ConsoleWrite ("Last 3 characters of a file"& $Check_File_Type_ppt & @CRLF )
    if ($Check_File_Type_ppt = "ppt") Then
        $New_File_Name = StringTrimRight($New_File_Name, 4)
    else
        $New_File_Name = StringTrimRight($New_File_Name, 5)
    EndIf

    ;SaveAs the Powerpoint with a new filename
    $New_File_Name = $New_File_Name & "(16x9)"
    _PPT_PresentationSaveAs($oPresentation, $New_File_Name,$ppSaveAsPresentation, True)
        if @error then ConsoleWrite ("Failed to SaveAs Presentation"& @CRLF )

    ;Close the new Powerpoint file
    _PPT_PresentationClose($oPresentation)
        if @error then ConsoleWrite ("Failed to Close Presentation"& @CRLF )
EndFunc

 

Posted

:thumbsup:

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

  • 1 year later...
Posted

thanks for the UDF water!

is there a way to set font size? or font type?

dont see any reference in the current version of the udf - but given the topic title "rewrite of the udf" maybe it existed before on a previous version of the udf?

not sure if this was a previous version - but see the ability to specify font size here

thanks again

Posted

@gcue Try this:

#include <PowerPoint.au3>

$oPPT = _PPT_Open()
$oPresentation = _PPT_PresentationNew($oPPT)
$oSlide = _PPT_SlideAdd($oPresentation, 1)
$aShapes = _PPT_ShapeList($oPresentation, 1)
If IsArray($aShapes) Then
    MsgBox(0, '', 'Before')
    Local $oShape = $aShapes[0][0]
    $oShape.TextFrame.TextRange.Font.Size = 24
    MsgBox(0, '', 'After')
EndIf
_PPT_Close($oPPT)

 

  • 4 weeks later...
Posted

trying to figure out how to change the theme of a presentation to a predefined one. was hoping powerpoint came with a macros recorder so i could peek at the vba to see the predefined themed names for the ones i picked - no luck

found these but was not able to translate to autoit but the syntax did not work

https://answers.microsoft.com/en-us/msoffice/forum/all/change-color-theme-using-vba-in-powerpoint/0efe38ad-36cb-4df7-b6e6-ed389c364f53

https://learn.microsoft.com/en-us/office/vba/api/office.themecolorscheme.colors

$oPresentation.SlideMaster.Theme.ThemeColorScheme("msoThemeAccent1") = 0x0000ff
$oPresentation.SlideMaster.Theme.ThemeColorScheme("msoThemeAccent2") = 0xff0000
$oPresentation.SlideMaster.Theme.ThemeColorScheme("msoThemeAccent3") = 0xff0000
$oPresentation.SlideMaster.Theme.ThemeColorScheme("msoThemeAccent4") = 0xff0000
$oPresentation.SlideMaster.Theme.ThemeColorScheme("msoThemeAccent5") = 0xff0000
$oPresentation.SlideMaster.Theme.ThemeColorScheme("msoThemeAccent6") = 0xff0000
$oPresentation.SlideMaster.Theme.ThemeColorScheme("msoThemeDark1") = 0xff0000
$oPresentation.SlideMaster.Theme.ThemeColorScheme("msoThemeDark2") = 0xff0000

any help is greatly appreciated!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...