powerpoint.ahk 1.6 KB

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