Guest User

Untitled

a guest
Sep 6th, 2016
173
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Defining remote and local path to folders with presentation
  2. $RemotePath = $share
  3. $LocalPath = C:\ppt
  4.  
  5. #Defining powerpoint aplication and environment variables
  6.  
  7.  
  8.  
  9. $soubor = Get-ChildItem $LocalPath -File
  10. $ppt = ($Soubor | Select-Object FullName)
  11.  
  12. $RemFile = (Get-ChildItem $RemotePath -file)
  13. $LocFile = (Get-ChildItem $LocalPath -File)
  14.  
  15. "
  16. $RemotePath shows $RemFile files to copy
  17. "
  18. "-----------------------------------------------------"
  19.  
  20. #Checking date and then copying file from RemotePath to LocalPath
  21. foreach ($file in $RemFile) {
  22.     Copy-Item -Path $file.fullname -Destination $LocalPath -Recurse
  23.     " [*] $file "  
  24. }
  25.  
  26. "
  27. $LocalPath shows $Locfile to run
  28. "
  29. Write-Output $ppt
  30.  
  31.  
  32.  
  33. foreach ($file in $soubor) {
  34.     $Application = New-Object -ComObject PowerPoint.Application
  35.     $ppSlideShowDone = 5
  36.     $ppAdvanceOnTime = 2
  37.     $pres = $Application.Presentations.Open($file.name)
  38.     $pres.SlideShowSettings.Run()
  39.     $pres.SlideShowSettings.AdvanceMode = $ppAdvanceOnTime
  40.     $Pres.SlideShowSettings.StartingSlide = 1
  41.     $pres.SlideShowSettings.EndingSlide = $pres.Slides.Count
  42.     do {
  43.         Start-Sleep -second 2
  44.     } until ($pres.SlideShowSettings.Run.View.State -eq $ppSlideShowDone)
  45. }
RAW Paste Data