Jump to content

Scheduled Script When Computer Is Locked


 Share

Recommended Posts

I'm using a simple script to shutdown Outlook for remote backup purposes. I start it using Windows Scheduled tasks.

Opt("WinTitleMatchMode",2)

WinActivate("Microsoft Outlook")

WinWaitActive("Microsoft Outlook")

Send("!f")

Sleep ( 50 )

Send("x")

It works perfectly except when the computer is locked by the user. Which happen every night. The script itself is started by windows (I can see the AutoIt icon near the clock when I unlock) but nothing happens.

I've read that most scripts won't work when the computer is locked. Is there any way around this issue in my case?

Edited by ROcHE
Link to comment
Share on other sites

The SledgeHammer approach would work (force the system to reboot)

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Link to comment
Share on other sites

Using the beta you can also do this with COM (it is language independant and also opens the door for other processing prior to shutdown if you want to get fancy). More info available at MSDN.

If ProcessExists("OUTLOOK.EXE") Then 
    $oOutlook = ObjCreate("Outlook.Application")
    $oOutlook.quit
; Outlook exits...
Else
; Outlook not running
EndIf

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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...