Page 1 of 1

开机脚本

Posted: 22 Oct 2016, 01:20
by arcticir
总结下开机脚本.

Code: Select all

	; 通知开机用时
	h_th.Notice.fp("Notify","开机时间","开机 " A_TickCount // 1000,"4"
		,"GC=0x101010 TC=White MC=White Image=%A_ahkDir%\Extend\Icon\Origami\1180192.png")

	; 根据剩余内存量判断是否启动非必软件
	if (winmgmt("FreePhysicalMemory",,"Win32_OperatingSystem")//1024 > 2000)
		Run, % h_dir "\Program\Search\Everything\Everything" A_Is64bitOS ".exe",,Hide

	;根据时间判断是否调节屏幕色温
	if (A_Hour >20 or  A_Hour < 6)
		Run(h_dir "\Program\Show\flux\flux.exe")

	; 尝试网络连接
	While !time:=getTime()
	{
		If A_Index = 7
		{
			A_Record("启动网络程序失败 ExitApp")
			A_Status("启动网络程序失败",20,h_name)
			ExitApp
		}
		Sleep,% a_index * 2000	
	}

	if !(time+0)
		ExitApp

	; 顺便修正时间
	if substr(time,1,12)!=(A_YYYY A_MM A_DD A_Hour A_Min)
		SetTime(time)

	ahksub("Run_Privoxy") ;调度代理
	ahksub("Run_xx-net") ;常备代理
	ahksub("Run_firefox") ;默认浏览器

	ExitApp

SetTime(Date){
	VarSetCapacity(localTime, 16, 0)
	For i, n in [ [0,1,4],[2,5,2],[6,7,2],[8,9,2],[10,11,2],[12,13,2],[14,15,3] ]
		NumPut( SubStr(Date, n.2, n.3), localTime, n.1, "UShort" )
	DllCall("SetLocalTime", UInt, &localTime)
}

getTime(){
	if (f:=oh({type:"head",url:"http://baidu.com"})) and r:=f.list.date
	{
		Obj    := StrSplit(r, [A_Space, ":"] )
		Mon    := SubStr(  "0" Ceil( Instr("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec", Obj.3) / 4 ), -2  )
		Return DateAdd(Obj.4 Mon Obj.2 Obj.5 Obj.6 Obj.7,8,"H")
	}
}

大家的开机脚本都有什么需求呢?

Re: 开机脚本

Posted: 17 Feb 2017, 03:19
by black1396
启动时间
禁用Capslock
托盘时间增加农历显示的LunarTime.ahk,网上找来的,还有点小bug,而且在win10 2015里好好的,到win10 2016里失效了,还不知道哪里发生了变化.
启动CrystalInfo,CoreTemp这两个显示硬盘和CPU温度

没了