SC: Script feeding (/flg=2) blocked by attr:TitlebarTemplate

Things you’d like to miss in the future...
Forum rules
You might want to read this if you're looking for priority service

:info: Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
Post Reply
Filehero
Posts: 2734
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

SC: Script feeding (/flg=2) blocked by attr:TitlebarTemplate

Post by Filehero »

Hi Don,

well this one was really haunting me and costs me hours to track down.

I first reported it here and summarized my findings here.


Defect observed
In my case running

Code: Select all

run "<xy> /script=""::msg 'Hi!';"" /flg=2", , 0,0; 
always resulted in a 2nd XY instance coming up to execute the script passed.


After even the very competent and helpful community went of ideas I bit the bullet and injected every single differing entry from my 'broken' XY ini into a fresh one step by step with restarting XY over without saving.
Result: If you set the TitlebarTemplate to one of the following values, the self-feeding fails, and a second XY instance get used to run the script instead.

EVIL

Code: Select all

<xypath>:<app> @ <ver> | <ver>
<xypath>:<app> <ver> | <path>
<xypath>:<app> <ver> |
<xypath>:<app> <ver>
:<app> <ver>
:<app><ver>
<app><ver>
<ver><app>
AAAAAA<ver><app>BBBBBBB

In contrast, the following values are

Harmless

Code: Select all

<xypath>:<app> @ <ini> | <ver>
<xypath>:<app> <ini> | <path>
<xypath><ver>
:<ver>
<ver>
. :<ver>
<app> <ver>
<ver> <app>
<app>

Cheers,
Filehero

Filehero
Posts: 2734
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Post by Filehero »

Hi Don,

can you repro?


Cheers,
Filehero

PS: Sorry for bumping, but I do take this bug personally :mrgreen:

admin
Site Admin
Posts: 67282
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Post by admin »

Sorry, but no time tonight anymore. This stuff is very nasty to check. :|

Filehero
Posts: 2734
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Post by Filehero »

admin wrote:Sorry, but no time tonight anymore. This stuff is very nasty to check. :|
No worries, I don't expect a fix soon (how could I?), I was just after a confirmation.

Yeah, the nastiness I learned to know. :twisted:

Peace. :D

admin
Site Admin
Posts: 67282
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Post by admin »

To identify other XY instances the title bar is checked: Does it look like an XY title bar? So there is a somewhat involved heuristics for this. I changed it a bit so in the next version most of your evil stuff will be turned harmless. Let's see what remains.

Filehero
Posts: 2734
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Post by Filehero »

admin wrote:To identify other XY instances the title bar is checked: Does it look like an XY title bar?
:shock: Now, this explains everything - including me having absolutely no clue about programming with the Windows api/VB6. :whistle:

I really have thought the logic would stay within the current context, e.g. something like

Code: Select all

this.scEngine.runScript($scriptHandle);
is called on the instance the command is triggered.

Usually, I don't care about window titles, but with XY and your high rate releasecycles seeing the app folder and the version number is not just handy but rather a necessity. :wink:

Thanks for taking care, will report back then.


Cheers,
Filehero

admin
Site Admin
Posts: 67282
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Post by admin »

Filehero wrote:I really have thought the logic would stay within the current context, e.g. something like

Code: Select all

this.scEngine.runScript($scriptHandle);
is called on the instance the command is triggered.
When you are doing this, you are clearly calling another instance, not this instance:

Code: Select all

run "<xy> /script=""::msg 'Hi!';"" /flg=2", , 0,0; 
A new XYplorer.exe will invariably be opened. Then, depending on the command line, on its own INI file setting, and on the presence of probable other XYplorer instances, this instance will decide whether it will continue to load, or exit and pass the command line to one of the already existing instances.

Just got an idea to make this more controlled from the POV of the caller, pass the window handle!

Code: Select all

/hwnd=<hwnd>
Pass the calling window handle via command line. Then the called instance would not need to look for other instances, but simply pass it on to this window handle. But no time for it now.... bump me later. :)

Filehero
Posts: 2734
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Post by Filehero »

admin wrote:When you are doing this, you are clearly calling another instance, not this instance:

Code: Select all

run "<xy> /script=""::msg 'Hi!';"" /flg=2", , 0,0; 
Yes, you're right. Wer Lesen kann ...

admin wrote:Just got an idea to make this more controlled from the POV of the caller, pass the window handle!

Code: Select all

/hwnd=<hwnd>
Pass the calling window handle via command line. Then the called instance would not need to look for other instances, but simply pass it on to this window handle.
Sounds good, just a direct handle.

Bump has to wait until the revolution has settled. :wink:

admin
Site Admin
Posts: 67282
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Post by admin »

The dust is settling. I found the time to do it... :)

Filehero
Posts: 2734
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Post by Filehero »

admin wrote:The dust is settling. I found the time to do it... :)
It works like charm, great and well done "fix".

Thanks a lot. :D


Cheers,
Filehero

Post Reply