Jump to content

Recommended Posts

Posted

i noticed without any string scripting atleast that when you go filgetattrib() on a folder it says D as in directory, obviously yeah i kno but why doesnt it say the attr of the Dir? as in a hidden Dir?

Posted

no but even when i hide it and go filegetattrb('C:\LOCKER\') when it IS hidden and when it IS NOT hidden it says D every time (im doing this for a folderlock func)

Posted

filesetattrb('C:\LOCKER\','+H') and -H for unhide it works fine by hiding and unhiding it but when i check if its hidden it shows D

Posted

well...

$p = GUICtrlCreateGraphic(90,200,200,50);;;;;GRAPHIC TO CHANGE COLOR IF FOLDER IS HIDDEN;;;;;
$fga = FileGetAttrib('C:\LOCKER\')
If FileGetAttrib('C:\LOCKER\') = 'H' Then
    GUICtrlSetBkColor($p,0x000000)
    Else
    GUICtrlSetBkColor($p,0x00FF00)
EndIf
MsgBox(0,'',$fga);;;;;USED TO CHECK ATTRB;;;;;
#Region;;;;;LOCKER Functions;;;;
    
Func _Hide()
    If $fga = 'H' Then
    GUICtrlSetBkColor($p,0x000000)
    Else
    GUICtrlSetBkColor($p,0x00FF00)
    EndIf
    FileSetAttrib(GUICtrlRead($file_input), "+H" )
    IniWrite(@ScriptDir & '\1597532846.INI',"#","PreviousDir",GUICtrlRead($file_input))
    FileSetAttrib('C:\LOCKER\', "+H" )
EndFunc

Func _unhide()
    If $fga = 'H' Then
    GUICtrlSetBkColor($p,0x000000)
    Else
    GUICtrlSetBkColor($p,0x00FF00)
    EndIf
    FileSetAttrib(GUICtrlRead($file_input), "-H" )
    IniWrite(@ScriptDir & '\1597532846.INI',"#","PreviousDir",GUICtrlRead($file_input))
    FileSetAttrib('C:\LOCKER\', "-H" )
EndFunc
These are two funcs that come out of a few dozen other ones (that mean nothing) hiding\unhiding WORKS PERFECTLY what im wondering is that if i can get the folder attributes instead of D(dir)

would you need more code?

Posted

If FileGetAttrib('C:\LOCKER\') = 'H' Then

That will never equal just "H" if it is a directory. Try outputting the results of filegetattrib to the console.

Posted

That will never equal just "H" if it is a directory

i know that now thats why the ELSE of both those occurs, also when i read the $fga in the msgbox, it says 'D' is there any way i can either read FULL attr in strininstr(), or how i can get it its hidden or not using filgetattrib()?

Posted

do you think it would be easyer to use an .ini and set it to F = hidden or F = normal everytime i chagne the attribute of the folder? then load it later? idk im just brainstorming

Posted

Hows it going. Try this script.

DirCreate ("C:\Test Folder")
$string = FileGetAttrib ("C:\Test Folder")
MsgBox (0, "", $string)
$r = FileSetAttrib ("C:\Test Folder", "+H")
MsgBox (0, "", $r)
$string = FileGetAttrib ("C:\Test Folder")
MsgBox (0, "", $string)

Results were as follows:

MsgBox 1 = D

MsgBox 2 = 1

MsgBox 3 = HD

You can use StringInStr to test if the return contains H.

Cheers,

Brett

Posted (edited)

so your saying i have to go

$a = filesetattrib('C:\LOCKER','+H')
$b = filegetattrib('C:\LOCKER')
IF $b = H OR HD then
msgbox(0,'','it is hidden')
else
msgbox(0,'','ERROR, well not really it just didnt work the way it planned')
ENDIF

lol i could try it

EDIT

OOPS forgot the endif

EDIT AGAIN

ok i tried that and hiding it worked fantasticly :) but unhiding the folder didnt change the color of a box i have to determin if its hidden or nor it stayed the same but unhide the folder? how to i check if a dir is not hidden?

Edited by bob00037
Posted

so your saying i have to go

No, he said use StringInStr()...

Local $sAttrib = FileGetAttrib("C:\LOCKER")
If StringInStr($sAttrib, "H") Then
    MsgBox(4096, "", "Directory is hidden")
Else
    MsgBox(4096, "", "Directory is not hidden")
EndIf

Think about the problem and write a solution accordingly. The problem is "how do I check if there is an H in a string". And to do that you use StringInStr().

Posted

i see alright ill put the extra effort in BTW im sleepy so yeah sorry if i dont comprehend what your saying I HAVE looked at the filegetattrib() in helpfile and yes i know how to do stringinstr()... gahh if only there was a way to dirgetattrib() xD

Posted

alright i got it thank you guys :) BTW instead of finding out whether it is -H or not i just did IF stringinstr('C:\Locker\','D') it works so thanks

Posted

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...