powerpoint.ahk 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. ;objppt.Export("C:\Users\SK\Documents\AutoHotKey\temp",FilterName:="png",1366,768)
  12. ;"C:\Users\SK\Documents\AutoHotKey\temp", "E:\AHK\AutoHotKeyScripts\temp"
  13. ;path = %A_WorkingDir%\temp
  14. ;objppt.Export(path, FilterName:="png",1366,768)
  15. ;Loop %TotalSlides%{
  16. ;var++
  17. ;MsgBox %var%
  18. ;saveppt := objppt.Slides(var).Export(A_ScriptDir . "\temp\" . var . ".png", "PNG",1366,768)
  19. ;}
  20. ;pt := ppt.ActivePresentation.(test, ppSaveAsPNG)
  21. SysGet, MonitorCount, MonitorCount
  22. ;MsgBox %MonitorCount%
  23. ;MsgBox saved
  24. ;MsgBox inside %MonitorCount%
  25. ppt := objppt.SlideShowSettings
  26. ppt.Run
  27. ;monitorDisplay(objppt, MonitorCount)
  28. Return
  29. Right::
  30. SlideNum :=% objppt.SlideShowWindow.View.Slide.SlideIndex
  31. ;MsgBox %SlideNum%
  32. saveppt := objppt.Slides(SlideNum).Export(A_ScriptDir . "\temp\" . SlideNum . ".png", "PNG",1366,768)
  33. objppt.SlideShowWindow.View.Next
  34. monitorDisplay(objppt, MonitorCount)
  35. return
  36. Left::
  37. objppt.SlideShowWindow.View.Previous
  38. monitorDisplay(objppt, MonitorCount)
  39. return
  40. monitorDisplay(objppt, MonitorCount){
  41. try{
  42. CurrentSlideNumber :=% objppt.SlideShowWindow.View.Slide.SlideIndex
  43. }
  44. catch{
  45. FileRemoveDir, temp, 1
  46. ExitApp
  47. }
  48. ;MsgBox %CurrentSlideNumber% is the current slide
  49. monitor := MonitorCount-1
  50. var2 := 0
  51. Loop %monitor%{
  52. ;MsgBox insideloop
  53. var2++
  54. ;MsgBox var2(MonitorNumber) val = %var2%
  55. setDisplay(var2, CurrentSlideNumber-1)
  56. CurrentSlideNumber--
  57. ;var2 := 0
  58. ;MsgBox end of Loop monitor var2 = %var2%
  59. }
  60. }
  61. getCoordinates(MonitorNumber){
  62. ;coord := 1366*MonitorNumber
  63. if(MonitorNumber = 1)
  64. return 1920
  65. if(MonitorNumber = 2)
  66. return 3286
  67. ;return coord
  68. }
  69. ;SetEnv file, C:\Users\SK\Documents\AutoHotKey\1.png
  70. setDisplay(MonitorNumber, PreviousSlideNumber){
  71. global
  72. coord := getCoordinates(MonitorNumber)
  73. SetEnv file, %A_WorkingDir%\temp\%PreviousSlideNumber%.png
  74. ;file := "C:\Users\SK\Documents\AutoHotKey\Slide" . %CurrentSlideNumber% . ".png"
  75. ;file := "C:\Users\SK\Documents\AutoHotKey\1.png"
  76. ;MsgBox %coord%,%MonitorNumber%,%PreviousSlideNumber%,%file%
  77. Gui, %MonitorNumber%:destroy
  78. Gui, %MonitorNumber%:+AlwaysOnTop +LastFound +Owner -Caption
  79. Gui, %MonitorNumber%:Color, Black
  80. Gui, %MonitorNumber%:Add, Picture, w%A_ScreenWidth% h-1, %file%
  81. Gui, %MonitorNumber%:Show, x%coord% y0 maximize
  82. }
  83. ESC::
  84. objppt.SlideShowWindow.View.Exit
  85. FileRemoveDir, temp, 1
  86. ExitApp