Page 1 of 1
Possible bug in get("instance") after an XY update
Posted: 23 Feb 2018 16:39
by klownboy
For awhile now it seems that whenever I run a script that contains the following line of code, anytime
after performing an update of XYplorer (i.e., XY has already been closed and restarted), that line of code causes XY to exit and I have to restart it.
Code: Select all
if(get("instance") == '2') {exit n;end 1;}
In stepping through the script, when it gets to the line above, the if statement evaluates true and therefore exits XY. Only one instance of XY is open. The script is one that I use quite often assigned to a CTB. It essentially gets me to what I what call my 'normal' configuration (look and layout, etc.) and it of course will close a second instance if I had one open.
It appears that after an update, XY for some reason thinks the newly reopened XYplorer is a second instance. As I said though, XYplorer was already been closed and restarted when this happens. This did not happen before, but it's been doing this for quite a few months.
Re: Possible bug in get("instance") after an XY update
Posted: 23 Feb 2018 16:49
by jupe
I am not an experienced coder but does the "exit n" need the n to be quoted? like so
exit "n"; it may not make a difference anyway, I haven't tested it, also just for my own comprehension, does the end 1; still get processed after the exit command?
@Don, just in case this is relevant, (to do with 2 process's):
viewtopic.php?f=2&t=18458
Re: Possible bug in get("instance") after an XY update
Posted: 23 Feb 2018 17:06
by klownboy
Thanks jupe you're right, the "n" should be quoted. No time now, but when I get back from some errands, I'll install an old version and retry it. From some quick test though it doesn't appear the unquoted "n" is the issue. I'll followup.
Re: Possible bug in get("instance") after an XY update
Posted: 23 Feb 2018 19:01
by klownboy
Followup on posted issue. I downgraded XYplorer and then updated to the latest version with the same result. Before doing so, I made sure the exit "n" in my script was properly quoted. So the original post with the potential bug stands. Thanks.
As a secondary question though, the help file for get("instance") says:
"Instance", [on_first=1], [on_nonfirst=2]
Tells you, if you have multiple instances of XY, whether the current instance is the first instance or not.
I question that help statement is really true at least the way it is written. From get("instance") I can determine what instance is the current active XYplorer window (i.e., if the current "active" window is instance "1 it tells me that correctly (1); if the current "active" window is instance "2" it tells me that it's instance 2 correctly). It does
not tell me if I have multiple instances regardless of the current instance as the help seems to indicate. In other words I'd like to find out if I have a second instance of XY open when my current active window is 1. Am I missing something? I'd like to be able to do that without resorting to using a command line with taskmgr.exe. Thanks again.
Re: Possible bug in get("instance") after an XY update
Posted: 24 Feb 2018 10:46
by admin
Not sure if I understand correctly
- I run XYplorer v18.70.0100
- I let it self-update to v18.70.0104
All cool.

Re: Possible bug in get("instance") after an XY update
Posted: 24 Feb 2018 13:03
by klownboy
Don, what I'm having a problem with is the following line of code within a script. It checks if the current active window of XYplorer is instance 2. If it is, it's suppose to close instance 2 of XYplorer.
Code: Select all
if(get("instance") == '2') {exit "n"; end 1;}
But it closes instance 1 even if there is only one instance. Right after an update is complete and XYplorer restarted, try the above code.
As you stated,
echo get("instance"); //1 is giving the correct result but the above check for instance 2 is also giving a true result.
Re: Possible bug in get("instance") after an XY update
Posted: 24 Feb 2018 13:35
by admin
Does not happen here, and cannot happen looking at the code. Maybe some other line in your script is the culprit.
Re: Possible bug in get("instance") after an XY update
Posted: 24 Feb 2018 14:13
by klownboy
I nailed the issue down. It does not happen if I use your internal SC update in a script to accomplish the update. It does happen if I use SimpleUpdater.xys that I've used for a long time.
viewtopic.php?f=7&t=8744&hilit=SimpleUpdater.xys I haven't looked at the script to see why but it does and SC update does not consistently. Sorry...end of that discussion.
Could you take a look at my second issue though that I mentioned here
viewtopic.php?f=2&t=18520#p156392 in this thread. I'll repeat for ease of viewing.
The help file for get("instance") says:
"Instance", [on_first=1], [on_nonfirst=2]
Tells you, if you have multiple instances of XY, whether the current instance is the first instance or not.
I question that help statement is really true at least the way it is written. From get("instance") I can determine what instance is the current active XYplorer window (i.e., if the current "active" window is instance "1 it tells me that correctly (1); if the current "active" window is instance "2" it tells me that it's instance 2 correctly). It does not tell me if I have multiple instances regardless of the current instance as the help seems to indicate. In other words I'd like to find out if I have a second instance of XY open when my current active window is 1. Am I missing something? I'd like to be able to do that without resorting to using a command line with taskmgr.exe. Thanks again.
Re: Possible bug in get("instance") after an XY update
Posted: 25 Feb 2018 12:36
by admin
klownboy wrote:The help file for get("instance") says:
"Instance", [on_first=1], [on_nonfirst=2]
Tells you, if you have multiple instances of XY, whether the current instance is the first instance or not.
I question that help statement is really true at least the way it is written. From get("instance") I can determine what instance is the current active XYplorer window (i.e., if the current "active" window is instance "1 it tells me that correctly (1); if the current "active" window is instance "2" it tells me that it's instance 2 correctly). It does not tell me if I have multiple instances regardless of the current instance as the help seems to indicate. In other words I'd like to find out if I have a second instance of XY open when my current active window is 1. Am I missing something? I'd like to be able to do that without resorting to using a command line with taskmgr.exe. Thanks again.
That might be a deficit in my English syntax. I wanted to say this:
"Tells you whether the current instance is the first instance or not (the latter can be the case if you have multiple instances of XY)."
Re: Possible bug in get("instance") after an XY update [solved]
Posted: 25 Feb 2018 13:16
by klownboy
Thanks Don, I thought it was just wording. So in the end, instance "1" knows what it is, but doesn't know if there's a "2" and visa versa.
Kind of strange with the SimpleUpdater script that I end up in an instance "2" after an update with no instance "1". I reported that to Marco in the script section. That's why mt script exited.
Re: Possible bug in get("instance") after an XY update
Posted: 25 Feb 2018 13:41
by admin
Don't know how the script works, but if it starts a new instance of XYplorer before closing its own instance (and itself), then this new instance will be #2. I assume this is what happens.
I changed the Help text to this:
Tells you whether the current instance is the first instance or not. The latter can be the case if you opened multiple instances of XYplorer. Note that even if you later close the first instance of two, the remaining instance will continue to report that it is non-first.
is this clearer now?
Re: Possible bug in get("instance") after an XY update
Posted: 25 Feb 2018 13:57
by klownboy
Reads fine to me. Thanks.