用vbs实现自动更换屏幕保护的图片

pingbao.vbs

Const PICNO=60
Const Version = "******"
Const FilePath = "C:\Downloads\quiz20220223\"  '任意指定路径

Set Wshell=WScript.CreateObject("WScript.Shell")

Set fso = Wscript.CreateObject("Scripting.FileSystemObject")

strDSNum = FilePath & "Num.txt"  'Num.txt保存下次显示图片的编号
FG=fso.FileExists(strDSNum)
if NOT FG then
  set f = fso.CreateTextFile(strDSNum,true)
  f.write("61")
  f.Close
end if

Set f = fso.OpenTextFile(strDSNum,1)
strDSNumTxt = f.ReadLine
PN=strDSNumTxt
f.Close()

if PN=1 then
   Set pic=fso.getfile(FilePath & "screen.jpg")
   pic.name=PICNO & ".jpg"
else
   Set pic=fso.getfile(FilePath & "screen.jpg")
   pic.name=PN-1 & ".jpg"
end if

if PN > 60 then
   PN=1
end if

set pic=fso.getfile(FilePath  & PN & ".jpg")
pic.name="screen.jpg"

'Set wshShell = Wscript.CreateObject("Wscript.Shell")
Wshell.Run("C:\Downloads\quiz20220223\screen.jpg")

set f = fso.CreateTextFile(strDSNum,true)
PN=PN+1
f.write(PN)
f.Close

 

posted @ 2025-07-09 13:13  梓涵VV  阅读(14)  评论(0)    收藏  举报