+ Post New Thread
Results 1 to 9 of 9
Scripts Thread, Script to autostart PPTX dependant on day in Coding and Web Development; Hi Ive basically got a script that loads a power point from the network, copys it to C: and loops ...
  1. #1

    Join Date
    Mar 2014
    Location
    scunthorpe
    Posts
    14
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Lightbulb Script to autostart PPTX dependant on day

    Hi

    Ive basically got a script that loads a power point from the network, copys it to C: and loops it until it detects the file has been modified with a newer version. At this point, the machine is restarted, it auto logs in, copys the new script to C:, replacing the old one and then plays it on a loop until it is revised again.

    I now want to expand that if possible so it could have 6 files (one for monday to friday and a master file). The master file would be the one it opens if it is the newest modification date, else it would open the relevant file per day.

    As it stands we have 18 VDUs in different areas of the academy with the below script running and im editing the PPT per day (the PPT is repeated weekly) to display relevant info for that area, however they want all 18 VDUs to display the same info on occasion.

    Any Ideas?

    On Error Resume Next

    WScript.sleep 120000

    Const ppAdvanceOnTime = 2 ' Run according to timings (not clicks)
    Const ppShowTypeKiosk = 3 ' Run in "Kiosk" mode (fullscreen)
    Const ppAdvanceTime = 5 ' Show each slide for 10 seconds

    ' Open the two power point files to work with them.
    Set objFileSys = CreateObject("Scripting.FileSystemObject")
    Set CurrentPPT = objFileSys.GetFile("c:\presentations\FOXVDU01.pptx ")
    Set NewPPT = objFileSys.GetFile("y:\presentations\FOXVDU01.pptx ")

    ' Open the shell object for passing commands.
    Set objShell = CreateObject("WScript.Shell")

    Set objPPT = CreateObject("PowerPoint.Application")
    objPPT.Visible = True

    Set objPresentation = objPPT.Presentations.Open(currentPPT.Path)

    ' Apply powerpoint settings
    objPresentation.Slides.Range.SlideShowTransition.A dvanceOnTime = TRUE
    objPresentation.SlideShowSettings.AdvanceMode = ppAdvanceOnTime
    objPresentation.SlideShowSettings.ShowType = ppShowTypeKiosk
    objPresentation.Slides.Range.SlideShowTransition.A dvanceTime = ppAdvanceTime
    objPresentation.SlideShowSettings.LoopUntilStopped = True

    ' Run the slideshow
    Set objSlideShow = objPresentation.SlideShowSettings.Run.View

    Do Until Err <> 0

    If NewPPT.DateLastModified > CurrentPPT.DateLastModified Then
    objPresentation.Close
    objFileSys.CopyFile NewPPT, CurrentPPT, True
    Set CurrentPPT = objFileSys.GetFile("c:\presentations\FOXVDU01.pptx ")
    Set objSlideShow = objPresentation.SlideShowSettings.Run.View

    End If

    Loop

    objPresentation.Saved = False
    objPresentation.Close
    objPPT.Quit

    Thanks

    Steve

  2. #2

    Join Date
    Mar 2014
    Location
    scunthorpe
    Posts
    14
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0
    FYI

    On Error Resume Next

    WScript.sleep 90000

    Const ppAdvanceOnTime = 2 ' Run according to timings (not clicks)
    Const ppShowTypeKiosk = 3 ' Run in "Kiosk" mode (fullscreen)
    Const ppAdvanceTime = 5 ' Show each slide for 10 seconds

    ' Open the 4 power point files to work with them.
    Set objFileSys = CreateObject("Scripting.FileSystemObject")
    Set CurrentPPT = objFileSys.GetFile("c:\presentations\FOXVDU01.pptx ")
    Set CurrentPPT2 = objFileSys.GetFile("c:\presentations\master.pptx")
    Set NewPPT = objFileSys.GetFile("y:\presentations\FOXVDU01.pptx ")
    Set NewPPT2 = objFileSys.GetFile("y:\presentations\master.pptx")


    'Checks modified date of the powerpoint and replaces it as needed.
    If NewPPT.DateLastModified > CurrentPPT.DateLastModified Then
    objFileSys.CopyFile NewPPT, CurrentPPT, True
    End If

    'Checks modified date of the powerpoint and replaces it as needed.
    If NewPPT2.DateLastModified > CurrentPPT2.DateLastModified Then
    objFileSys.CopyFile NewPPT2, CurrentPPT2, True
    End If

    ' Open the shell object for passing commands.
    Set objShell = CreateObject("WScript.Shell")

    Set objPPT = CreateObject("PowerPoint.Application")
    objPPT.Visible = True


    'Checks modified date of each of the powerpoints and sets current path to the newest powerpoint.
    If CurrentPPT.DateLastModified > CurrentPPT2.DateLastModified Then
    Set objPresentation = objPPT.Presentations.Open(currentPPT.Path)
    Else
    Set objPresentation = objPPT.Presentations.Open(currentPPT2.Path)
    End If

    ' Apply powerpoint settings
    objPresentation.Slides.Range.SlideShowTransition.A dvanceOnTime = TRUE
    objPresentation.SlideShowSettings.AdvanceMode = ppAdvanceOnTime
    objPresentation.SlideShowSettings.ShowType = ppShowTypeKiosk
    objPresentation.Slides.Range.SlideShowTransition.A dvanceTime = ppAdvanceTime
    objPresentation.SlideShowSettings.LoopUntilStopped = True

    ' Run the slideshow
    Set objSlideShow = objPresentation.SlideShowSettings.Run.View

    Do Until Err <> 0

    Loop

    objPresentation.Saved = False
    objPresentation.Close
    objPPT.Quit



    This script looks at 2 files, one for the TV and a master. It then copies them from the serever share to the OS and replaces any older version of the file. It then opens which ever was modified last and will display on a powerpoint in a loop until the machine is restarted. At that point it will check for a newer version of the file. Yes there isn't a file per day but in theory, it could be tweaked to allow for that. This just gives whole school broadcast on multiple VDUs or individual usage - dependant on which file was modified last.

    Hope ithelps someone in the future.

  3. #3

    3s-gtech's Avatar
    Join Date
    Mar 2009
    Location
    Wales
    Posts
    2,821
    Thank Post
    146
    Thanked 572 Times in 516 Posts
    Rep Power
    154
    Or try Xibo! Gives the control without the scripting; with schedules, individual screen control, etc etc. It's free and doesn't need much of a server to run.

  4. #4

    Join Date
    Mar 2014
    Location
    scunthorpe
    Posts
    14
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0
    I m currently expanding on the script I made but having no knowledge on scripts - its a learning curve.

    part of the script reads the day and then gives me a constant called "TodaysPPT", which I use later in the script.

    CurrentDay = WeekdayName(Weekday((dtmValue)+2))

    wscript.echo CurrentDay

    TodaysPPT = "CurrentMaster+(CurrentDay)"

    wscript.echo TodaysPPT

    Basically, for this test, I want it to echo the day back which it does and then create the constant "TodaysPPT" which should have a value of the words "CurrentMaster" and the day it just returned. For example, On Monday, it would return a value for TodaysPPT of CurrentMasterMonday. Friday would be CurrentMasterFriday. I just am not quite sure of how to add both parts to get the correct value for "TodaysPPT".

    Thanks

    Steve

    I Will post the complete script after this. Fully automated Powerpoints across site with no need or third party software or maintenance by IT. All from a local dive and day dependant.

  5. #5
    p858snake's Avatar
    Join Date
    Dec 2008
    Location
    Queensland
    Posts
    1,490
    Thank Post
    37
    Thanked 175 Times in 151 Posts
    Blog Entries
    2
    Rep Power
    51
    Have a look at ShowPoint maybe?

  6. #6

    Join Date
    Mar 2014
    Location
    scunthorpe
    Posts
    14
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Quote Originally Posted by p858snake View Post
    Have a look at ShowPoint maybe?
    That looks good if it was one powerpoint I was using, however I want one per day. I just need to sort the above line out and then mine will do as the suggested app does except it waits for reboot to update and will look at a file relevant to that device only (NetBIOS name) and a power point per day, playing either the powerpoint for that day OR the specific one for that device, dependant on which as modified last.

    thanks though.

  7. #7

    Join Date
    Mar 2014
    Location
    scunthorpe
    Posts
    14
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0
    RESOVLED

    CurrentDay = WeekdayName(Weekday((dtmValue)+2))
    wscript.echo CurrentDay
    TodaysPPT = "CurrentMaster" & CurrentDay
    wscript.echo TodaysPPT

  8. #8

    Join Date
    Mar 2014
    Location
    scunthorpe
    Posts
    14
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0
    On Error Resume Next

    WScript.sleep 90000
    Const ppAdvanceOnTime = 2 ' Run according to timings (not clicks)
    Const ppShowTypeKiosk = 3 ' Run in "Kiosk" mode (fullscreen)
    Const ppAdvanceTime = 5 ' Show each slide for 10 seconds



    ' ------------------Open the 6 power point files to work with them - Old and new versions------------.
    Set objFileSys = CreateObject("Scripting.FileSystemObject")
    Set CurrentPPT = objFileSys.GetFile("c:\presentations\FOXVDU01.pptx ")
    Set CurrentMasterMonday = objFileSys.GetFile("c:\presentations\MasterMonday. pptx")
    Set CurrentMasterTuesday = objFileSys.GetFile("c:\presentations\MasterTuesday .pptx")
    Set CurrentMasterWednesday = objFileSys.GetFile("c:\presentations\MasterWednesd ay.pptx")
    Set CurrentMasterThursday = objFileSys.GetFile("c:\presentations\MasterThursda y.pptx")
    Set CurrentMasterFriday = objFileSys.GetFile("c:\presentations\MasterFriday. pptx")
    Set NewPPT = objFileSys.GetFile("y:\presentations\FOXVDU01.pptx ")
    Set NewMasterMonday = objFileSys.GetFile("y:\presentations\MasterMonday. pptx")
    Set NewMasterTuesday = objFileSys.GetFile("y:\presentations\MasterTuesday .pptx")
    Set NewMasterWednesday = objFileSys.GetFile("y:\presentations\MasterWednesd ay.pptx")
    Set NewMasterThursday = objFileSys.GetFile("y:\presentations\MasterThursda y.pptx")
    Set NewMasterFriday = objFileSys.GetFile("y:\presentations\MasterFriday. pptx")




    '------------------Checks modified date of the VDU powerpoint and replaces it as needed-------------------.
    If NewPPT.DateLastModified > CurrentPPT.DateLastModified Then
    objFileSys.CopyFile NewPPT, CurrentPPT, True
    End If
    'Checks modified date of the MasterMonday powerpoint and replaces it as needed.
    If NewMasterMonday.DateLastModified > CurrentMasterMonday.DateLastModified Then
    objFileSys.CopyFile NewMasterMonday, CurrentMasterMonday, True
    End If
    'Checks modified date of the MasterTuesday powerpoint and replaces it as needed.
    If NewMasterTuesday.DateLastModified > CurrentMasterTuesday.DateLastModified Then
    objFileSys.CopyFile NewMasterTuesday, CurrentMasterTuesday, True
    End If
    'Checks modified date of the MasterWednesday powerpoint and replaces it as needed.
    If NewMasterWednesday.DateLastModified > CurrentMasterWednesday.DateLastModified Then
    objFileSys.CopyFile NewMasterWednesday, CurrentMasterWednesday, True
    End If
    'Checks modified date of the MasterThursday powerpoint and replaces it as needed.
    If NewMasterThursday.DateLastModified > CurrentMasterThursday.DateLastModified Then
    objFileSys.CopyFile NewMasterThursday, CurrentMasterThursday, True
    End If
    'Checks modified date of the MasterFriday powerpoint and replaces it as needed.
    If NewMasterFriday.DateLastModified > CurrentMasterFriday.DateLastModified Then
    objFileSys.CopyFile NewMasterFriday, CurrentMasterFriday, True
    End If



    ' ---------------- Reads the current day from the system and assigns current PPT Day to TodaysPPT------------.
    CurrentDay = WeekdayName(Weekday((dtmValue)+2))
    TodaysPPT = "Master" & CurrentDay & ".pptx"

    Set Today = objFileSys.GetFile("C:\presentations\" & TodaysPPT)


    ' Open the shell object for passing commands.
    Set objShell = CreateObject("WScript.Shell")
    Set objPPT = CreateObject("PowerPoint.Application")
    objPPT.Visible = True



    '--------------Checks modified date of each of the powerpoints and sets current path to the newest powerpoint--------------.
    If CurrentPPT.DateLastModified > Today.DateLastModified Then
    Set objPresentation = objPPT.Presentations.Open(currentPPT.Path)
    Else
    Set objPresentation = objPPT.Presentations.Open(Today.Path)
    End If
    ' Apply powerpoint settings
    objPresentation.Slides.Range.SlideShowTransition.A dvanceOnTime = TRUE
    objPresentation.SlideShowSettings.AdvanceMode = ppAdvanceOnTime
    objPresentation.SlideShowSettings.ShowType = ppShowTypeKiosk
    objPresentation.Slides.Range.SlideShowTransition.A dvanceTime = ppAdvanceTime
    objPresentation.SlideShowSettings.LoopUntilStopped = True
    ' Run the slideshow
    Set objSlideShow = objPresentation.SlideShowSettings.Run.View
    Do Until Err <> 0
    Loop
    objPresentation.Saved = False
    objPresentation.Close
    objPPT.Quit
    COMPLETE SCRIPT IF ANYONE EVER NEEDS IT

  9. Thanks to sjboyington from:

    fiza (10th March 2014)

  10. #9

    Join Date
    Mar 2014
    Location
    scunthorpe
    Posts
    14
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Quote Originally Posted by sjboyington View Post
    On Error Resume Next

    WScript.sleep 90000
    Const ppAdvanceOnTime = 2 ' Run according to timings (not clicks)
    Const ppShowTypeKiosk = 3 ' Run in "Kiosk" mode (fullscreen)
    Const ppAdvanceTime = 5 ' Show each slide for 10 seconds



    ' ------------------Open the 6 power point files to work with them - Old and new versions------------.
    Set objFileSys = CreateObject("Scripting.FileSystemObject")
    Set CurrentPPT = objFileSys.GetFile("c:\presentations\FOXVDU01.pptx ")
    Set CurrentMasterMonday = objFileSys.GetFile("c:\presentations\MasterMonday. pptx")
    Set CurrentMasterTuesday = objFileSys.GetFile("c:\presentations\MasterTuesday .pptx")
    Set CurrentMasterWednesday = objFileSys.GetFile("c:\presentations\MasterWednesd ay.pptx")
    Set CurrentMasterThursday = objFileSys.GetFile("c:\presentations\MasterThursda y.pptx")
    Set CurrentMasterFriday = objFileSys.GetFile("c:\presentations\MasterFriday. pptx")
    Set NewPPT = objFileSys.GetFile("y:\presentations\FOXVDU01.pptx ")
    Set NewMasterMonday = objFileSys.GetFile("y:\presentations\MasterMonday. pptx")
    Set NewMasterTuesday = objFileSys.GetFile("y:\presentations\MasterTuesday .pptx")
    Set NewMasterWednesday = objFileSys.GetFile("y:\presentations\MasterWednesd ay.pptx")
    Set NewMasterThursday = objFileSys.GetFile("y:\presentations\MasterThursda y.pptx")
    Set NewMasterFriday = objFileSys.GetFile("y:\presentations\MasterFriday. pptx")




    '------------------Checks modified date of the VDU powerpoint and replaces it as needed-------------------.
    If NewPPT.DateLastModified > CurrentPPT.DateLastModified Then
    objFileSys.CopyFile NewPPT, CurrentPPT, True
    End If
    'Checks modified date of the MasterMonday powerpoint and replaces it as needed.
    If NewMasterMonday.DateLastModified > CurrentMasterMonday.DateLastModified Then
    objFileSys.CopyFile NewMasterMonday, CurrentMasterMonday, True
    End If
    'Checks modified date of the MasterTuesday powerpoint and replaces it as needed.
    If NewMasterTuesday.DateLastModified > CurrentMasterTuesday.DateLastModified Then
    objFileSys.CopyFile NewMasterTuesday, CurrentMasterTuesday, True
    End If
    'Checks modified date of the MasterWednesday powerpoint and replaces it as needed.
    If NewMasterWednesday.DateLastModified > CurrentMasterWednesday.DateLastModified Then
    objFileSys.CopyFile NewMasterWednesday, CurrentMasterWednesday, True
    End If
    'Checks modified date of the MasterThursday powerpoint and replaces it as needed.
    If NewMasterThursday.DateLastModified > CurrentMasterThursday.DateLastModified Then
    objFileSys.CopyFile NewMasterThursday, CurrentMasterThursday, True
    End If
    'Checks modified date of the MasterFriday powerpoint and replaces it as needed.
    If NewMasterFriday.DateLastModified > CurrentMasterFriday.DateLastModified Then
    objFileSys.CopyFile NewMasterFriday, CurrentMasterFriday, True
    End If



    ' ---------------- Reads the current day from the system and assigns current PPT Day to TodaysPPT------------.
    currdate = now()

    currid = weekday(currdate)

    CurrentDay = weekdayname(currid)
    TodaysPPT = "Master" & CurrentDay & ".pptx"
    Set Today = objFileSys.GetFile("C:\presentations\" & TodaysPPT)
    ' Open the shell object for passing commands.
    Set objShell = CreateObject("WScript.Shell")
    Set objPPT = CreateObject("PowerPoint.Application")
    objPPT.Visible = True

    '--------------Checks modified date of each of the powerpoints and sets current path to the newest powerpoint--------------.
    If CurrentPPT.DateLastModified > Today.DateLastModified Then
    Set objPresentation = objPPT.Presentations.Open(currentPPT.Path)
    Else
    Set objPresentation = objPPT.Presentations.Open(Today.Path)
    End If
    ' Apply powerpoint settings
    objPresentation.Slides.Range.SlideShowTransition.A dvanceOnTime = TRUE
    objPresentation.SlideShowSettings.AdvanceMode = ppAdvanceOnTime
    objPresentation.SlideShowSettings.ShowType = ppShowTypeKiosk
    objPresentation.Slides.Range.SlideShowTransition.A dvanceTime = ppAdvanceTime
    objPresentation.SlideShowSettings.LoopUntilStopped = True
    ' Run the slideshow
    Set objSlideShow = objPresentation.SlideShowSettings.Run.View
    Do Until Err <> 0
    Loop
    objPresentation.Saved = False
    objPresentation.Close
    objPPT.Quit

    COMPLETE SCRIPT IF ANYONE EVER NEEDS IT
    My apologies but the get day coding was wrong. Above is the final completed script if anyone ever needs it. Looks at 6 powerpoints. Mon - Fri and a netbios name specific and the runs either the specific or relevant day dependent on date modified.

    Thanks

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 1
    Last Post: 22nd February 2011, 10:45 AM
  2. Script to sort by name on start menu
    By FN-GM in forum Scripts
    Replies: 21
    Last Post: 17th October 2007, 05:33 PM
  3. Replies: 2
    Last Post: 11th May 2007, 02:33 PM
  4. Script to get all file on a url
    By Midget in forum Scripts
    Replies: 5
    Last Post: 23rd January 2007, 01:10 PM
  5. Replies: 4
    Last Post: 23rd November 2006, 09:33 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •