上一主题下一主题
«123»Pages: 1/3     Go
主题 : 属性设置助手(批量或单个处理)   By 风无忌
If you put your heart into it,nothing is impossible!
级别: 技术组成员

UID: 85553
精华: 2
发帖: 124
威望: 768 点
无痕币: 3522 WHB
贡献值: 0 点
在线时间: 171(时)
注册时间: 2009-06-27
最后登录: 2013-12-09

0 属性设置助手(批量或单个处理)   By 风无忌

管理提醒: 本帖被 realqwh 执行加亮操作(2010-10-22)







功能主要就是批量或单个设置文件或文件夹的属性~~~

批量设置可用于文件夹杀手病毒造成的全盘文件和文件夹隐藏的状况~~~

源码给一下吧:

复制代码
  1. #NoTrayIcon
  2. #Region AutoIt3Wrapper 预编译参数(常用参数)
  3. #AutoIt3Wrapper_Icon= D:\Downloads\win7_icons\0002.ico    ;图标,支持EXE,DLL,ICO
  4. #AutoIt3Wrapper_OutFile=                         ;输出文件名
  5. #AutoIt3Wrapper_OutFile_Type=exe                       ;文件类型
  6. #AutoIt3Wrapper_Compression=4            ;压缩等级
  7. #AutoIt3Wrapper_UseUPX=y              ;使用压缩
  8. #AutoIt3Wrapper_Res_Comment= Attrib Set By FengWuji             ;注释
  9. #AutoIt3Wrapper_Res_Description=设置文件/文件夹属性          ;详细信息
  10. #AutoIt3Wrapper_Res_FileVersion= 1.0.0          ;文件版本
  11. ;#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=p       ;自动更新版本
  12. #AutoIt3Wrapper_Res_LegalCopyright= 风无忌         ;版权
  13. #AutoIt3Wrapper_Change2CUI=N                           ;修改输出的程序为CUI(控制台程序)
  14. #EndRegion AutoIt3Wrapper 预编译参数(常用参数)
  15. #include <ButtonConstants.au3>
  16. #include <EditConstants.au3>
  17. #include <GUIConstantsEx.au3>
  18. #include <StaticConstants.au3>
  19. #include <TabConstants.au3>
  20. #include <WindowsConstants.au3>
  21. #include <file.au3>
  22. #include <array.au3>
  23. Global $READONLY = 'R' ;只读属性
  24. Global $ARCHIVE = 'A' ;存档属性
  25. Global $SYSTEM = 'S' ;系统属性
  26. Global $HIDE = 'H' ;隐藏属性
  27. Global $NORMAL = 'N' ;普通属性
  28. Global $OFFLINE = 'O' ;脱机属性
  29. Global $TEMPORARY = 'T' ;临时文件属性
  30. Global $array = _FileListToArray(@WorkingDir) ;获得文件和文件加列表数组
  31. Global $path = @ScriptDir
  32. #Region ### START Koda GUI section ###
  33. $Form1 = GUICreate("属性设置助手                   By 风无忌", 413, 307, 302, 153)
  34. $PageControl1 = GUICtrlCreateTab(8, 24, 396, 272)
  35. $TabSheet1 = GUICtrlCreateTabItem("批量处理")
  36. $Group1 = GUICtrlCreateGroup("属性选择", 42, 69, 329, 81)
  37. GUICtrlSetFont(-1, 9, 400, 0, "Arial")
  38. $Checkbox1 = GUICtrlCreateCheckbox("只读", 58, 93, 57, 17)
  39. $Checkbox2 = GUICtrlCreateCheckbox("存档", 135, 93, 57, 17)
  40. $Checkbox3 = GUICtrlCreateCheckbox("系统", 211, 93, 57, 17)
  41. $Checkbox4 = GUICtrlCreateCheckbox("隐藏", 288, 93, 57, 17)
  42. $Checkbox5 = GUICtrlCreateCheckbox("普通", 58, 117, 57, 17)
  43. $Checkbox6 = GUICtrlCreateCheckbox("脱机", 135, 117, 57, 17)
  44. $Checkbox7 = GUICtrlCreateCheckbox("临时", 211, 117, 57, 17)
  45. GUICtrlCreateGroup("", -99, -99, 1, 1)
  46. $Group2 = GUICtrlCreateGroup("操作选择", 42, 156, 329, 57)
  47. GUICtrlSetFont(-1, 9, 400, 0, "Arial")
  48. $Radio1 = GUICtrlCreateRadio("添加属性", 74, 173, 121, 25)
  49. GUICtrlSetState(-1, $GUI_CHECKED)
  50. $Radio2 = GUICtrlCreateRadio("删除属性", 228, 173, 121, 25)
  51. GUICtrlCreateGroup("", -99, -99, 1, 1)
  52. $Button1 = GUICtrlCreateButton("确定(&O)", 111, 229, 75, 25)
  53. GUICtrlSetFont(-1, 9, 400, 0, "Arial")
  54. $Button2 = GUICtrlCreateButton("取消(&C)", 223, 229, 75, 25)
  55. GUICtrlSetFont(-1, 9, 400, 0, "Arial")
  56. $TabSheet2 = GUICtrlCreateTabItem("单个处理")
  57. $Label1 = GUICtrlCreateLabel("选择:", 30, 62, 30, 19)
  58. GUICtrlSetFont(-1, 9, 400, 0, "Arial")
  59. $Radio5 = GUICtrlCreateRadio("文件", 70, 50, 40, 19)
  60. GUICtrlSetFont(-1, 9, 400, 0, "Arial")
  61. GUICtrlSetState(-1, $GUI_CHECKED)
  62. $Radio6 = GUICtrlCreateRadio("文件夹", 70, 70, 55, 19)
  63. GUICtrlSetFont(-1, 9, 400, 0, "Arial")
  64. $Input1 = GUICtrlCreateInput("", 136, 64, 169, 22)
  65. GUICtrlSetFont(-1, 9, 400, 0, "Arial")
  66. $Button3 = GUICtrlCreateButton("浏览(&V)", 315, 63, 57, 25)
  67. GUICtrlSetFont(-1, 9, 400, 0, "Arial")
  68. $Group3 = GUICtrlCreateGroup("属性选择", 43, 91, 329, 81)
  69. GUICtrlSetFont(-1, 9, 400, 0, "Arial")
  70. GUICtrlSetBkColor(-1, 0xFFFBF0)
  71. $Checkbox8 = GUICtrlCreateCheckbox("只读", 59, 115, 57, 17)
  72. $Checkbox9 = GUICtrlCreateCheckbox("存档", 136, 115, 57, 17)
  73. $Checkbox10 = GUICtrlCreateCheckbox("系统", 212, 115, 57, 17)
  74. $Checkbox11 = GUICtrlCreateCheckbox("隐藏", 289, 115, 57, 17)
  75. $Checkbox12 = GUICtrlCreateCheckbox("普通", 59, 139, 57, 17)
  76. $Checkbox13 = GUICtrlCreateCheckbox("脱机", 136, 139, 57, 17)
  77. $Checkbox14 = GUICtrlCreateCheckbox("临时", 212, 139, 57, 17)
  78. GUICtrlCreateGroup("", -99, -99, 1, 1)
  79. $Group4 = GUICtrlCreateGroup("操作选择", 43, 178, 329, 57)
  80. GUICtrlSetFont(-1, 9, 400, 0, "Arial")
  81. $Radio3 = GUICtrlCreateRadio("添加属性", 75, 195, 121, 25)
  82. GUICtrlSetState(-1, $GUI_CHECKED)
  83. $Radio4 = GUICtrlCreateRadio("删除属性", 229, 195, 121, 25)
  84. GUICtrlCreateGroup("", -99, -99, 1, 1)
  85. $Button4 = GUICtrlCreateButton("确定(&O)", 109, 246, 75, 25)
  86. GUICtrlSetFont(-1, 9, 400, 0, "Arial")
  87. $Button5 = GUICtrlCreateButton("取消(&C)", 229, 246, 75, 25)
  88. GUICtrlSetFont(-1, 9, 400, 0, "Arial")
  89. $TabSheet3 = GUICtrlCreateTabItem("程序说明")
  90. GUICtrlSetState(-1, $GUI_SHOW)
  91. $Label2 = GUICtrlCreateLabel("可以批量或单个设置文件夹和文件的属性;", 88, 88, 223, 17)
  92. $Label3 = GUICtrlCreateLabel("批量设置可用于文件夹杀手病毒造成的目", 89, 112, 220, 17)
  93. $Label4 = GUICtrlCreateLabel("录下文件夹和文件全被加上系统和隐藏属", 89, 134, 220, 17)
  94. $Label5 = GUICtrlCreateLabel("性的状况;", 89, 159, 55, 17)
  95. $Label6 = GUICtrlCreateLabel("作   者:            风无忌       ", 89, 183, 210, 17)
  96. $Label7 = GUICtrlCreateLabel("Bug反馈:       wzh880801@163.com", 89, 210, 215, 17)
  97. GUICtrlCreateTabItem("")
  98. GUISetState(@SW_SHOW)
  99. #EndRegion ### END Koda GUI section ###
  100. AdlibRegister("Check",800)
  101. While 1
  102.  $nMsg = GUIGetMsg()
  103.  Switch $nMsg
  104.   Case $GUI_EVENT_CLOSE, $Button2, $Button5
  105.    _Exit()
  106.   Case $Button1
  107.    While 1
  108.     If BitAND(GUICtrlRead($Checkbox1), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($Checkbox2), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($Checkbox3), $GUI_UNCHECKED) = $GUI_UNCHECKED _
  109.       And BitAND(GUICtrlRead($Checkbox4), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($Checkbox5), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($Checkbox6), $GUI_UNCHECKED) = $GUI_UNCHECKED _
  110.       And BitAND(GUICtrlRead($Checkbox7), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
  111.      $msg = MsgBox(0 + 48, "提示", "你未选择任何项目!", "", $Form1)
  112.      If $msg = 1 Then ExitLoop
  113.     EndIf
  114.     If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED Then
  115.      GroupAddAttrib()
  116.      MsgBox(0, "完成", "增加属性成功完成", "", $Form1)
  117.      _EXIT()
  118.     Else
  119.      GroupDelAttrib()
  120.      MsgBox(0, "完成", "删除属性成功完成", "", $Form1)
  121.      _EXIT()
  122.     EndIf
  123.    WEnd
  124.   Case $Button3
  125.    If BitAND(GUICtrlRead($Radio5), $GUI_CHECKED) = $GUI_CHECKED Then
  126.     $dialog = FileOpenDialog("选择要处理的文件", @ScriptDir, "All Files(*.*)", 1 + 2 + 8, "", $Form1)
  127.     GUICtrlSetData($Input1, $dialog)
  128.     $file_need = GUICtrlRead($Input1)
  129.     If FileExists($file_need) Then
  130.      $Attrib = FileGetAttrib($file_need)
  131.      If StringInStr($Attrib, "R") Then
  132.       GUICtrlSetState($Checkbox8, $GUI_CHECKED)
  133.      Else
  134.       GUICtrlSetState($Checkbox8, $GUI_UNCHECKED)
  135.      EndIf
  136.      If StringInStr($Attrib, "A") Then
  137.       GUICtrlSetState($Checkbox9, $GUI_CHECKED)
  138.      Else
  139.       GUICtrlSetState($Checkbox9, $GUI_UNCHECKED)
  140.      EndIf
  141.      If StringInStr($Attrib, "S") Then
  142.       GUICtrlSetState($Checkbox10, $GUI_CHECKED)
  143.      Else
  144.       GUICtrlSetState($Checkbox10, $GUI_UNCHECKED)
  145.      EndIf
  146.      If StringInStr($Attrib, "H") Then
  147.       GUICtrlSetState($Checkbox11, $GUI_CHECKED)
  148.      Else
  149.       GUICtrlSetState($Checkbox11, $GUI_UNCHECKED)
  150.      EndIf
  151.      If StringInStr($Attrib, "N") Then
  152.       GUICtrlSetState($Checkbox12, $GUI_CHECKED)
  153.      Else
  154.       GUICtrlSetState($Checkbox12, $GUI_UNCHECKED)
  155.      EndIf
  156.      If StringInStr($Attrib, "O") Then
  157.       GUICtrlSetState($Checkbox13, $GUI_CHECKED)
  158.      Else
  159.       GUICtrlSetState($Checkbox13, $GUI_UNCHECKED)
  160.      EndIf
  161.      If StringInStr($Attrib, "T") Then
  162.       GUICtrlSetState($Checkbox14, $GUI_CHECKED)
  163.      Else
  164.       GUICtrlSetState($Checkbox14, $GUI_UNCHECKED)
  165.      EndIf
  166.     EndIf
  167.    Else
  168.     Do
  169.      $dialog = FileSelectFolder("选择要处理的文件夹", "", "", @ScriptDir, $Form1)
  170.      If StringLen($dialog) = 3 Then
  171.       MsgBox(0 + 16, "错误", "不能对磁盘进行操作", "", $Form1)
  172.       ExitLoop
  173.      EndIf
  174.      GUICtrlSetData($Input1, $dialog)
  175.      $folder_need = GUICtrlRead($Input1)
  176.      If FileExists($folder_need) Then
  177.       $Attrib = FileGetAttrib($folder_need)
  178.       If StringInStr($Attrib, "R") Then
  179.        GUICtrlSetState($Checkbox8, $GUI_CHECKED)
  180.       Else
  181.        GUICtrlSetState($Checkbox8, $GUI_UNCHECKED)
  182.       EndIf
  183.       If StringInStr($Attrib, "A") Then
  184.        GUICtrlSetState($Checkbox9, $GUI_CHECKED)
  185.       Else
  186.        GUICtrlSetState($Checkbox9, $GUI_UNCHECKED)
  187.       EndIf
  188.       If StringInStr($Attrib, "S") Then
  189.        GUICtrlSetState($Checkbox10, $GUI_CHECKED)
  190.       Else
  191.        GUICtrlSetState($Checkbox10, $GUI_UNCHECKED)
  192.       EndIf
  193.       If StringInStr($Attrib, "H") Then
  194.        GUICtrlSetState($Checkbox11, $GUI_CHECKED)
  195.       Else
  196.        GUICtrlSetState($Checkbox11, $GUI_UNCHECKED)
  197.       EndIf
  198.       If StringInStr($Attrib, "N") Then
  199.        GUICtrlSetState($Checkbox12, $GUI_CHECKED)
  200.       Else
  201.        GUICtrlSetState($Checkbox12, $GUI_UNCHECKED)
  202.       EndIf
  203.       If StringInStr($Attrib, "O") Then
  204.        GUICtrlSetState($Checkbox13, $GUI_CHECKED)
  205.       Else
  206.        GUICtrlSetState($Checkbox13, $GUI_UNCHECKED)
  207.       EndIf
  208.       If StringInStr($Attrib, "T") Then
  209.        GUICtrlSetState($Checkbox14, $GUI_CHECKED)
  210.       Else
  211.        GUICtrlSetState($Checkbox14, $GUI_UNCHECKED)
  212.       EndIf
  213.      EndIf
  214.     Until StringLen($dialog) <> 3
  215.    EndIf
  216.   Case $Button4
  217.    While 1
  218.     If BitAND(GUICtrlRead($Checkbox8), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($Checkbox9), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($Checkbox10), $GUI_UNCHECKED) = $GUI_UNCHECKED _
  219.       And BitAND(GUICtrlRead($Checkbox11), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($Checkbox12), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($Checkbox13), $GUI_UNCHECKED) = $GUI_UNCHECKED _
  220.       And BitAND(GUICtrlRead($Checkbox14), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
  221.      $msg = MsgBox(0 + 48, "提示", "你未选择任何项目!", "", $Form1)
  222.      If $msg = 1 Then ExitLoop
  223.     EndIf
  224.     If BitAND(GUICtrlRead($Radio3), $GUI_CHECKED) = $GUI_CHECKED Then
  225.      SingleAddAttrib()
  226.      MsgBox(0, "完成", "增加属性成功完成", "", $Form1)
  227.      AdlibUnRegister("Check")
  228.      GUICtrlSetData($Input1, "")
  229.      AdlibRegister("Check",800)
  230.      SetAttrib()
  231.      ExitLoop
  232.     Else
  233.      SingleDelAttrib()
  234.      MsgBox(0, "完成", "删除属性成功完成", "", $Form1)
  235.      AdlibUnRegister("Check")
  236.      GUICtrlSetData($Input1, "")
  237.      AdlibRegister("Check",800)
  238.      SetAttrib()
  239.      ExitLoop
  240.     EndIf
  241.    WEnd
  242.  EndSwitch
  243. WEnd
  244. Func _EXIT()
  245.  Exit
  246. EndFunc   ;==>_EXIT
  247. Func GroupAddAttrib()
  248.  If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
  249.   For $i = 1 To $array[0]
  250.    If $array[$i] = @ScriptName Then ContinueLoop
  251.    FileSetAttrib($array[$i], "+" & $READONLY)
  252.    If @error Then
  253.     MsgBox(0 + 16, "提示", "为" & $array[$i] & "设置属性错误")
  254.     ContinueLoop
  255.    EndIf
  256.   Next
  257.  EndIf
  258.  If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED Then
  259.   For $i = 1 To $array[0]
  260.    If $array[$i] = @ScriptName Then ContinueLoop
  261.    FileSetAttrib($array[$i], "+" & $ARCHIVE)
  262.    If @error Then
  263.     MsgBox(0 + 16, "提示", "为" & $array[$i] & "设置属性错误")
  264.     ContinueLoop
  265.    EndIf
  266.   Next
  267.  EndIf
  268.  If BitAND(GUICtrlRead($Checkbox3), $GUI_CHECKED) = $GUI_CHECKED Then
  269.   For $i = 1 To $array[0]
  270.    If $array[$i] = @ScriptName Then ContinueLoop
  271.    FileSetAttrib($array[$i], "+" & $SYSTEM)
  272.    If @error Then
  273.     MsgBox(0 + 16, "提示", "为" & $array[$i] & "设置属性错误")
  274.     ContinueLoop
  275.    EndIf
  276.   Next
  277.  EndIf
  278.  If BitAND(GUICtrlRead($Checkbox4), $GUI_CHECKED) = $GUI_CHECKED Then
  279.   For $i = 1 To $array[0]
  280.    If $array[$i] = @ScriptName Then ContinueLoop
  281.    FileSetAttrib($array[$i], "+" & $HIDE)
  282.    If @error Then
  283.     MsgBox(0 + 16, "提示", "为" & $array[$i] & "设置属性错误")
  284.     ContinueLoop
  285.    EndIf
  286.   Next
  287.  EndIf
  288.  If BitAND(GUICtrlRead($Checkbox5), $GUI_CHECKED) = $GUI_CHECKED Then
  289.   For $i = 1 To $array[0]
  290.    If $array[$i] = @ScriptName Then ContinueLoop
  291.    FileSetAttrib($array[$i], "+" & $NORMAL)
  292.    If @error Then
  293.     MsgBox(0 + 16, "提示", "为" & $array[$i] & "设置属性错误")
  294.     ContinueLoop
  295.    EndIf
  296.   Next
  297.  EndIf
  298.  If BitAND(GUICtrlRead($Checkbox6), $GUI_CHECKED) = $GUI_CHECKED Then
  299.   For $i = 1 To $array[0]
  300.    If $array[$i] = @ScriptName Then ContinueLoop
  301.    FileSetAttrib($array[$i], "+" & $OFFLINE)
  302.    If @error Then
  303.     MsgBox(0 + 16, "提示", "为" & $array[$i] & "设置属性错误")
  304.     ContinueLoop
  305.    EndIf
  306.   Next
  307.  EndIf
  308.  If BitAND(GUICtrlRead($Checkbox7), $GUI_CHECKED) = $GUI_CHECKED Then
  309.   For $i = 1 To $array[0]
  310.    If $array[$i] = @ScriptName Then ContinueLoop
  311.    FileSetAttrib($array[$i], "+" & $TEMPORARY)
  312.    If @error Then
  313.     MsgBox(0 + 16, "提示", "为" & $array[$i] & "设置属性错误")
  314.     ContinueLoop
  315.    EndIf
  316.   Next
  317.  EndIf
  318. EndFunc   ;==>GroupAddAttrib
  319. Func GroupDelAttrib()
  320.  If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
  321.   For $i = 1 To $array[0]
  322.    If $array[$i] = @ScriptName Then ContinueLoop
  323.    FileSetAttrib($array[$i], "-" & $READONLY)
  324.    If @error Then
  325.     MsgBox(0 + 16, "提示", "为" & $array[$i] & "设置属性错误")
  326.     ContinueLoop
  327.    EndIf
  328.   Next
  329.  EndIf
  330.  If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED Then
  331.   For $i = 1 To $array[0]
  332.    If $array[$i] = @ScriptName Then ContinueLoop
  333.    FileSetAttrib($array[$i], "-" & $ARCHIVE)
  334.    If @error Then
  335.     MsgBox(0 + 16, "提示", "为" & $array[$i] & "设置属性错误")
  336.     ContinueLoop
  337.    EndIf
  338.   Next
  339.  EndIf
  340.  If BitAND(GUICtrlRead($Checkbox3), $GUI_CHECKED) = $GUI_CHECKED Then
  341.   For $i = 1 To $array[0]
  342.    If $array[$i] = @ScriptName Then ContinueLoop
  343.    FileSetAttrib($array[$i], "-" & $SYSTEM)
  344.    If @error Then
  345.     MsgBox(0 + 16, "提示", "为" & $array[$i] & "设置属性错误")
  346.     ContinueLoop
  347.    EndIf
  348.   Next
  349.  EndIf
  350.  If BitAND(GUICtrlRead($Checkbox4), $GUI_CHECKED) = $GUI_CHECKED Then
  351.   For $i = 1 To $array[0]
  352.    If $array[$i] = @ScriptName Then ContinueLoop
  353.    FileSetAttrib($array[$i], "-" & $HIDE)
  354.    If @error Then
  355.     MsgBox(0 + 16, "提示", "为" & $array[$i] & "设置属性错误")
  356.     ContinueLoop
  357.    EndIf
  358.   Next
  359.  EndIf
  360.  If BitAND(GUICtrlRead($Checkbox5), $GUI_CHECKED) = $GUI_CHECKED Then
  361.   For $i = 1 To $array[0]
  362.    If $array[$i] = @ScriptName Then ContinueLoop
  363.    FileSetAttrib($array[$i], "-" & $NORMAL)
  364.    If @error Then
  365.     MsgBox(0 + 16, "提示", "为" & $array[$i] & "设置属性错误")
  366.     ContinueLoop
  367.    EndIf
  368.   Next
  369.  EndIf
  370.  If BitAND(GUICtrlRead($Checkbox6), $GUI_CHECKED) = $GUI_CHECKED Then
  371.   For $i = 1 To $array[0]
  372.    If $array[$i] = @ScriptName Then ContinueLoop
  373.    FileSetAttrib($array[$i], "-" & $OFFLINE)
  374.    If @error Then
  375.     MsgBox(0 + 16, "提示", "为" & $array[$i] & "设置属性错误")
  376.     ContinueLoop
  377.    EndIf
  378.   Next
  379.  EndIf
  380.  If BitAND(GUICtrlRead($Checkbox7), $GUI_CHECKED) = $GUI_CHECKED Then
  381.   For $i = 1 To $array[0]
  382.    If $array[$i] = @ScriptName Then ContinueLoop
  383.    FileSetAttrib($array[$i], "-" & $TEMPORARY)
  384.    If @error Then
  385.     MsgBox(0 + 16, "提示", "为" & $array[$i] & "设置属性错误")
  386.     ContinueLoop
  387.    EndIf
  388.   Next
  389.  EndIf
  390. EndFunc   ;==>GroupDelAttrib
  391. Func SingleAddAttrib()
  392.  $file = GUICtrlRead($Input1)
  393.  If BitAND(GUICtrlRead($Checkbox8), $GUI_CHECKED) = $GUI_CHECKED Then
  394.   FileSetAttrib($file, "+" & $READONLY)
  395.   If @error Then MsgBox(0 + 16, "提示", "为" & $file & "设置属性错误")
  396.  EndIf
  397.  If BitAND(GUICtrlRead($Checkbox9), $GUI_CHECKED) = $GUI_CHECKED Then
  398.   FileSetAttrib($file, "+" & $ARCHIVE)
  399.   If @error Then MsgBox(0 + 16, "提示", "为" & $file & "设置属性错误")
  400.  EndIf
  401.  If BitAND(GUICtrlRead($Checkbox10), $GUI_CHECKED) = $GUI_CHECKED Then
  402.   FileSetAttrib($file, "+" & $SYSTEM)
  403.   If @error Then MsgBox(0 + 16, "提示", "为" & $file & "设置属性错误")
  404.  EndIf
  405.  If BitAND(GUICtrlRead($Checkbox11), $GUI_CHECKED) = $GUI_CHECKED Then
  406.   FileSetAttrib($file, "+" & $HIDE)
  407.   If @error Then MsgBox(0 + 16, "提示", "为" & $file & "设置属性错误")
  408.  EndIf
  409.  If BitAND(GUICtrlRead($Checkbox12), $GUI_CHECKED) = $GUI_CHECKED Then
  410.   FileSetAttrib($file, "+" & $NORMAL)
  411.   If @error Then MsgBox(0 + 16, "提示", "为" & $file & "设置属性错误")
  412.  EndIf
  413.  If BitAND(GUICtrlRead($Checkbox13), $GUI_CHECKED) = $GUI_CHECKED Then
  414.   FileSetAttrib($file, "+" & $OFFLINE)
  415.   If @error Then MsgBox(0 + 16, "提示", "为" & $file & "设置属性错误")
  416.  EndIf
  417.  If BitAND(GUICtrlRead($Checkbox14), $GUI_CHECKED) = $GUI_CHECKED Then
  418.   FileSetAttrib($file, "+" & $TEMPORARY)
  419.   If @error Then MsgBox(0 + 16, "提示", "为" & $file & "设置属性错误")
  420.  EndIf
  421. EndFunc   ;==>SingleAddAttrib
  422. Func SingleDelAttrib()
  423.  $file = GUICtrlRead($Input1)
  424.  If BitAND(GUICtrlRead($Checkbox8), $GUI_CHECKED) = $GUI_CHECKED Then
  425.   FileSetAttrib($file, "-" & $READONLY)
  426.   If @error Then MsgBox(0 + 16, "提示", "为" & $file & "设置属性错误")
  427.  EndIf
  428.  If BitAND(GUICtrlRead($Checkbox9), $GUI_CHECKED) = $GUI_CHECKED Then
  429.   FileSetAttrib($file, "-" & $ARCHIVE)
  430.   If @error Then MsgBox(0 + 16, "提示", "为" & $file & "设置属性错误")
  431.  EndIf
  432.  If BitAND(GUICtrlRead($Checkbox10), $GUI_CHECKED) = $GUI_CHECKED Then
  433.   FileSetAttrib($file, "-" & $SYSTEM)
  434.   If @error Then MsgBox(0 + 16, "提示", "为" & $file & "设置属性错误")
  435.  EndIf
  436.  If BitAND(GUICtrlRead($Checkbox11), $GUI_CHECKED) = $GUI_CHECKED Then
  437.   FileSetAttrib($file, "-" & $HIDE)
  438.   If @error Then MsgBox(0 + 16, "提示", "为" & $file & "设置属性错误")
  439.  EndIf
  440.  If BitAND(GUICtrlRead($Checkbox12), $GUI_CHECKED) = $GUI_CHECKED Then
  441.   FileSetAttrib($file, "-" & $NORMAL)
  442.   If @error Then MsgBox(0 + 16, "提示", "为" & $file & "设置属性错误")
  443.  EndIf
  444.  If BitAND(GUICtrlRead($Checkbox13), $GUI_CHECKED) = $GUI_CHECKED Then
  445.   FileSetAttrib($file, "-" & $OFFLINE)
  446.   If @error Then MsgBox(0 + 16, "提示", "为" & $file & "设置属性错误")
  447.  EndIf
  448.  If BitAND(GUICtrlRead($Checkbox14), $GUI_CHECKED) = $GUI_CHECKED Then
  449.   FileSetAttrib($file, "-" & $TEMPORARY)
  450.   If @error Then MsgBox(0 + 16, "提示", "为" & $file & "设置属性错误")
  451.  EndIf
  452. EndFunc   ;==>SingleDelAttrib
  453. Func SetAttrib()
  454.  If BitAND(GUICtrlRead($Checkbox8), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($Checkbox8, $GUI_UNCHECKED)
  455.  If BitAND(GUICtrlRead($Checkbox9), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($Checkbox9, $GUI_UNCHECKED)
  456.  If BitAND(GUICtrlRead($Checkbox10), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($Checkbox10, $GUI_UNCHECKED)
  457.  If BitAND(GUICtrlRead($Checkbox11), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($Checkbox11, $GUI_UNCHECKED)
  458.  If BitAND(GUICtrlRead($Checkbox12), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($Checkbox12, $GUI_UNCHECKED)
  459.  If BitAND(GUICtrlRead($Checkbox13), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($Checkbox13, $GUI_UNCHECKED)
  460.  If BitAND(GUICtrlRead($Checkbox14), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($Checkbox14, $GUI_UNCHECKED)
  461.  
  462.  GUICtrlSetState($Checkbox8, $GUI_ENABLE)
  463.  GUICtrlSetState($Checkbox9, $GUI_ENABLE)
  464.  GUICtrlSetState($Checkbox10, $GUI_ENABLE)
  465.  GUICtrlSetState($Checkbox11, $GUI_ENABLE)
  466.  GUICtrlSetState($Checkbox12, $GUI_ENABLE)
  467.  GUICtrlSetState($Checkbox13, $GUI_ENABLE)
  468.  GUICtrlSetState($Checkbox14, $GUI_ENABLE)
  469. EndFunc   ;==>SetAttrib
  470. Func Check()
  471.  $file_check = GUICtrlRead($Input1)
  472.  $Attrib1 = FileGetAttrib($file_check)
  473.  If GUICtrlRead($Input1) <> "" Then
  474.   If BitAND(GUICtrlRead($Radio3), $GUI_CHECKED) = $GUI_CHECKED Then
  475.    If StringInStr($Attrib1, 'R') Then
  476.     GUICtrlSetState($Checkbox8, $GUI_DISABLE)
  477.    Else
  478.     GUICtrlSetState($Checkbox8, $GUI_ENABLE)
  479.    EndIf
  480.    If StringInStr($Attrib1, 'A') Then
  481.     GUICtrlSetState($Checkbox9, $GUI_DISABLE)
  482.    Else
  483.     GUICtrlSetState($Checkbox9, $GUI_ENABLE)
  484.    EndIf
  485.    If StringInStr($Attrib1, 'S') Then
  486.     GUICtrlSetState($Checkbox10, $GUI_DISABLE)
  487.    Else
  488.     GUICtrlSetState($Checkbox10, $GUI_ENABLE)
  489.    EndIf
  490.    If StringInStr($Attrib1, 'H') Then
  491.     GUICtrlSetState($Checkbox11, $GUI_DISABLE)
  492.    Else
  493.     GUICtrlSetState($Checkbox11, $GUI_ENABLE)
  494.    EndIf
  495.    If StringInStr($Attrib1, 'N') Then
  496.     GUICtrlSetState($Checkbox12, $GUI_DISABLE)
  497.    Else
  498.     GUICtrlSetState($Checkbox12, $GUI_ENABLE)
  499.    EndIf
  500.    If StringInStr($Attrib1, 'O') Then
  501.     GUICtrlSetState($Checkbox13, $GUI_DISABLE)
  502.    Else
  503.     GUICtrlSetState($Checkbox13, $GUI_ENABLE)
  504.    EndIf
  505.    If StringInStr($Attrib1, 'T') Then
  506.     GUICtrlSetState($Checkbox14, $GUI_DISABLE)
  507.    Else
  508.     GUICtrlSetState($Checkbox14, $GUI_ENABLE)
  509.    EndIf
  510.   Else
  511.    If Not StringInStr($Attrib1, 'R') Then
  512.     GUICtrlSetState($Checkbox8, $GUI_DISABLE)
  513.    Else
  514.     GUICtrlSetState($Checkbox8, $GUI_ENABLE)
  515.    EndIf
  516.    If Not StringInStr($Attrib1, 'A') Then
  517.     GUICtrlSetState($Checkbox9, $GUI_DISABLE)
  518.    Else
  519.     GUICtrlSetState($Checkbox9, $GUI_ENABLE)
  520.    EndIf
  521.    If Not StringInStr($Attrib1, 'S') Then
  522.     GUICtrlSetState($Checkbox10, $GUI_DISABLE)
  523.    Else
  524.     GUICtrlSetState($Checkbox10, $GUI_ENABLE)
  525.    EndIf
  526.    If Not StringInStr($Attrib1, 'H') Then
  527.     GUICtrlSetState($Checkbox11, $GUI_DISABLE)
  528.    Else
  529.     GUICtrlSetState($Checkbox11, $GUI_ENABLE)
  530.    EndIf
  531.    If Not StringInStr($Attrib1, 'N') Then
  532.     GUICtrlSetState($Checkbox12, $GUI_DISABLE)
  533.    Else
  534.     GUICtrlSetState($Checkbox12, $GUI_ENABLE)
  535.    EndIf
  536.    If Not StringInStr($Attrib1, 'O') Then
  537.     GUICtrlSetState($Checkbox13, $GUI_DISABLE)
  538.    Else
  539.     GUICtrlSetState($Checkbox13, $GUI_ENABLE)
  540.    EndIf
  541.    If Not StringInStr($Attrib1, 'T') Then
  542.     GUICtrlSetState($Checkbox14, $GUI_DISABLE)
  543.    Else
  544.     GUICtrlSetState($Checkbox14, $GUI_ENABLE)
  545.    EndIf
  546.   EndIf
  547.  EndIf
  548. EndFunc   ;==>Check


下载地址:
http://u.115.com/file/f5566104f9
批量或单个属性设置助手.7z
附件: 批量或单个属性设置助手.7z (381 K) 下载次数:88
本帖最近评分记录:
  • 无痕币:+50(雨过心晴) 辛苦了!
  • 无痕币:+50(勇者无敌) 原创内容
  • 无痕币:+50(realqwh) 很不错,建议在程序说明 ..
  • 无限追求,超越自我!
    级别: 三阵秋雨
    UID: 72944
    精华: 0
    发帖: 129
    威望: 1712 点
    无痕币: 3541 WHB
    贡献值: 0 点
    在线时间: 25(时)
    注册时间: 2008-12-26
    最后登录: 2017-10-19

    学习了,又长知识了
    做个真正的自己
    级别: 九滴秋露

    UID: 25831
    精华: 0
    发帖: 60347
    威望: 62323 点
    无痕币: 2621 WHB
    贡献值: 0 点
    在线时间: 3505(时)
    注册时间: 2008-05-01
    最后登录: 2017-12-11

    这个可能用不着了
    级别: 初声乍地
    UID: 210360
    精华: 0
    发帖: 1
    威望: 0 点
    无痕币: -1 WHB
    贡献值: 0 点
    在线时间: 0(时)
    注册时间: 2013-04-12
    最后登录: 2013-04-12

    不错,好东西,正需要收藏了
    级别: 二分秋色
    UID: 88278
    精华: 0
    发帖: 53
    威望: 290 点
    无痕币: 620 WHB
    贡献值: 0 点
    在线时间: 14(时)
    注册时间: 2009-10-01
    最后登录: 2017-06-20

    学习了。仔细读读。
    级别: 四缕秋风
    UID: 549
    精华: 0
    发帖: 207
    威望: 2902 点
    无痕币: 1659 WHB
    贡献值: 0 点
    在线时间: 92(时)
    注册时间: 2007-11-25
    最后登录: 2017-05-05

    这个小工具不错,收藏了。
    级别: 三阵秋雨
    UID: 216255
    精华: 0
    发帖: 90
    威望: 854 点
    无痕币: 1678 WHB
    贡献值: 0 点
    在线时间: 32(时)
    注册时间: 2013-07-07
    最后登录: 2017-06-03

    经典,支持。。。
    级别: 三阵秋雨
    UID: 115331
    精华: 0
    发帖: 132
    威望: 1450 点
    无痕币: 918 WHB
    贡献值: 0 点
    在线时间: 7(时)
    注册时间: 2011-02-04
    最后登录: 2016-03-22

    简单易懂   谢谢了
    父母的现在,就是我们的将来,善待父母就是善待我们自己.
    千山同一月 万户尽皆春 千江有水千江月 万里无云万里天
    级别: 总版主

    UID: 998
    精华: 0
    发帖: 362400
    威望: 307651 点
    无痕币: 271 WHB
    贡献值: 0 点
    在线时间: 34599(时)
    注册时间: 2008-12-25
    最后登录: 2017-12-11

    这个用不上的
    级别: 初声乍地
    UID: 219767
    精华: 0
    发帖: 11
    威望: 0 点
    无痕币: 21 WHB
    贡献值: 0 点
    在线时间: 3(时)
    注册时间: 2013-09-20
    最后登录: 2017-07-10

    非常好用的便捷工具,谢谢分享
    上一主题下一主题
    «123»Pages: 1/3     Go
    Total 0.088241(s) query 4, Time now is:12-11 21:25, Gzip enabled 粤ICP备07514325号-1
    Powered by PHPWind v7.3.2 Certificate Code © 2003-13 秋无痕论坛