Running one task after ONE FINISHES in windows task scheduler...


  1. Posts : 171
    Win 7 dual boot with win 10
       #1

    Running one task after ONE FINISHES in windows task scheduler...


    I have used windows task schedule to set up small tasks such as opening a website or displaying a jpg. But what I really need to do is this :

    Set up the task scheduler so that once a certain task is FINISHED, the next task automatically runs.
    I have a short video clip of a fire (called movie) that will run with VLC - once that is complete, I want to run a powerpoint presentation immediately after the movie. Right now I have been trying with the custom filers, but can't seem to get it to work. Here is some of the code I was trying, but doesn't seem to work :

    So to recap :

    1) movie first (fireplace clip)
    2) power point second (called after fire)

    <QueryList>
    <Query Id="0" Path="Microsoft-Windows-TaskScheduler/Operational">
    <Select Path="Microsoft-Windows-TaskScheduler/Operational">*[EventData
    [@Name='TaskSuccessEvent'][Data[@Name='after fire']='\movie']]</Select>
    </Query>
    </QueryList>

    Any ideas? also, I have swapped the "After fire" and "movie" around and it still does not work. I wondered if since VLC doesn't shut down automatically if that is hindering it from running powerpoint.
      My Computer


  2. Posts : 2,798
    Windows 7 x64, Vista x64, 8.1 smartphone
       #2

    The usual way of running one task after another is to use a batch file to call each task to begin, in a sequence. Problem here with that, is you want to run the second task only after the first task has become INACTIVE, rather than when it become TERMINATED. Solution then might revolve around using a TIMEOUT in the batch file, since you know the movie is of fixed length. Just set the TIMEOUT to the lenght of the movie.
    Batch file would look something like:
    START TASK1
    TIMEOUT seconds
    TASKKILL /F /IM TASK1
    START TASK2


    If you particulalry want to use Task Scheduler, then I think you would need define both tasks as scheduled tasks and then, with a batch file, execute each scheduled taks with SCHTASKS /run command. ie
    SCHTASKS /run /tn TASK1
    TIMEOUT seconds
    TASKKILL /F /IM TASK1
    SCHTASKS /run /tn TASK2


    Does eithre suggestion get you near a working solution?
      My Computer


  3. Posts : 171
    Win 7 dual boot with win 10
    Thread Starter
       #3

    Is this strictly using a batch file use and not the task scheduler?

    START TASK1
    TIMEOUT seconds
    TASKKILL /F /IM TASK1
    START TASK2

    Here is what I am trying :

    echo.
    echo Waiting
    echo.

    START "" "g:\irfanviewPortable\IrfanViewPortable.exe" "g:\irfanviewPortable\pic1.jpg" /fs

    TIMEOUT /T 5

    START "" "g:\irfanviewPortable\movie.mp4"
    TIMEOUT /T 7

    START "" "g:\irfanviewPortable\IrfanViewPortable.exe" "g:\irfanviewPortable\pic2.jpg" /fs
    TIMEOUT /T 5

    START "" "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "http://www.weather.ca"

    pause >nul


    This works, but not exactly as planned.

    ISSUES:
    1) The pic1 doesn't come up immediately, so I am left with only about 3 second that the image can be seen. This might be because it takes some time to run the program (irfanview). In that case, I can always tag more time on the initial TIMEOUT to compensate.

    2) I want to close irfanview (and all of the other programs) when complete because I am going to be opening other instances of irfanview after the movie and don't want multiple instances of irfanview running. I need some help using TASKKILL.

    3) The move is 6 seconds, so I am not sure what the timer is exactly doing here because it ends early with it, so I have added an additional second to it to make it work.

    4) I want the webpage to open up full screen but firefox doesn't seem to allow that...not sure if there is a work around or not.

    5) Lastly, I am going to code a python script to populate this batch file, hopefully it will be uneventful...
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 17:10.
Find Us