Sign in to follow this  
Followers 0
Joscpe

FileSetAttrib problem

3 posts in this topic

I am using a func() to set the file attributes and it doesnt seem to work.

Func Set()
    $Box = MsgBox(4, "Are your sure?", "Are you sure you want to change this files attributes?")
    If $Box = 6 Then
        $checked = ""
        $plus = ""
        $minus = ""
        If GUICtrlRead($chkReadOnly) = $GUI_CHECKED Then 
            $plus = $plus & "R"
        Else
            $minus =  $minus & "R"
        Endif
        If GUICtrlRead($chkHidden) = $GUI_CHECKED Then 
            $plus = $plus &"H"
        Else
            $minus =  $minus & "H"
        Endif
        If GUICtrlRead($chkArchive) = $GUI_CHECKED Then 
            $plus = $plus &"A"
        Else
            $minus =  $minus & "A"
        Endif
        If GUICtrlRead($chkSystem) = $GUI_CHECKED Then 
            $plus = $plus & "S"
        Else
            $minus =  $minus & "S"
        Endif
        If GUICtrlRead($chkTemporary) = $GUI_CHECKED Then 
            $plus = $plus & "T"
        Else
            $minus =  $minus & "T"
        Endif
        If GUICtrlRead($chkDirectory) = $GUI_CHECKED Then 
            $plus = $plus & "D"
        Else
            $minus =  $minus & "D"
        Endif
        If GUICtrlRead($chkOffline) = $GUI_CHECKED Then 
            $plus = $plus & "O"
        Else
            $minus =  $minus & "O"
        Endif
        If GUICtrlRead($chkCompressed) = $GUI_CHECKED Then 
            $plus = $plus & "C"
        Else
            $minus =  $minus & "C"
        Endif
        $checked =  "-" & $minus & "+" & $plus 
        Msgbox(0,"Test",GUICtrlRead($txtFile) & @CRLF & $checked)
        FileSetAttrib(GUICtrlRead($txtFile), $checked)
    EndIf
EndFunc

I have tried everything, I am hoping someone on here could help.

the variables are pretty simple to find out what they are chk = guictrlcreatecheckbox.


-Joscpe

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Very nice first post!!!!!

but... no one else responded and.... if they are thinking like me....

i dont want to have to write the full GUI just to test your script... next time give us an example of the problem or the completed script

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I am using a func() to set the file attributes and it doesnt seem to work.

CODE

Func Set()

$Box = MsgBox(4, "Are your sure?", "Are you sure you want to change this files attributes?")

If $Box = 6 Then

$checked = ""

$plus = ""

$minus = ""

If GUICtrlRead($chkReadOnly) = $GUI_CHECKED Then

$plus = $plus & "R"

Else

$minus = $minus & "R"

Endif

If GUICtrlRead($chkHidden) = $GUI_CHECKED Then

$plus = $plus &"H"

Else

$minus = $minus & "H"

Endif

If GUICtrlRead($chkArchive) = $GUI_CHECKED Then

$plus = $plus &"A"

Else

$minus = $minus & "A"

Endif

If GUICtrlRead($chkSystem) = $GUI_CHECKED Then

$plus = $plus & "S"

Else

$minus = $minus & "S"

Endif

If GUICtrlRead($chkTemporary) = $GUI_CHECKED Then

$plus = $plus & "T"

Else

$minus = $minus & "T"

Endif

If GUICtrlRead($chkDirectory) = $GUI_CHECKED Then

$plus = $plus & "D"

Else

$minus = $minus & "D"

Endif

If GUICtrlRead($chkOffline) = $GUI_CHECKED Then

$plus = $plus & "O"

Else

$minus = $minus & "O"

Endif

If GUICtrlRead($chkCompressed) = $GUI_CHECKED Then

$plus = $plus & "C"

Else

$minus = $minus & "C"

Endif

$checked = "-" & $minus & "+" & $plus

Msgbox(0,"Test",GUICtrlRead($txtFile) & @CRLF & $checked)

FileSetAttrib(GUICtrlRead($txtFile), $checked)

EndIf

EndFunc

I have tried everything, I am hoping someone on here could help.

the variables are pretty simple to find out what they are chk = guictrlcreatecheckbox.

What do you mean by "doesnt seem to work"? Do the results look right in the "Test" MsgBox()? You could add some more debugging with:

...
        $checked =  "-" & $minus & "+" & $plus
        $targetfile = GUICtrlRead($txtFile)
        Msgbox(0,"Test", $targetfile & @CRLF & $checked)
        If FileSetAttrib($targetfile, $checked) Then
            MsgBox(64, "Test", "FileSetAttrib() returned success (1).")
        Else
            MsgBox(16, "Test", "FileSetAttrib() returned failure (0).")
        EndIf
    EndIf
EndFunc

:P

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0