marfdaman Posted May 21, 2006 Share Posted May 21, 2006 A little program for quickly changing a file's (time) attributes. I don't expect many people will actually use this on a daily scale, but it might come handy in hiding certain files (hidden+system), and I think it's funny to change a file's "created" attribute to the lowest possible value. I can't seem to get any files below friday the 8th of december in the year 1617 at 6:28:38 AM. Perhaps someone else can get it even lower? Regards expandcollapse popup#include <GUIConstants.au3> #include <Array.au3> $window = GUICreate("Marfdaman File Info Changer", 322, 573, -1, -1) $openfilebutton = GUICtrlCreateButton("Select File", 5, 8, 151, 49) $openfolderbutton = GUICtrlCreateButton("Select Folder", 166, 8, 151, 49) $MonthCal1 = GUICtrlCreateMonthCal("1990/08/17", 104, 159, 209, 361) $newyear = GUICtrlCreateInput("1990", 8, 127, 49, 21, -1, $WS_EX_CLIENTEDGE) $newmonth = GUICtrlCreateInput("08", 64, 127, 41, 21, -1, $WS_EX_CLIENTEDGE) $newday = GUICtrlCreateInput("17", 112, 127, 41, 21, -1, $WS_EX_CLIENTEDGE) $newhour = GUICtrlCreateInput("13", 160, 127, 41, 21, -1, $WS_EX_CLIENTEDGE) $newminute = GUICtrlCreateInput("45", 208, 127, 41, 21, -1, $WS_EX_CLIENTEDGE) $newsecond = GUICtrlCreateInput("30", 256, 127, 41, 21, -1, $WS_EX_CLIENTEDGE) $applybutton = GUICtrlCreateButton("Apply Settings", 8, 535, 305, 33) $rcheck = GUICtrlCreateCheckbox("Read Only", 16, 167, 87, 33) $acheck = GUICtrlCreateCheckbox("Archive", 16, 223, 87, 33) $scheck = GUICtrlCreateCheckbox("System", 16, 279, 87, 33) $hcheck = GUICtrlCreateCheckbox("Hidden", 16, 335, 87, 33) $ncheck = GUICtrlCreateCheckbox("Normal", 16, 391, 87, 33) $ocheck = GUICtrlCreateCheckbox("Offline", 16, 447, 87, 33) $tcheck = GUICtrlCreateCheckbox("Temporary", 16, 495, 87, 33) $created = GUICtrlCreateCheckbox("Created", 25, 61, 100, 20) $modified = GUICtrlCreateCheckbox("Modified", 130, 61, 100, 20) $accessed = GUICtrlCreateCheckbox("Accessed", 230, 61, 100, 20) $currenttimebutton = GUICtrlCreateButton("Current time and date", 10, 86, 302, 30) $checks = "" $type = "" GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $openfilebutton $file = FileOpenDialog("Select Files To Modify", "", "All Files(*.*)", 11) $fileattributes = FileGetAttrib($file) If StringInStr($fileattributes, "R") Then GUICtrlSetState($rcheck, $GUI_CHECKED) EndIf If StringInStr($fileattributes, "A") Then GUICtrlSetState($acheck, $GUI_CHECKED) EndIf If StringInStr($fileattributes, "S") Then GUICtrlSetState($scheck, $GUI_CHECKED) EndIf If StringInStr($fileattributes, "H") Then GUICtrlSetState($hcheck, $GUI_CHECKED) EndIf If StringInStr($fileattributes, "N") Then GUICtrlSetState($ncheck, $GUI_CHECKED) EndIf If StringInStr($fileattributes, "O") Then GUICtrlSetState($ocheck, $GUI_CHECKED) EndIf If StringInStr($fileattributes, "T") Then GUICtrlSetState($tcheck, $GUI_CHECKED) EndIf Case $msg = $openfolderbutton $file = FileSelectFolder("Select Folder To Modify", "", 7) $fileattributes = FileGetAttrib($file) MsgBox(0, $fileattributes, $fileattributes) If StringInStr($fileattributes, "R") Then GUICtrlSetState($rcheck, $GUI_CHECKED) EndIf If StringInStr($fileattributes, "A") Then GUICtrlSetState($acheck, $GUI_CHECKED) EndIf If StringInStr($fileattributes, "S") Then GUICtrlSetState($scheck, $GUI_CHECKED) EndIf If StringInStr($fileattributes, "H") Then GUICtrlSetState($hcheck, $GUI_CHECKED) EndIf If StringInStr($fileattributes, "N") Then GUICtrlSetState($ncheck, $GUI_CHECKED) EndIf If StringInStr($fileattributes, "O") Then GUICtrlSetState($ocheck, $GUI_CHECKED) EndIf If StringInStr($fileattributes, "T") Then GUICtrlSetState($tcheck, $GUI_CHECKED) EndIf $type = "folder" Case $msg = $applybutton If IsDeclared("file") Then $checks = "" If GUICtrlRead($rcheck) = $GUI_CHECKED Then $checks = $checks & "+R" EndIf If GUICtrlRead($acheck) = $GUI_CHECKED Then $checks = $checks & "+A" EndIf If GUICtrlRead($scheck) = $GUI_CHECKED Then $checks = $checks & "+S" EndIf If GUICtrlRead($hcheck) = $GUI_CHECKED Then $checks = $checks & "+H" EndIf If GUICtrlRead($ncheck) = $GUI_CHECKED Then $checks = $checks & "+N" EndIf If GUICtrlRead($ocheck) = $GUI_CHECKED Then $checks = $checks & "+O" EndIf If GUICtrlRead($tcheck) = $GUI_CHECKED Then $checks = $checks & "+T" EndIf If GUICtrlRead($rcheck) = $GUI_UNCHECKED Then $checks = $checks & "-R" EndIf If GUICtrlRead($acheck) = $GUI_UNCHECKED Then $checks = $checks & "-A" EndIf If GUICtrlRead($scheck) = $GUI_UNCHECKED Then $checks = $checks & "-S" EndIf If GUICtrlRead($hcheck) = $GUI_UNCHECKED Then $checks = $checks & "-H" EndIf If GUICtrlRead($ncheck) = $GUI_UNCHECKED Then $checks = $checks & "-N" EndIf If GUICtrlRead($ocheck) = $GUI_UNCHECKED Then $checks = $checks & "-O" EndIf If GUICtrlRead($tcheck) = $GUI_UNCHECKED Then $checks = $checks & "-T" EndIf If $type <> "folder" Then FileSetAttrib($file, $checks) Else FileSetAttrib($file, $checks, 1) EndIf If GUICtrlRead($created) = $GUI_CHECKED Then $year = GUICtrlRead($newyear) $month = GUICtrlRead($newmonth) $day = GUICtrlRead($newday) $hour = GUICtrlRead($newhour) $minute = GUICtrlRead($newminute) $second = GUICtrlRead($newsecond) FileSetTime($file, $year & $month & $day & $hour & $minute & $second, 1) EndIf If GUICtrlRead($modified) = $GUI_CHECKED Then $year = GUICtrlRead($newyear) $month = GUICtrlRead($newmonth) $day = GUICtrlRead($newday) $hour = GUICtrlRead($newhour) $minute = GUICtrlRead($newminute) $second = GUICtrlRead($newsecond) FileSetTime($file, $year & $month & $day & $hour & $minute & $second, 0) EndIf If GUICtrlRead($accessed) = $GUI_CHECKED Then $year = GUICtrlRead($newyear) $month = GUICtrlRead($newmonth) $day = GUICtrlRead($newday) $hour = GUICtrlRead($newhour) $minute = GUICtrlRead($newminute) $second = GUICtrlRead($newsecond) $test = FileSetTime($file, $year & $month & $day & $hour & $minute & $second, 2) EndIf EndIf Case $msg = $MonthCal1 $updatecal = GUICtrlRead($MonthCal1) $updatecal = StringSplit($updatecal, "/") GUICtrlSetData($newyear, $updatecal[1]) GUICtrlSetData($newmonth, $updatecal[2]) GUICtrlSetData($newday, $updatecal[3]) Case $msg = $currenttimebutton GUICtrlSetData($newyear, @YEAR) GUICtrlSetData($newmonth, @MON) GUICtrlSetData($newday, @MDAY) GUICtrlSetData($newhour, @HOUR) GUICtrlSetData($newminute, @MIN) GUICtrlSetData($newsecond, @SEC) EndSelect WEnd Exit Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Link to comment Share on other sites More sharing options...
Confuzzled Posted May 22, 2006 Share Posted May 22, 2006 (edited) I think that Microsoft Windows and Sun Java Zero Time starts on the first of January 1600 AD at the midnight crossing at Greenwich, UK. Cannot confirm it, as I wasn't there at the time! Julian dates start at noon on the first of January 4713 BC. Again, I'll have to ask my uncle as... Psst: My middle name is not Methuselah! Edited May 22, 2006 by Confuzzled Link to comment Share on other sites More sharing options...
marfdaman Posted May 22, 2006 Author Share Posted May 22, 2006 I think that Microsoft Windows and Sun Java Zero Time starts on the first of January 1600 AD at the midnight crossing at Greenwich, UK. Cannot confirm it, as I wasn't there at the time!Julian dates start at noon on the first of January 4713 BC. Again, I'll have to ask my uncle as...Psst: My middle name is not Methuselah!Haha ok that might explain it Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now