脚本:运行后将桌面图标排列成心形

优质
小牛编辑
137浏览
2023-12-01

引用 heart.nsi 的内容:

SetCompressor /SOLID lzma
SetCompressorDictSize 32

XPStyle on
SilentInstall silent
;Icon "heart.ico"

!include "nsDialogs_CommCtrl.nsh"
!include "Win\WinDef.nsh"

OutFile "heart.exe"
Caption "提示"

Var x
Var y

!macro CountItemPos io na
	${If} ${na}  4
	${AndIf} ${na}  9
	${AndIf} ${na}  13
	${AndIf} ${na}  17
		Math::Script "x=0; y=0; nc=${na}*70-16*70; \
				      NS=x+nc; NS=y"
	${EndIf}
	Sleep 500
!macroend


Section
	FindWindow $0 "Progman" "Program Manager"
	FindWindow $0 "SHELLDLL_DefView" "" $0
	GetDlgItem $1 $0 1
	SendMessage $1 ${LVM_GETITEMCOUNT} 0 0 $2
	IntCmp $2 18 +3 0 +3
	MessageBox MB_ICONINFORMATION|MB_OK "桌面图标过少,不能实现!"
	Quit
	SendMessage $1 ${LVM_SETEXTENDEDLISTVIEWSTYLE} ${LVS_EX_SNAPTOGRID} 0
	${NSD_RemoveStyle} $1 ${LVS_AUTOARRANGE}
	IntOp $2 $2 - 1
	${For} $0 0 $2
	    Math::Script /NOUNLOAD "r3=r0/1.4"
		!insertmacro CountItemPos $3 $0
		Pop $y
		Pop $x
		${MAKELPARAM} $3 $x $x $y
	    SendMessage $1 ${LVM_SETITEMPOSITION} $0 $3
	${Next}
SectionEnd

说明:桌面需18个以上图标。

另存附件(内附一个AU3的脚本)。

作者:gfm688