Opening Floating Preview

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
zakhar
Posts: 171
Joined: 08 Sep 2010 21:13

Opening Floating Preview

Post by zakhar »

Hello, dear XYplorer Community!
I am using XYporer v. 26.90.0205.
If running the combination of two scripts as shown underneath

Code: Select all

// 1. script:
// ...normal script actions...
if(...){
	load "<xyscripts>\Script-2.xys","Rename [ext]-Screenshot-file";
}
// "load" is the last command in the 1. script.

// 2. script:
// ...normal script actions...
 renameitem($name_new,$curitem_);
 #178;
// "#178" is the last command in the 2. script.
renameitem of the 2. script does what it should do but the Floating Preview does not open.

The 2. script opens Floating Preview only, if the 2. script is started directly whithout the 1. script.
Adding "#178;" to the 1. script after "load ..." gives the red message "item not found" in the right bottom corner.

What should I do to let the 2. script open the Floating Preview after renaming?

highend
Posts: 14553
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Opening Floating Preview

Post by highend »

selectitems on the renamed item before calling the preview?
One of my scripts helped you out? Please donate via Paypal

zakhar
Posts: 171
Joined: 08 Sep 2010 21:13

Re: Opening Floating Preview

Post by zakhar »

highend wrote: 08 Mar 2025 15:22 selectitems on the renamed item before calling the preview?
Inserting selectitems

Code: Select all

// ...normal script actions...
 renameitem($name_new,$curitem_);
 selectitems $path_name_new; // path and the new file name inside : $curpath_."\".$name_new
 #178;
does not work: the result is the aforementioned red message in the right corner "item not found".
Last edited by zakhar on 08 Mar 2025 15:48, edited 1 time in total.

highend
Posts: 14553
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Opening Floating Preview

Post by highend »

But you're working with setting "BackgroundFileOps", 0;?
One of my scripts helped you out? Please donate via Paypal

zakhar
Posts: 171
Joined: 08 Sep 2010 21:13

Re: Opening Floating Preview

Post by zakhar »

highend wrote: 08 Mar 2025 15:47 But you're working with setting "BackgroundFileOps", 0;?
Inserting setting "BackgroundFileOps",0; or setting "BackgroundFileOps",1;

Code: Select all

// ...normal script actions...
 renameitem($name_new,$curitem_);
 setting "BackgroundFileOps",[0 or 1];
 selectitems $path_name_new; // path and the new file name inside : $curpath_."\".$name_new
 #178;
does not work too: the result is the aforementioned red message in the right bottom corner "item not found".

highend
Posts: 14553
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Opening Floating Preview

Post by highend »

No clue what you're doing, but using this works fine, "3.txt" will be previewed:

script 1:

Code: Select all

load "1.xys";
script 2 ("1.xys"):

Code: Select all

 $curpath = <curpath>;
 $curitem_ = "1.txt";
 $name_new = "3.txt";
 $path_name_new = $curpath . "\" . $name_new;

 renameitem($name_new,$curitem_);
 setting "BackgroundFileOps", 0;
 selectitems $path_name_new; // path and the new file name inside : $curpath_."\".$name_new
 #178;
One of my scripts helped you out? Please donate via Paypal

zakhar
Posts: 171
Joined: 08 Sep 2010 21:13

Re: Opening Floating Preview

Post by zakhar »

highend wrote: 08 Mar 2025 16:25 No clue what you're doing, but using this works fine, "3.txt" will be previewed:...
I am trying to open the Floating Preview, as I mentioned it in my first post here.

highend
Posts: 14553
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Opening Floating Preview

Post by highend »

Yeah, without showing the full script so everyone needs to guess how the shown variables are filled^^
One of my scripts helped you out? Please donate via Paypal

zakhar
Posts: 171
Joined: 08 Sep 2010 21:13

Re: Opening Floating Preview

Post by zakhar »

highend wrote: 08 Mar 2025 16:58 Yeah, without showing the full script so everyone needs to guess how the shown variables are filled^^
This is my script, mentioned here as the 2. script:

Code: Select all

 $ext_____ = "png";
 $searchpn = "*.$ext_____"; // search pattern
 $curitem_ = <curitem>;
 $curpath_ = <curpath>;
 $qs______ = "";
 $qs______ = quicksearch("$searchpn /fn",$curpath_);
 $qs___cnt = gettoken($qs______,"count",<crlf>);
 $curitemn = gettoken($curitem_,-1,"\"); // "current item name"
 $curitm_i = gettokenindex($curitem_,$qs______,<crlf>); // current item index
 $ftonamef = $curitm_i - 1; // index of the "file to obtain name from" (previous file)
 while(1==1){
    $pfnmwp__ = gettoken($qs______,$ftonamef,<crlf>); // "previous file name with path"
    $pfnm____ = gettoken($pfnmwp__,-1,"\"); // "previous file name"
    $str_t_rs = substr($pfnm____,0,19); // "string to replace"
    if(strpos($str_t_rs,".",0)!=4 or strpos($str_t_rs,".",4)!=4 or strpos($str_t_rs,".",7)!=7){$ftonamef--;}
    else {break;}
    if($ftonamef < 1){
        echo "There are no *.$ext_____-file with the appropriate file name format!<crlf 2>Script ends.";
        end 1==1;
    }
 }
 $date_act = <datem yyyy.mm.dd-ddd-hh.nn>;
 $name_new = replace($pfnm____,$str_t_rs,$date_act);
 renameitem($name_new,$curitem_);
 // $item_t_o = $curpath_."\".$name_new;
 // setting "BackgroundFileOps",0;
 // selectitems $item_t_o;
 #178;

highend
Posts: 14553
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Opening Floating Preview

Post by highend »

Can't reproduce...

Get e.g. https://docs.microsoft.com/en-us/sysint ... /debugview

and use sysdebug statements in your code to print the content of your variables...
Animation.gif
Animation.gif (310.57 KiB) Viewed 1339 times
One of my scripts helped you out? Please donate via Paypal

zakhar
Posts: 171
Joined: 08 Sep 2010 21:13

Re: Opening Floating Preview

Post by zakhar »

highend wrote: 08 Mar 2025 18:22 Can't reproduce...
I think there is nothing to search for here using the tool mentioned in your post of 08 Mar 2025 18:22,
because the 2. script itself, as this is mentioned in my first post here, works ok and opens the Floating Preview
if it is called directly, whithout the 1. script.
I can only suppose that something is wrong in the cooperation between the 1. and the 2. script,
something like the 1. script (even if it must only end) interacts with the 2. script,
that opens the Floating Preview, and closes the Floating Preview before I can even notice this process visually.
I suppose there may be more technical details behind this in the XYplorer engine, driving the scripts.

highend
Posts: 14553
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Opening Floating Preview

Post by highend »

It doesn't matter if I run that script directly or from a different script, the preview is shown for the renamed file^^
does not work: the result is the aforementioned red message in the right corner "item not found".
I've said what I'd do, you don't have to do anything. I'm out though
One of my scripts helped you out? Please donate via Paypal

zakhar
Posts: 171
Joined: 08 Sep 2010 21:13

Re: Opening Floating Preview

Post by zakhar »

highend wrote: 08 Mar 2025 19:14 ...
Trying to find a solution I have experimented a little bit more:
I inserted the 2. script into the script file, where the 1. script is and found
that the 2. script does not open the Floating Preview from there.
So I can only say, that the Floating Preview only opens if it is called by
the 2. script, which itself is called by pressing a toolbar button...

Thank you for your attention.

zakhar
Posts: 171
Joined: 08 Sep 2010 21:13

Re: Opening Floating Preview

Post by zakhar »

Today I have found the solution for this problem:
In the end of the 2. script I only replace

Code: Select all

 renameitem($name_new,$curitem_);
 #178;
with

Code: Select all

 #178;
 renameitem($name_new,$curitem_);
.

Post Reply