obviously setkey is a SC command and has no return value.
Of course I can check with getkey to see if the value is the one desired.
but of course, this takes unreasonable time since the file needs to be accessed again.
would it not be better if setkey was a function and had a return value indicating whether it was successful or not?
how to check whether setkey was successful ?
-
autocart
- Posts: 1391
- Joined: 26 Sep 2013 15:22
how to check whether setkey was successful ?
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList
-
PeterH
- Posts: 2830
- Joined: 21 Nov 2005 20:39
- Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%
Re: how to check whether setkey was successful ?
I think we had this type of problem long long ago, maybe not in exact the same context.
My current idea for this would be if XY defined a variable like <rc>, containing return code information for the last executed command or function. (This way it also could be used for functions usually returning other information.)
My current idea for this would be if XY defined a variable like <rc>, containing return code information for the last executed command or function. (This way it also could be used for functions usually returning other information.)
-
admin
- Site Admin
- Posts: 66677
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: how to check whether setkey was successful ?
Good idea, but cannot be done. It would be an incredible amount of work to implement and document it.PeterH wrote:I think we had this type of problem long long ago, maybe not in exact the same context.
My current idea for this would be if XY defined a variable like <rc>, containing return code information for the last executed command or function. (This way it also could be used for functions usually returning other information.)
FAQ | XY News RSS | XY X
-
autocart
- Posts: 1391
- Joined: 26 Sep 2013 15:22
Re: how to check whether setkey was successful ?
what about only transforming setkey into a function (instead of a command)?admin wrote:Good idea, but cannot be done. It would be an incredible amount of work to implement and document it.PeterH wrote:I think we had this type of problem long long ago, maybe not in exact the same context.
My current idea for this would be if XY defined a variable like <rc>, containing return code information for the last executed command or function. (This way it also could be used for functions usually returning other information.)
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList
-
admin
- Site Admin
- Posts: 66677
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: how to check whether setkey was successful ?
A troublesome thing to do. I see no compelling reason to go that way.
FAQ | XY News RSS | XY X
-
autocart
- Posts: 1391
- Joined: 26 Sep 2013 15:22
Re: how to check whether setkey was successful ?
ok, no big issue. was just asking.
there still is the workarund of checking with getkey.
there still is the workarund of checking with getkey.
[AHK] redirecting Windows Explorer to XY, [XYS] Mini Tree with open tabs (cur loc expanded, tab folders highlighted), [AHK] customInlineRenameKeys, [AHK] clipboardHelper_and_XYEscToList
-
bdeshi
- Posts: 4256
- Joined: 12 Mar 2014 17:27
- Location: Asteroid B-612
- Contact:
Re: how to check whether setkey was successful ?
You could check the file size, modified date etc before and after the setkey cmd.. If they differ, setkey was probably successful.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
-
highend
- Posts: 14996
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: how to check whether setkey was successful ?
Or a hash value (what I do with my files to make sure they weren't modified)...
One of my scripts helped you out? Please donate via Paypal
-
bdeshi
- Posts: 4256
- Joined: 12 Mar 2014 17:27
- Location: Asteroid B-612
- Contact:
Re: how to check whether setkey was successful ?
That's probably even slower than getkey since hash functions have to read the entire file.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
-
highend
- Posts: 14996
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: how to check whether setkey was successful ?
Calculating a sha1 hash 100 times (in a loop) for an .ini file with two sections and 25 key-value pairs takes 47ms. Can't see an issue there.
One of my scripts helped you out? Please donate via Paypal
XYplorer Beta Club