简体   繁体   中英

VBS script error 800A03F4

I am getting this error when I am trying to make a custom screensaver. It says: (script location) Line: 20 Char: 4 Error: Expected "If" and when I chane it it also says expected end or something else. The idea is to launch a screensaver I have made in a .bat script and it will detect when to launch it. Also, could I also have some help detecting that the mouse isn't moved for the time specified? Anyway, here is what I have done so far:

set service = GetObject ("winmgmts:")
Dim StartTime, EndTime, Elapsed
StartTime = Timer
Elapsed = Timer - StartTime
If Timer > 100000 Then
for each Process in Service.InstancesOf ("Win32_Process")
If Process.Name = "cmd.exe" then
sleep 0
else
createObject("WScript.Shell").Run "screensaver.bat"
StartTime = 0
EndTime = 0
Elapsed = 0
Timer = 0
end

thanks in advance ~ Dan

The default If statement is

If True Then
  WScript.Echo "True"
End If

If you delete the If in End If , you get the Expected 'If' error.

In your code you 'open' two Ifs and one For. Close them properly and indent your code.

I have updated the script so it launches the screensaver properly, but still doesn't detect idle time and the timer doesn't really work. I changed the script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM