boltonebob Posted April 14, 2022 Posted April 14, 2022 Hello anyone who is willing to help guide me. I'm having trouble with the PowerPoint UDF. I can't even seem to get PowerPoint to open using it. I've dropped the PowerPoint.au3 file into the Include folder, but running any of the commands after that seem to produce nothing. I've been successful with the Excel one, so I'm not sure what is going wrong. Can someone give me a simple example script for something like this to learn from: 1) Open C:/folder/test1.pptx 2) Save as C:/folder/test2.pptx 3) Close the PowerPoint I would really appreciate your guidance
Developers Jos Posted April 14, 2022 Developers Posted April 14, 2022 Moved to the appropriate forum. Moderation Team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
water Posted April 14, 2022 Posted April 14, 2022 Can you please post the script you are using? Do you check for errors after each powerpoint funtion call? 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
boltonebob Posted April 14, 2022 Author Posted April 14, 2022 OK, so I'm trying to start real simple with this. I've put the Powerpoint.au3 in the #include folder, and I presume I have to have my script in the same folder as the _PPT files. I then copy the _PPT_PresentationOpen example and try to change it a little to verify it is working, but I get an error of "Error creating the PowerPoint application object @error =1, @extended = 2147221164": #AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_AU3Check_Stop_OnWarning=N #include <PowerPoint.au3> #include <MsgBoxConstants.au3> ; ************************* ; Create application object ; ************************* Global $oPPT = _PPT_Open() If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationOpen Example", "Error creating the PowerPoint application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) ; ************************************** ; Open an existing presentation readonly ;*************************************** Global $sPresentation = ("C:\Folder\Test1.pptx") Global $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation, True) If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationOpen Example", "Error opening presentation '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_PresentationOpen Example 1", "Presentation '" & $sPresentation & "' successfully opened readonly.")
boltonebob Posted April 14, 2022 Author Posted April 14, 2022 It's been years since I used AutoIT, and I'm just starting to get back into again, so please be kind if I'm being incredibly dense. Also, the script refers to opening in 'read only', is there a way of opening it without being read only? Otherwise I presume I will not be able to move on and then save it after a minor change 😒
SkysLastChance Posted April 14, 2022 Posted April 14, 2022 (edited) Which version of Power Point? 32/64 bit? Which operating system? 32/64 bit? Which version of AutoIt? Edited April 14, 2022 by SkysLastChance You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott
water Posted April 14, 2022 Posted April 14, 2022 To open a presentation in read/write you have to modify the _PPT_PresentationOpen statement. Please check the help file. 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
boltonebob Posted April 14, 2022 Author Posted April 14, 2022 (edited) 2 hours ago, SkysLastChance said: Which version of Power Point? 32/64 bit? Which operating system? 32/64 bit? Which version of AutoIt? Powerpoint 32bit, Windows 10 64bit and latest version of AutoIT Edited April 14, 2022 by boltonebob
boltonebob Posted April 15, 2022 Author Posted April 15, 2022 1 hour ago, water said: To open a presentation in read/write you have to modify the _PPT_PresentationOpen statement. Please check the help file. Yeah, that is where this gets embarrassing 😳. I have been reading the help files and looking at the examples. I've been using the built in Excel functionality fine, but something is really escaping me here on the PowerPoint one. I could find lots of examples of the Excel one, even on YouTube, but I find very little info on the PowerPoint UDF. I seem to be missing something between the two. I'll keep searching and hopefully soon I'll work it out.
water Posted April 15, 2022 Posted April 15, 2022 The latest PowerPoint UDF comes with a CHM help file. 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
boltonebob Posted April 15, 2022 Author Posted April 15, 2022 1 hour ago, water said: The latest PowerPoint UDF comes with a CHM help file. Thank you, I'd not seen that
boltonebob Posted April 15, 2022 Author Posted April 15, 2022 OK I have a lot more clarity on why nothing I was trying was working. It all seems to center back on even opening Powerpoint. For some reason I don't seem to be able to do that with the UDF. I have the Powerpoint.au3 in the Include folder along with the PowerPointConstants. When I run the below I get the error box that is called upon by the script. Can you tell me what I am missing? I believe this is my fundamental first issue. Once I get this sorted I should be off and running. #include <PowerPoint.au3> #include <MsgBoxConstants.au3> Global $oPPT = _PPT_Open() If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_Open", "Error creating the PowerPoint application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_Open Example 1", "PowerPoint Application has been opened successfully.")
Nine Posted April 15, 2022 Posted April 15, 2022 Error 0x80040154 (-2147221164) means class not registered. Are you sure PowerPoint is correctly installed ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
boltonebob Posted April 15, 2022 Author Posted April 15, 2022 Yes, this line runs fine and opens Powerpoint for me: Run(@comSpec & " /c start \folder\Test1.pptx", "", @SW_HIDE)
Nine Posted April 15, 2022 Posted April 15, 2022 Although, the dll is not properly registered. Usually it means that you did not install it with the installer. But it is possible that the registry entries have been modified or has failed at installation. Manually registering dll is not recommended. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
boltonebob Posted April 15, 2022 Author Posted April 15, 2022 OK thank you for that, I'll try it out on another PC later today. I did have to do a repair install of Office 365 a week ago, so maybe something went wrong there. Maybe I'll have to uninstall and reinstall it. Thank you for the help though.
boltonebob Posted April 15, 2022 Author Posted April 15, 2022 You hit the nail on the head Nine, it worked fine on an alternate machine. Thank you so much.
boltonebob Posted April 15, 2022 Author Posted April 15, 2022 (edited) My finished example 🙂 #include <PowerPoint.au3> Global $oPPT = _PPT_Open() ;Open Powerpoint Global $sPresentation = ("C:\Folder\Test1.pptx") Global $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation, False) ;Open Test1 Powerpoint without 'Read-only' _PPT_PresentationSaveAs($oPresentation, ("C:\Folder\Test2.pptx"), Default, True) ;Save as Test2.pptx _PPT_Close($oPPT, False) ;Close Powerpoint Thank you all for the advice Edited April 15, 2022 by boltonebob
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now