Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Repeat Script until user answers no.

Status
Not open for further replies.

cbsarge

IS-IT--Management
Jun 20, 2001
219
US
If this script is run prior to opening a word doc it pops a little box asking if you want to save your doc. I want it to repeat every 10 or 15 minutes (sleep?) prompting the user to save their work. Since there is no autosave function in Office (only autorecover for when it crashes) I'm trying to make a script to do just that. I could have it monitor the other Office apps too to cover all the bases.

Code:
strComputer = "." 
 Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") 
 Set colProcesses = objWMIService.ExecNotificationQuery("SELECT * FROM __InstanceCreationEvent WITHIN 2 WHERE TargetInstance ISA 'Win32_Process'") 
 Do Until DefResp = vbNo 
      Set objNewProcess = colProcesses.nextEvent 
      If objNewProcess.TargetInstance.Name = "WINWORD.EXE" THEN  
      set WshShell = WScript.CreateObject("WScript.Shell") 
      DefResp = MsgBox (MyNum & " Do you want to save now?", vbYesNo) 
      WshShell.SendKeys "^s"
	  End If 
 Loop
 
How would I use that method in my vbs file?
With OLE Automation

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Could you perhaps give me an example?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top