Jump to content

Help convert text VBA to autoit!


BamBuVn
 Share

Recommended Posts

Can you please show us the rest of your AutoIt script? At least the part where you start PowerPoint and open the presentation.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

#included <Powerpoint.au3> ('?do=embed' frameborder='0' data-embedContent>>)

VBA => https://msdn.microsoft.com/en-us/library/office/ff744029(v=office.14).aspx

Func _save($loi)
    Local $j = 1, $k = 1, $h = 1, $ghep_dong, $tach_dong, $PresInterface, $objPres
    If $loi == '' Then Return 0
    $objPPT = _PPT_PowerPointApp()
    If @error Then
        MsgBox(0, "", "No PowerPoint available")
        Return 0
    EndIf
    $ghep_dong = ''
    $tach_dong = StringSplit($loi & @CRLF, @CRLF)
    $PresInterface = _PPT_CreatePresentation($objPPT) ;Get presentation interface
    $objPres = _PPT_PresentationAdd($PresInterface) ;Add a new presentation
    _PPT_PageSetup($objPres)
    While $h
        For $i = 1 To 6
            If $j >= $tach_dong[0] Then
                $h = 0
                ExitLoop
            EndIf
            $ghep_dong &= $tach_dong[$j] & @CR
            $j += 1
        Next
        $objSlide = _PPT_SlideCreate($objPres, $k, $PPLAYOUTBLANK)
        _PPT_SlideAddTextBox($objSlide, 0, 0, 720, 720) ;add a plain textbox
        _PPT_SlideTextFrameSetText($objSlide, 1, $ghep_dong)
        _PPT_SlideTextFrameSetFontSize($objSlide, 1, 48)
        _PPT_SlideTextFrameSetFont_Bold($objSlide, 1, True)
        $ghep_dong = ''
        $k += 1
    WEnd

    _PPT_PresentationSaveAs($objPres, @ScriptDir & "\Lyrics\" & $title & ".ppt")
    ;_PPT_PresentationClose($objPres) ; Close presentation
    ;_PPT_PowerPointQuit($objPPT) ;Exit PowerPoint
EndFunc   ;==>_save
Edited by BamBuVn
Link to comment
Share on other sites

So your statement should be:

Global Const $ppAlignLeft = 1 ; Left aligned
$objPPT.ActivePresentation.Slides(1).Shapes(2).TextFrame.TextRange.ParagraphFormat.Alignment = $ppAlignLeft

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

Thank you very much!

edit:

$Alignment => 1 (left), 2 (center), 3 (right)

Func _PPT_SlideParagraphFormat(ByRef $obj, $intTextFrame, Const $Alignment)
    If IsObj($obj) <> 1 Then
        SetError(1)
        Return 0
    Else
        Local $objTextRng = $obj.Slides($intTextFrame).Shapes(1)
        $objTextRng.TextFrame.TextRange.ParagraphFormat.Alignment =  $Alignment
    Endif
EndFunc
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...