tatagi wrote: ↑01 Oct 2020, 19:25
Oh, I tested my original script with #warn on top, and it really shows error dialog..never realized because all my hotkey worked well. So does having unreachable code in the script, although fully working, cause problem that I am not aware of?
Bear in mind that it is question of preventive warnings:
#Warn is first and foremost designed to prevent bad coding habits. Furthermore, the seriousness of the situation depends on the specific conditions which triggered the warning. For instance, a return after a single-line hotkey is simply redundant but cannot be considered as an error, strictly speaking, as I see it. In your script, there's unreacable code. In that case also, it is not question (
a priori) of an error: despite some unreachable code, your script can work as intended; that means the given code is simply superflous; you might simply remove this unreachable code since, anyway, it is not executed (just as the msgbox that never shows up above). But if the given code perform key procedures, your script is likely to not work as expected.
It's just my opinion but if your script displays one or more warnings when adding
#Warn, and even it it not question of errors strictly speaking, you should rewrite your script so that warnings are suppressed (first of all because if someonelse use your code and use for its part
#Warn it will get annoying warnings: this was exactly what happened here except that you were by turns the one that don't use it and the one that use it).
In reviewing my script, I wonder if I haven't spoken too hastily:
Critical might sometimes lead to problems.
It is quite unlikely that
Critical may prevent your script from working but you can remove this word from the script (there's only one occurrence of this command in the clipcursor script I provided) since it is optional in this case.
Otherwise, if despite a rewrite matching the prerequisites of
#Warn your script still malfunctions after merging it with mine, I must admit that I'll can't explain it; I'll be out of ideas.
Hope this helps
A_AhkUser