Jump to content

Problems with Powerpoint and AutoIT


Recommended Posts

Hey guys, 

I have written up a program that opens a powerpoint show, it is essentially being used as a screensaver for the reason that it kicks off when the computer is idle for x amount of time. The only problem is this:

When a user wants to resume normal computer use, they can, no problem all they need to do is press ESC and it closes the powerpoint show until the computer is idle for x amount of time again, then it reopens.. unless they want to open powerpoint, it tells the user that they dont have access.. Is there any way around this? This help is needed for work, so im really hoping somebody can help me. My code is below.

#include <Timers.au3> ;Import this to find the Idle Time
#include <InetConstants.au3> ;Import this to download the file ie update the current file


Opt("TrayAutoPause", 0) ;0=no pause, 1=Pause


Func Terminate()
   ProcessClose("POWERPNT.exe")
    HotKeySet("{ESC}")


 EndFunc   ;==>Terminate


 HotKeySet("{ESC}", "Terminate")


$fullPath = @TempDir & "\show.ppsx" ;The filepath of the .ppsx file
$waitingTime = 900000 ;This is the amount of idle time before show kicks in - Usually 15 mins


   ;Delete the current file as a means of overriding it
   FileDelete( $fullPath )


    ; Download the file in the background with the selected option of 'force a reload from the remote site.'
    Local $hDownload = InetGet("http://FILENAMEHERE.ppsx", $fullpath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)


    ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True.
    Do
        Sleep(250)
    Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)


    ; Close the handle returned by InetGet.
    InetClose($hDownload)


Opt("TrayAutoPause", 0) ;0=no pause, 1=Pause


While 1


   ;close all Powerpoint processes that are already running
   ProcessClose("POWERPNT.exe")


   ;check how long the computer has been idle
   $idleTimer = _Timer_GetIdleTime()


   ;If the computer has been idle for ($waitingTime) amount of ms, then Run the downloaded file (powerpoint show)
   If $idleTimer > $waitingTime And Not ProcessExists( "POWERPNT.exe") Then
       RunWait(@ComSpec & ' /c ' & '"' & $fullPath & '"', '', @SW_HIDE)


EndIf


WEnd
Link to comment
Share on other sites

  • Moderators

When they press escape and close the powerpoint show, are you seeing a process still hanging out in the Task Manager?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

When they press escape and close the powerpoint show, are you seeing a process still hanging out in the Task Manager?

 

No this process (POWERPNT.exe) is closed, could there be another process running that is blocking powerpoint from opening? bare in mind, the AutoIT script is still running!

Edited by DavidH
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...