Jump to content

Recommended Posts

Posted (edited)

The following script works fine when I click on it but will not run automatically when called from Windows Task Scheduler at logon or if put in the Windows startup folder or Windows registry application "run" key. Since the script is designed to run at user logon, this is an issue. But I can't figure out why it won't execute automatically. BTW I've also complied the scrip and tried it without the MsgBox entry figuring that the button push was at fault but those changes didn't matter either.

#RequireAdmin
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ProgressConstants.au3>
If MsgBox(33, 'NetOn', 'Wakeup network adaptors?',3) = 2 Then Exit
$hProgressSplash = _SplashTextProgress("Powering on Network Adaptors")
ShellExecute("netsh.exe", 'int set interface "Ethernet 1" enable', "", "", @SW_HIDE)
Sleep(4000)
Func _SplashTextProgress($sText)
    SplashOff()
    $hSplash = GUICreate("", 500, 375, -1, -1, BitOR($WS_POPUP, $WS_BORDER), BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE, $WS_EX_TOOLWINDOW))
    $iProgressBar = GUICtrlCreateProgress(100, 300, 305, 25, $PBS_MARQUEE)
    GUICtrlSendMsg(-1, $PBM_SETMARQUEE, True, 80)
    $iMessage = GUICtrlCreateLabel($sText, 0, 100, 500, 200, $SS_CENTER)
    GUICtrlSetFont(-1, 24, 700, 0, "Arial Narrow")
    GUISetState(@SW_SHOW)
    Return SetExtended($iProgressBar, $hSplash)
EndFunc

 

Edited by copyleft
Posted (edited)

What happens if you start it from Windows Task Scheduler based on time. Let's say in 3 minutes from now?
Does it act differently than running it at logon?

Edited by david1337
Posted (edited)

SOLVED: I think I've solved the issue. Windows wants the user completely logged off, so my script won't work if the compter is sleep or in hibernation, even if the user has to actually "logon" with credentials after emerging from sleep or hibernation. I'm testing now with the task scheduler event, "unlock".

Edited by copyleft

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
  • Recently Browsing   0 members

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