[v2.0.2] FileSetAttrib error in File-Loop Topic is solved

Report problems with documented functionality
autoexec
Posts: 22
Joined: 20 Feb 2023, 22:38

[v2.0.2] FileSetAttrib error in File-Loop

Post by autoexec » 31 Mar 2023, 08:59

Testing code:

Code: Select all

Loop Files, A_Temp "\*.*", "F"
{
	;Try FileSetAttrib "-R", A_LoopFileFullPath ; This works fine.
	Try FileSetAttrib "-R" ; Critical Error: Invalid memory read/write.
	Catch As Err
		MsgBox Type(Err) ": " Err.Message "`n`n" A_LoopFileName,, "Iconx"
}

iPhilip
Posts: 815
Joined: 02 Oct 2013, 12:21

Re: [v2.0.2] FileSetAttrib error in File-Loop

Post by iPhilip » 31 Mar 2023, 10:31

@autoexec, Can you point where in the Loop Files documentation it states that you can do that?
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)

gregster
Posts: 8999
Joined: 30 Sep 2013, 06:48

Re: [v2.0.2] FileSetAttrib error in File-Loop

Post by gregster » 31 Mar 2023, 10:57

I guess the problem is rather FileSetAttrib. Its docs say for the second parameter:
If omitted, the current file of the innermost enclosing File-Loop will be used instead.
In contrast, FileGetAttrib() seems to work fine like that.

iPhilip
Posts: 815
Joined: 02 Oct 2013, 12:21

Re: [v2.0.2] FileSetAttrib error in File-Loop

Post by iPhilip » 31 Mar 2023, 13:46

gregster wrote:
31 Mar 2023, 10:57
I guess the problem is rather FileSetAttrib. Its docs say for the second parameter:
If omitted, the current file of the innermost enclosing File-Loop will be used instead.
In contrast, FileGetAttrib() seems to work fine like that.
@gregster, Thank you. The quote is for FileGetAttrib but I get your point.
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)

gregster
Posts: 8999
Joined: 30 Sep 2013, 06:48

Re: [v2.0.2] FileSetAttrib error in File-Loop

Post by gregster » 31 Mar 2023, 13:51

iPhilip wrote:
31 Mar 2023, 13:46
gregster wrote:
31 Mar 2023, 10:57
I guess the problem is rather FileSetAttrib. Its docs say for the second parameter:
If omitted, the current file of the innermost enclosing File-Loop will be used instead.
In contrast, FileGetAttrib() seems to work fine like that.
@gregster, Thank you. The quote is for FileGetAttrib but I get your point.
No, I have actually taken this quote from the FileSetAttrib docs (see FilePattern, the second parameter).
But FileGetAttrib contains the same sentence (for its first and only parameter, FileName).

iPhilip
Posts: 815
Joined: 02 Oct 2013, 12:21

Re: [v2.0.2] FileSetAttrib error in File-Loop

Post by iPhilip » 31 Mar 2023, 14:04

gregster wrote:
31 Mar 2023, 13:51
No, I have actually taken this quote from the FileSetAttrib docs (see FilePattern, the second parameter).
But FileGetAttrib contains the same sentence (for its first and only parameter, FileName).
Thank you for pointing that out. It looks like a valid bug.
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)

autoexec
Posts: 22
Joined: 20 Feb 2023, 22:38

Re: [v2.0.2] FileSetAttrib error in File-Loop

Post by autoexec » 31 Mar 2023, 21:29

Yes, the FileGetAttrib, FileGetSize, FileGetTime, FileGetTime, FileSetAttrib and FileSetTime also can be used in File-Loop without FilePattern. Only FileSetAttrib has a this problem.



Post Reply

Return to “Bug Reports”