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")
}
}
大家的开机脚本都有什么需求呢?