Jump to content

rg20

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by rg20

  1. I wish I had that option, I might have to do a keystroke temporary save, then update save and delete the temp
  2. use your PPT script and try the below script code but before you run it, just open PowerPoint, you should get a new presentation named "Presentation 1 - Microsoft Powerpoint" but don't save it to a directory you can even substitue the full presentation name. Once it's saved, it will then recognize the file. #include "Powerpoint.au3" #include "Visio.au3" #include <misc.au3> #include <File.au3> #include <Debug.au3> $oPPT =_PPT_Open() $Presentations = _PPT_PresentationList($oPPT) _ArrayDisplay($Presentations, "Sorted tree") $oPresentation = _PPT_PresentationAttach("Presentation","title", True) If @error Then MsgBox($MB_SYSTEMMODAL, "PowerPoint UDF: _PPT_PresentationAttach Example", "'" & $oPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _PPT_Close($oPPT) Exit EndIf adding your messages into the PPT includes shows >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "\\abbvienet.com\data\R&D\R478\Excel Clinical Schedule Scripts\ppttest.au3" "\\abbvienet.com\data\R&D\R478\Excel Clinical Schedule Scripts\Powerpoint.au3" (144) : ==> Variable must be of type "Object".: ConsoleWrite("Presentation Name" & $oPresentation.Name & @CRLF) ConsoleWrite("Presentation Name" & $oPresentation^ ERROR >Exit code: 1 Time: 0.6098
  3. I have tried this and experienced the same bug. I think there is an issue with the attach when the file is not saved, IE no directory listed Func _PPT_PresentationAttach($sString, $sMode = Default)     Local $oPresentation, $iCount = 0, $sCLSID_Presentation = "{91493444-5A91-11CF-8700-00AA0060263B}" ; Microsoft.Office.Interop.PowerPoint.PresentationClass     If $sMode = Default Then $sMode = "FilePath"     While True         $oPresentation = ObjGet("", $sCLSID_Presentation, $iCount + 1)         If @error Then Return SetError(1, @error, 0) <-------------------This is the line kicking back the error message         Switch $sMode             Case "filename"                 If $oPresentation.Name = $sString Then Return $oPresentation             Case "filepath"                 If $oPresentation.FullName = $sString Then Return $oPresentation             Case "title"                 If $oPresentation.Application.Caption = $sString Then Return $oPresentation             Case Else                 Return SetError(2, 0, 0)         EndSwitch         $iCount += 1     WEnd EndFunc   ;==>_PPT_PresentationAttach I get this
  4. Thanks for the update, I wasn't sure if I was going crazy. I would love to have the new version for testing
  5. Awesome start, but missed a few things and still have one issue If you open the PPT without saving it first, it seems like the environment can find it, but the attach can't attach to it I created a slide deck named "hey you" in my documents folder then opened Powerpoint without saving it, so the default name was Presentation1 - Microsoft Powerpoint so my path looks like this Row|Col 0|Col 1|Col 2 [0]||Presentation1| [1]||hey you.pptx|C:\Users\....\Documents then using this code, I put the Powerpoint.au3 in my local directory for now #include "Powerpoint.au3" #include "Visio.au3" #include <misc.au3> #include <File.au3> #include <Debug.au3> $oPPT =_PPT_Open() $Presentations = _PPT_PresentationList($oPPT) _ArrayDisplay($Presentations, "Sorted tree") $oPresentation = _PPT_PresentationAttach("Presentation","title", True) _PPT_SlideAdd($oPresentation) _PPT_PresentationSaveAs($oPresentation, "C:\a\test" ) $oPresentation = _PPT_PresentationAttach("hey you","title", True) _PPT_SlideAdd($oPresentation) _PPT_PresentationSaveAs($oPresentation, "C:\a\test2" ) the attach with the "Presentation" does not get a second slide or saved The "hey you" presentation does and is saved to the indicated pat as expected. any thoughts?
  6. Thank you Water for your helpful advice, I remvoed the closesave function and added the following $oPPT =_PPT_Open() _PPT_PresentationAttach($oPPT,"partialtitle") _PPT_PresentationSaveAs($oPPT, "c:\a\test") _DebugOut("Saved and closed Powerpoint") When I was done, I could not find a file in the directory C:\a. I would expect to see test.ppt Not sure if an object is being returned or I'm doing something wrong. I modified the presentationAttach script to allow for partial title search as the number keeps increasing. Func _PPT_PresentationAttach($sString, $sMode = Default) Local $oPresentation, $iCount = 0, $sCLSID_Presentation = "{91493444-5A91-11CF-8700-00AA0060263B}" ; Microsoft.Office.Interop.PowerPoint.PresentationClass If $sMode = Default Then $sMode = "FilePath" While True $oPresentation = ObjGet("", $sCLSID_Presentation, $iCount + 1) If @error Then Return SetError(1, @error, 0) Switch $sMode Case "filename" If $oPresentation.Name = $sString Then Return $oPresentation Case "filepath" If $oPresentation.FullName = $sString Then Return $oPresentation Case "title" If $oPresentation.Application.Caption = $sString Then Return $oPresentation Case "partialtitle" If StringInStr($oPresentation.Application.Caption,$sString) Then Return $oPresentation Case Else Return SetError(2, 0, 0) EndSwitch $iCount += 1 WEnd EndFunc ;==>_PPT_PresentationAttach
  7. You are correct, I was not calling that method as I had thought. (I have updated the original post to correct that) I am using the controlsend. The reason I use this is because Visio lauches a powerpoint app automatically, I seem to have an issue trying to get a handle on that application
  8. Greetings all, I have an app that runs fine in windows 7 but not windows 10. issue : when entering the filename to save, it enters it into the saveAs dialog box, but Office still tries to save as "Diagram1" or "Presentation1" $FileError = "" MonitorProcess2("VISIO") _DebugOut("Visio Done") MonitorProcess2("POWERPNT") _debugOut("Powerpoint Done") CloseSave($FileSavePathName, $SaveAsWindow) _DebugOut("Saved and closed Powerpoint") _VSO_DocumentSave($objVisioFile) while not _VSO_DocumentSaved($objVisioFile) WEnd _VSO_VisioClose($objVisioFile) _DebugOut("Saved and closed Visio") else _DebugOut("Filename Does not exist = "& $FilePathName) EndIf the monitor process2 just makes sure the processes are complete before trying to save the files. The closeSave function is below, but since I am opening the file with the proper name, this is not an issue func CloseSave($SaveFile, $SaveAsWindow) _DebugOut("Save File ") _DebugOut($SaveFile) send("!{F4}") send ("!S") $title = WinGetTitle("[ACTIVE]") _DebugOut("WINDOW - current window is Powerpoint to enter filename " & $title) while not ($title = $SaveAsWindow) $title = WinGetTitle("[ACTIVE]") wend ControlSetText ($SaveAsWindow,"","[CLASS:Edit; INSTANCE:1]",$SaveFile) send ("!S") $title = WinGetTitle("[ACTIVE]") while not StringInStr($title,"Visio") $title = WinGetTitle("[ACTIVE]") wend EndFunc
  9. Sorry I have not had time to thoroughly test this, my quick test did not return the correct window, but I do need to verify it in more detail. I really appreciate the effort to modify the scripts.
  10. I added an adLIbRegister at the beginning of the function, which will execute another. In the second function, I did a check for popups or something to indicate a failure, then you can return a value. While that value is True, continue or however you want to state it if all functions complete adLibUnregister
  11. For further reference, I added the following Func _PPT_PresentationSaveAs(ByRef $obj, $filename) If IsObj($obj) <> 1 Then SetError(1) Return 0 Else ConsoleWrite("Saving Object as before " & $obj.Application.Caption & @LF) $obj.SaveAs($filename) ConsoleWrite("Saving Object as After " & $obj.Application.Caption & @LF) Endif EndFunc and got the following output Saving Object as before Presentation1 - Microsoft PowerPoint Saving Object as After Presentation1 - Microsoft PowerPoint
  12. Thank you for the move, sorry for the mislabeling
  13. Hello All, I am running into an issue hopefully the AutoIT gods are able to help I am running an app that automatically opens a PowerPoint slide. I am using the Powerpoint.au3 scripts and trying to attach to the slide I need. I modified the attach function to read as Func _PPT_PresentationAttach($sString, $sMode = Default) Local $oPresentation, $iCount = 0, $sCLSID_Presentation = "{91493444-5A91-11CF-8700-00AA0060263B}" ; Microsoft.Office.Interop.PowerPoint.PresentationClass If $sMode = Default Then $sMode = "FilePath" While True $oPresentation = ObjGet("", $sCLSID_Presentation, $iCount + 1) ConsoleWrite($oPresentation.Application.Caption & @LF) If @error Then Return SetError(1, @error, 0) Switch $sMode Case "filename" If $oPresentation.Name = $sString Then Return $oPresentation Case "filepath" If $oPresentation.FullName = $sString Then Return $oPresentation Case "title" If $oPresentation.Application.Caption = $sString Then Return $oPresentation Case "partialTitle" MsgBox(1,"","Partial Title - " & $sString & " Against - " & $oPresentation.Application.Caption) If StringInStr($oPresentation.Application.Caption, $sString) Then Return $oPresentation Case Else Return SetError(2, 0, 0) EndSwitch $iCount += 1 WEnd EndFunc ;==>_PPT_PresentationAttach I am calling that script as $title = WinGetTitle("[ACTIVE]") _DebugOut("WINDOW - current window is "& $title) while not (StringInStr ($title , "Presentation")) send ("!{TAB}") $title = WinGetTitle("[ACTIVE]") _DebugOut("WINDOW - current window is (need powerpoint)" & $title) sleep(500) wend $objPPTCreated = _PPT_PresentationAttach("Presentation","partialTitle") ConsoleWrite("Borg = " & _PPT_SlideCount($objPPSBorg) & " New = " & _PPT_SlideCount($objPPTCreated) &" with caption = " & $objPPTCreated.Application.Caption & @LF) So one file that is open will have a name that is known call it "Borg" for now The other is new, so it will have the word "Presentation" in the title. When I come out of the script I get this in the console Borg = 3 New = 3 with caption = Presentation7 - Microsoft PowerPoint So Borg should have 3 slides, New should have 1, not 3, but the caption is correct. These are 2 instances of Powerpoint, not one powerpoint with 2 books. I then proceed to save with $newPPT = _PPT_PresentationSaveAs($objPPTCreated,$SaveFile) but the Borg book gets saved with the new name, not the new presentation. Thoughts?
×
×
  • Create New...