q410225 发表于 2016-12-9 20:09:44

[已解决]Win_7自动更换壁纸,能用但不明白原理.

本帖最后由 q410225 于 2016-12-12 19:12 编辑

原作是VBS写的,然后我改成了AU3的格式,竟然用起来一点问题都没有,自己试着分析了一些,实在搞不明白,有大侠能粗浅的给解释以下不
#cs ____________________________________

NUM = "" '壁纸图片路径

Set sh = CreateObject("Shell.Application")

Set FSO = CreateObject("Scripting.FileSystemObject")

Set f = FSO.GetFile(NUM)

Set vs = sh.NameSpace(f.ParentFolder.Path).ParseName(f.Name).Verbs

For Each v In vs

If v.Name = "设置为桌面背景(&B)" Then v.DoIt

Next

WScript.Sleep 5000

#ce _______________脚本开始_________________

Local $num = ""
Local $sh = ObjCreate("Shell.Application")
Local $fso = ObjCreate("Scripting.FileSystemObject")
Local $f = $fso.GetFile($num)

;~ fFolder = Shell.NameSpace(VDIR)
;~ PPID = Folder.ParseName(BNAME)//Creates and returns a FolderItem object that represents a specified item.
;~ vVerb = FolderItem.Verbs()//返回 FolderItemVerbs 对象. This object is the collection of verbs that can be executed on the item.
;FolderItemVerb.DoIt()   // Executes a verb on the FolderItem associated with the verb.



Local $vs = $sh.NameSpace($f.ParentFolder.Path).ParseName($f.Name).Verbs
Local $v
For $v In $vs


If $v.Name = "设置为桌面背景(&B)" Then $v.DOIt
Next
Sleep(5000)

漠北雪~狼 发表于 2016-12-12 11:21:25

Local $vs = $sh.NameSpace($f.ParentFolder.Path).ParseName($f.Name).Verbs
Local $v
For $v In $vs


If $v.Name = "设置为桌面背景(&B)" Then $v.DOIt
Next



关键在这里。。。If $v.Name = "设置为桌面背景(&B)" Then $v.DOIt
页: [1]
查看完整版本: [已解决]Win_7自动更换壁纸,能用但不明白原理.