powerpoint.ahk 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. f5::
  2. try{
  3. ppt := ComObjActive("PowerPoint.Application")
  4. objppt := ppt.ActivePresentation
  5. TotalSlides:=% objppt.Slides.Count
  6. FileCreateDir, temp
  7. }
  8. catch e {
  9. MsgBox % "Error in " e.Message ", which was called at line " e.Line
  10. }
  11. Loop %TotalSlides%{
  12. var++
  13. ;MsgBox %var%
  14. saveppt := objppt.Slides(var).Export(A_ScriptDir . "\temp\" . var . ".png", "PNG")
  15. }
  16. ;pt := ppt.ActivePresentation.(test, ppSaveAsPNG)
  17. SysGet, MonitorCount, MonitorCount
  18. ;MsgBox %MonitorCount%
  19. MsgBox saved
  20. ;MsgBox inside %MonitorCount%
  21. ppt := objppt.SlideShowSettings
  22. ppt.Run
  23. ;monitorDisplay(objppt, MonitorCount)
  24. Return
  25. Right::
  26. objppt.SlideShowWindow.View.Next
  27. monitorDisplay(objppt, MonitorCount)
  28. return
  29. monitorDisplay(objppt, MonitorCount){
  30. CurrentSlideNumber :=% objppt.SlideShowWindow.View.Slide.SlideIndex
  31. ;MsgBox %CurrentSlideNumber% is the current slide
  32. monitor := MonitorCount-1
  33. Loop %monitor%{
  34. ;MsgBox insideloop
  35. var2++
  36. ;MsgBox var2(MonitorNumber) val = %var2%
  37. setDisplay(var2, CurrentSlideNumber-1)
  38. CurrentSlideNumber--
  39. var2 := 0
  40. ;MsgBox end of Loop monitor var2 = %var2%
  41. }
  42. }
  43. getCoordinates(MonitorNumber){
  44. coord := 1920*MonitorNumber
  45. return coord
  46. }
  47. ;SetEnv file, C:\Users\SK\Documents\AutoHotKey\1.png
  48. setDisplay(MonitorNumber, PreviousSlideNumber){
  49. global
  50. coord := getCoordinates(MonitorNumber)
  51. SetEnv file, C:\Users\SK\Documents\AutoHotKey\temp\%PreviousSlideNumber%.png
  52. ;file := "C:\Users\SK\Documents\AutoHotKey\" . %CurrentSlideNumber% . ".png"
  53. ;file := "C:\Users\SK\Documents\AutoHotKey\1.png"
  54. ;MsgBox %coord%,%MonitorNumber%,%PreviousSlideNumber%,%file%
  55. Gui, 1:destroy
  56. Gui, 1:+AlwaysOnTop +LastFound +Owner -Caption
  57. Gui, 1:Color, Black
  58. Gui, 1:Add, Picture, w%A_ScreenWidth% h-1, %file%
  59. Gui, 1:Show, x%coord% y0 maximize
  60. }