Ajithkumar Posted September 23, 2014 Share Posted September 23, 2014 Dear Team, Have a great day. Please share me the code for following features, I Have maintain one folder in c: drive, In which I am store variuous files like, PPT and excel file. I need to open the PPT file one by one and for the same it has to automatically close after showing slide show. please share the code for the details. Thanks is Advance. Link to comment Share on other sites More sharing options...
Jewtus Posted September 23, 2014 Share Posted September 23, 2014 Dear Team, Have a great day. Please share me the code for following features, I Have maintain one folder in c: drive, In which I am store variuous files like, PPT and excel file. I need to open the PPT file one by one and for the same it has to automatically close after showing slide show. please share the code for the details. Thanks is Advance. Take a look here: '?do=embed' frameborder='0' data-embedContent>> Link to comment Share on other sites More sharing options...
Ajithkumar Posted September 23, 2014 Author Share Posted September 23, 2014 Thanks for your prompt reply, I had try this its working....But how can I include My own PPt. because while run the script,by default it will open new ppt. please guide me I am new to autoit. Link to comment Share on other sites More sharing options...
Jewtus Posted September 23, 2014 Share Posted September 23, 2014 Ok, well I would suggest reading up on COM objects. Here is an example I was working on to create a new ppt just so you have an idea on syntax: #include <WinAPIGdi.au3> $oPPT = ObjCreate("PowerPoint.Application") If @error Then MsgBox(0, "Error", "No PowerPoint available") Exit EndIf AddSlide(2, 11, "Example Project") Func AddSlide($slideNum, $format, $projectName) $oPresentation = $oPPT.Presentations.Open(@ScriptDir & "\Test.pptx") If @error Then MsgBox(0, "Error", "Error opening Presentation") Exit EndIf $rows = 10 $cols = 3 $oSlide1 = $oPresentation.Slides.Add($slideNum, $format) With $oSlide1 .Shapes.Item(1).TextFrame.TextRange.Text = $projectName .Shapes.AddTextBox(1,35,60,400,50) ;type,left,top,width,height .Shapes.Item(2).TextFrame.TextRange.Text = "Overall Status" .Shapes.AddTextBox(1,300,60,400,50) .Shapes.Item(3).TextFrame.TextRange.Text = "Issues" .Shapes.AddTextBox(1,500,60,400,50) .Shapes.Item(4).TextFrame.TextRange.Text = "Next Week" .Shapes.AddShape(1,30,100,60,120) .Shapes.Item(5).Fill.ForeColor.RGB = _WinAPI_RGB(178,178,178) .Shapes.AddTable($rows, $cols, 120, 100, 130, 100) EndWith $oPresentation.SaveAs(@ScriptDir&"\Output.ppt") $oPPT.Quit EndFunc ;==>AddSlide First part of this checks to see if PPT exists on the machine. Basically you need to create the object and then bind it to something. $oPPT = ObjCreate("PowerPoint.Application") Creates the object $oPresentation = $oPPT.Presentations.Open(@ScriptDir & "Test.pptx") Opens a specific presentation Then if you want to do operations after that, use $oPresentation. and the COM commands that you can find HERE There is an overall cheatsheet that will allow you to do some even more robust operations: http://msdn.microsoft.com/en-us/library/office/ff743835(v=office.15).aspx Link to comment Share on other sites More sharing options...
Ajithkumar Posted September 23, 2014 Author Share Posted September 23, 2014 For the above coding, where can i find the @ScriptDi folder, how to put my ppt over there Link to comment Share on other sites More sharing options...
Ajithkumar Posted September 23, 2014 Author Share Posted September 23, 2014 Dear Team, About this post for more understing ..please find the below script. But PPt does not close after the slide show . >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TestFunc1() ; Run TestFunc1 ; Finished! $fullpath = @MyDocumentsDir & 'PPTSample PPT.ppt' RunWait(@ComSpec & ' /c ' & '"' & $fullpath & '"', '', @SW_hide) TestFunc2() $fullpath = @MyDocumentsDir & 'PPTOEE for September 2014.xlsx' RunWait(@ComSpec & ' /c ' & '"' & $fullpath & '"', '', @SW_HIDE) Send("!f") Sleep(500) Send("{DOWN 12}{ENTER}") Func TestFunc1() EndFunc ;==>TestFunc1 ; TestFunc2 Func TestFunc2() EndFunc ;==>TestFunc2 Link to comment Share on other sites More sharing options...
Jewtus Posted September 23, 2014 Share Posted September 23, 2014 (edited) Dear Team, About this post for more understing ..please find the below script. But PPt does not close after the slide show . >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TestFunc1() ; Run TestFunc1 ; Finished! $fullpath = @MyDocumentsDir & 'PPTSample PPT.ppt' RunWait(@ComSpec & ' /c ' & '"' & $fullpath & '"', '', @SW_hide) TestFunc2() $fullpath = @MyDocumentsDir & 'PPTOEE for September 2014.xlsx' RunWait(@ComSpec & ' /c ' & '"' & $fullpath & '"', '', @SW_HIDE) Send("!f") Sleep(500) Send("{DOWN 12}{ENTER}") Func TestFunc1() EndFunc ;==>TestFunc1 ; TestFunc2 Func TestFunc2() EndFunc ;==>TestFunc2 You are making it a lot harder on yourself... Try this (not yet tested): $fullpath = @MyDocumentsDir & '\PPT\Sample PPT.ppt' $oPPT = ObjCreate("PowerPoint.Application") If @error Then MsgBox(0, "Error", "No PowerPoint available") Exit EndIf $oPresentation = $oPPT.Presentations.Open($fullpath) $oPresentation.SlideShowSettings.Run.View If you use that, you can simply use $oPPT.Quit to close PPT Edited September 23, 2014 by Jewtus Link to comment Share on other sites More sharing options...
Ajithkumar Posted September 24, 2014 Author Share Posted September 24, 2014 You are making it a lot harder on yourself... Try this (not yet tested): $fullpath = @MyDocumentsDir & '\PPT\Sample PPT.ppt' $oPPT = ObjCreate("PowerPoint.Application") If @error Then MsgBox(0, "Error", "No PowerPoint available") Exit EndIf $oPresentation = $oPPT.Presentations.Open($fullpath) $oPresentation.SlideShowSettings.Run.View If you use that, you can simply use $oPPT.Quit to close PPT Thanks for your effort. Inline with the above script,while run the script it showing following error. $oPresentation.SlideShowSettings.Run.View $oPresentation^error Error:Variable must be type of "object" Please quide me to resolve the issue. Link to comment Share on other sites More sharing options...
Ajithkumar Posted September 24, 2014 Author Share Posted September 24, 2014 Please give me the solution for the above issue. Link to comment Share on other sites More sharing options...
water Posted September 24, 2014 Share Posted September 24, 2014 Can't you just save the ppt as pps and then run 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 - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
j0kky Posted September 24, 2014 Share Posted September 24, 2014 Try to change: $oPresentation.SlideShowSettings.Run.View to $oPresentation.SlideShowSettings.Run Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs Link to comment Share on other sites More sharing options...
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