nice script it remindes me of one of my first script that uses windows attributes commands
Code:
#notrayicon
AGB_LoadIconDll(btn1, "shell32.dll", 4)
Gui, Add, Edit, x6 y27 w320 vfolder ,
Gui, Add, Button, x336 y27 w30 gbrowse2, &...
AddGraphicButtonGui("cauta", btn1, "x371 y27 w25 gbrowse")
Gui, Add, Button, x406 y27 w100 gexecuta, Execute
Gui, Add, CheckBox, x6 y57 h30 vs, System
Gui, Add, CheckBox, x86 y57 h30 vh, Hidden
Gui, Add, CheckBox, x166 y57 h30 vr, Read-only
Gui, Add, CheckBox, x246 y57 h30 va, Archive
Gui, Add, CheckBox, x326 y57 h30 vincdir, Include subdir
Gui, Add, CheckBox, x426 y57 h30 vincf, Include files
Gui, Add, Text, x16 y7 w440 h20 , Chose the file/folder you wish to modify
Gui, Show, h81 w530, Attribute Modifier
Return
GuiClose:
ExitApp
browse:
FileSelectFolder, folder1
if folder1 =
return
else
guicontrol,enable,incdir
guicontrol,enable,incf
guicontrol,,s,0
guicontrol,,r,0
guicontrol,,h,0
guicontrol,,a,0
guicontrol,,folder,%folder1%
Random, rand , 10000, 9999999
text=attrib "%folder1%" > %a_temp%\%rand%.txt
fileappend,%text%, %a_temp%\%rand%.cmd
runwait,%a_temp%\%rand%.cmd,,hide
FileRead, read, %a_temp%\%rand%.txt
StringReplace, read, read, %folder1%,, All
StringReplace, read, read, %a_tab%,, All
StringReplace, read, read, %a_space%,, All
filedelete %a_temp%\%rand%.cmd
filedelete %a_temp%\%rand%.txt
IfInString, read, S
guicontrol,,s,1
IfInString, read, R
guicontrol,,r,1
IfInString, read, H
guicontrol,,h,1
IfInString, read, A
guicontrol,,a,1
return
executa:
gui,submit,nohide
if folder=
return
if s=1
sys=+s
if r=1
readonly=+r
if a=1
archive=+a
if h=1
hidden=+h
if s=0
sys=-s
if r=0
readonly=-r
if a=0
archive=-a
if h=0
hidden=-h
if incdir=1
incldir=/d
if incf=1
{
inclf=/s
ifn=\*
}
Random, rand , 10000, 9999999
text=attrib "%folder%%ifn%" %sys% %readonly% %archive% %hidden% %incldir% %inclf% > %a_temp%\%rand%.txt
fileappend,%text%, %a_temp%\%rand%.cmd
runwait,%a_temp%\%rand%.cmd,,hide
FileRead, read, %a_temp%\%rand%.txt
StringReplace, read, read, %folder1%,, All
StringReplace, read, read, %a_tab%,, All
StringReplace, read, read, %a_space%,, All
filedelete %a_temp%\%rand%.cmd
filedelete %a_temp%\%rand%.txt
IfInString, read, S
guicontrol,,s,1
IfInString, read, R
guicontrol,,r,1
IfInString, read, H
guicontrol,,h,1
IfInString, read, A
guicontrol,,a,1
return
browse2:
FileSelectFile, folder1, 3, , Open a file
if folder1 =
return
else
guicontrol,,s,0
guicontrol,,r,0
guicontrol,,h,0
guicontrol,,a,0
guicontrol,,incdir,0
guicontrol,,incf,0
guicontrol,disable,incdir
guicontrol,disable,incf
guicontrol,,folder,%folder1%
Random, rand , 10000, 9999999
text=attrib "%folder1%" > %a_temp%\%rand%.txt
fileappend,%text%, %a_temp%\%rand%.cmd
runwait,%a_temp%\%rand%.cmd,,hide
FileRead, read, %a_temp%\%rand%.txt
StringReplace, read, read, %folder1%,, All
StringReplace, read, read, %a_tab%,, All
StringReplace, read, read, %a_space%,, All
filedelete %a_temp%\%rand%.cmd
filedelete %a_temp%\%rand%.txt
IfInString, read, S
guicontrol,,s,1
IfInString, read, R
guicontrol,,r,1
IfInString, read, H
guicontrol,,h,1
IfInString, read, A
guicontrol,,a,1
return
AddGraphicButtonGui(VariableName, ImgPath, Options="", bHeight=32, bWidth=32,gui=1){
Global
Local ImgType, ImgType1, ImgPath0, ImgPath1, ImgPath2, hwndmode
; BS_BITMAP := 128, IMAGE_BITMAP := 0, BS_ICON := 64, IMAGE_ICON := 1
Static LR_LOADFROMFILE := 16
Static BM_SETIMAGE := 247
Static NULL
SplitPath, ImgPath,,, ImgType1
If ImgPath is float
{
ImgType1 := (SubStr(ImgPath, 1, 1) = "0") ? "bmp" : "ico"
StringSplit, ImgPath, ImgPath,`.
%VariableName%_img := ImgPath2
hwndmode := true
}
ImgTYpe := (ImgType1 = "bmp") ? 128 : 64
If (%VariableName%_img != "") AND !(hwndmode)
DllCall("DeleteObject", "UInt", %VariableName%_img)
If (%VariableName%_hwnd = "")
Gui,%gui%: Add, Button, v%VariableName% hwnd%VariableName%_hwnd +%ImgTYpe% %Options%
ImgType := (ImgType1 = "bmp") ? 0 : 1
If !(hwndmode)
%VariableName%_img := DllCall("LoadImage", "UInt", NULL, "Str", ImgPath, "UInt", ImgType, "Int", bWidth, "Int", bHeight, "UInt", LR_LOADFROMFILE, "UInt")
DllCall("SendMessage", "UInt", %VariableName%_hwnd, "UInt", BM_SETIMAGE, "UInt", ImgType, "UInt", %VariableName%_img)
Return %VariableName%_img ; Return the handle to the image
}
AGB_LoadIconDll(ByRef VariableName, dllfile, nindex) {
Global
Local spid
spid := DllCall("GetCurrentProcessId")
If (%VariableName%_img != "")
DllCall("DeleteObject", "UInt", %VariableName%_img)
VariableName := "1." . DllCall("shell32.dll\ExtractIconA", "UInt", spid, "Str", dllfile, "UInt", nindex)
Return ErrorLevel
}