Guest User

Untitled

a guest
Sep 6th, 2016
830
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 = "O:\_QEESH\Interní komunikace\Informační tabule\TV\"
  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.     Write-Progress -Activity "Working..."
  35.     Start-Sleep -Seconds 2
  36.     $Application = New-Object -ComObject PowerPoint.Application
  37.     $ppSlideShowDone = 5
  38.     $ppAdvanceOnTime = 2
  39.     $pres = $Application.Presentations.Open($file)
  40.     $pres.SlideShowSettings.AdvanceMode = $ppAdvanceOnTime
  41.     $Pres.SlideShowSettings.StartingSlide = 1
  42.     $pres.SlideShowSettings.EndingSlide = $pres.Slides.Count
  43.     $pres.SlideShowSettings.Run()
  44.     do {
  45.         Start-Sleep -Seconds 2
  46.         Write-Progress -Activity "konec"
  47.     } until ($pres.SlideShowSettings.Run.View.State -eq $ppSlideShowDone)
  48.     Write-Progress -Activity "smycka"
  49. }
RAW Paste Data