powerpoint.ahk 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. Loop %monitor%{
  51. ;MsgBox insideloop
  52. var2++
  53. ;MsgBox var2(MonitorNumber) val = %var2%
  54. setDisplay(var2, CurrentSlideNumber-1)
  55. CurrentSlideNumber--
  56. var2 := 0
  57. ;MsgBox end of Loop monitor var2 = %var2%
  58. }
  59. }
  60. getCoordinates(MonitorNumber){
  61. coord := 1366*MonitorNumber
  62. return coord
  63. }
  64. ;SetEnv file, C:\Users\SK\Documents\AutoHotKey\1.png
  65. setDisplay(MonitorNumber, PreviousSlideNumber){
  66. global
  67. coord := getCoordinates(MonitorNumber)
  68. SetEnv file, %A_WorkingDir%\temp\Slide%PreviousSlideNumber%.png
  69. ;file := "C:\Users\SK\Documents\AutoHotKey\Slide" . %CurrentSlideNumber% . ".png"
  70. ;file := "C:\Users\SK\Documents\AutoHotKey\1.png"
  71. ;MsgBox %coord%,%MonitorNumber%,%PreviousSlideNumber%,%file%
  72. Gui, 1:destroy
  73. Gui, 1:+AlwaysOnTop +LastFound +Owner -Caption
  74. Gui, 1:Color, Black
  75. Gui, 1:Add, Picture, w%A_ScreenWidth% h-1, %file%
  76. Gui, 1:Show, x%coord% y0 maximize
  77. }
  78. ESC::
  79. objppt.SlideShowWindow.View.Exit
  80. FileRemoveDir, temp, 1
  81. ExitApp