728x90

PC시간을 웹사이트 시간으로 변경

 

#NoEnv
#SingleInstance, Force

inputbox , ad , 주소를 입력해주세요
adcheck := instr(ad , "http://")
adcheck := % adcheck + instr(ad , "https://")
if adcheck <> 1
{
msgbox "주소를 바르게 넣어주세요"
exit app
}

wh := ComObjCreate("WinHTTP.WinHTTPRequest.5.1") 
wh.Open("GET", ad)
wh.send
wh.WaitForResponse
d := wh.getallresponseheaders
Clipboard := % d
loop , parse , d , `n
{
  num := instr(A_LoopField , "Date:")
   if num > 0
   {
     
    DateValue := substr(A_LoopField , 11 , 12)
    StringReplace , DateValue , DateValue , %A_Space% , ,,all
    TimeValue := substr(A_LoopField , 24 , 8)
    StringReplace , TimeValue , TimeValue , :, ,,all
    DateValue := DateParse(DateValue)
    Time := % DateValue TimeValue
   }
}


YYYYMMDDHHMISS := Time ; reassigning variable so I don`t have to edit the doc example

VarSetCapacity(SystemTime, 16, 0)  ; This struct consists of 8 UShorts (i.e. 8*2=16).

Int := SubStr(YYYYMMDDHHMISS, 1, 4)  ; YYYY (year)
NumPut(Int, SystemTime, 0, "UShort")
Int := SubStr(YYYYMMDDHHMISS, 5, 2)  ; MM (month of year, 1-12)
NumPut(Int, SystemTime, 2, "UShort")
Int := SubStr(YYYYMMDDHHMISS, 7, 2)  ; DD (day of month)
NumPut(Int, SystemTime, 6, "UShort")
Int := SubStr(YYYYMMDDHHMISS, 9, 2)  ; HH (hour in 24-hour time)
NumPut(Int, SystemTime, 8, "UShort")
Int := SubStr(YYYYMMDDHHMISS, 11, 2) ; MI (minute)
NumPut(Int, SystemTime, 10, "UShort")
Int := SubStr(YYYYMMDDHHMISS, 13, 2) ; SS (second)
NumPut(Int, SystemTime, 12, "UShort")

DllCall("SetSystemTime", "Ptr", &SystemTime)  

msgbox "시간이 변경되었습니다."

DateParse(ByRef str) {
	static e2 = "i)(?:(\d{1,2}+)[\s\.\-\/,]+)?(\d{1,2}|(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\w*)[\s\.\-\/,]+(\d{2,4})"
	str := RegExReplace(str, "((?:" . SubStr(e2, 42, 47) . ")\w*)(\s*)(\d{1,2})\b", "$3$2$1", "", 1)
	If RegExMatch(str, "i)^\s*(?:(\d{4})([\s\-:\/])(\d{1,2})\2(\d{1,2}))?"
		. "(?:\s*[T\s](\d{1,2})([\s\-:\/])(\d{1,2})(?:\6(\d{1,2})\s*(?:(Z)|(\+|\-)?"
		. "(\d{1,2})\6(\d{1,2})(?:\6(\d{1,2}))?)?)?)?\s*$", i)
		d3 := i1, d2 := i3, d1 := i4, t1 := i5, t2 := i7, t3 := i8
	Else If !RegExMatch(str, "^\W*(\d{1,2}+)(\d{2})\W*$", t)
		RegExMatch(str, "i)(\d{1,2})\s*:\s*(\d{1,2})(?:\s*(\d{1,2}))?(?:\s*([ap]m))?", t)
			, RegExMatch(str, e2, d)
	f = %A_FormatFloat%
	SetFormat, Float, 02.0
	d := (d3 ? (StrLen(d3) = 2 ? 20 : "") . d3 : A_YYYY)
		. ((d2 := d2 + 0 ? d2 : (InStr(e2, SubStr(d2, 1, 3)) - 40) // 4 + 1.0) > 0
			? d2 + 0.0 : A_MM) . ((d1 += 0.0) ? d1 : A_DD) . t1
			+ (t1 = 12 ? t4 = "am" ? -12.0 : 0.0 : t4 = "am" ? 0.0 : 12.0) . t2 + 0.0 . t3 + 0.0
	SetFormat, Float, %f%
	Return, d
}

출처 : 업앤다운

 

 

728x90

'AutoHotKey' 카테고리의 다른 글

세계 시간 - GUI  (0) 2023.10.14
컴퓨터 자동종료 - GUI  (0) 2023.10.14
윈도우 목록 보여주기  (0) 2023.10.10
인증창 넣기  (0) 2023.10.09
사용기간 제한 걸기  (0) 2023.10.08

+ Recent posts