Toggle floating preview script help
Toggle floating preview script help
Hello! I am running the floating preview in my script but floating preview closes after each one time!
My script is select one file and floating preview and open this file in notepad. And again select the next file when I exit the notepad.
My script is select one file and floating preview and open this file in notepad. And again select the next file when I exit the notepad.
s404:signature not found.
Re: scripting floating preview bug
How are you running floating preview in your script?
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: scripting floating preview bug
It is my script
I run script with Menu >Script >Run Script
Code: Select all
$NUMBER = 56;
$LOOP = 0;
while($LOOP < $NUMBER){
$LOOP++;
sel $LOOP;
#178; // it is floating preview code at help | list all commands
run "notepad <curitem>",,1,1;
}s404:signature not found.
Re: scripting floating preview bug
This is no bug. It toggles fp on / off.
Regarding your script and to handle it correctly:
You can get the state of fp with
0 = FP not active
1 = FP active
So you only need to execute it on the first item
and execute it again after the loop is done
I've moved the topic...
Regarding your script and to handle it correctly:
You can get the state of fp with
Code: Select all
$state = get("#178");1 = FP active
So you only need to execute it on the first item
and execute it again after the loop is done
I've moved the topic...
One of my scripts helped you out? Please donate via Paypal
Re: Toggle floating preview script help
Thankyou!!!
Now it is my script. All ok!
Now it is my script. All ok!
Code: Select all
$state = get("#178");
if($state==1){ #178; // it is floating preview code at help | list all commands}
$NUMBER = 56;
$LOOP = 0;
while($LOOP < $NUMBER){
$LOOP++;
sel $LOOP;
run "notepad <curitem>",,1,1;
}
$state = get("#178");
if($state==1){ #178; // it is floating preview code at help | list all commands}s404:signature not found.
Re: Toggle floating preview script help
1.) You've commented out an important bit: the } at the end of the if clause.
Code: Select all
$state = get("#178");
if($state==1){ #178; // it is floating preview code at help | list all commands}So, all in all, use this instead:
Code: Select all
$state = get("#178"); // get FP status. 1 is open, 0 is closed
if ($state==0) { // $state==0 means floating preview is NOT active.
#178; // #178 opens it in that case.
}
$NUMBER = 56;
$LOOP = 0;
while ($LOOP < $NUMBER) {
$LOOP++;
sel $LOOP;
run "notepad <curitem>",,1,1;
}
#178; // since FP is sure to be open at this point, this will toggle it off.got me mildly panicking a bit there! I was typing a response and submitted only to get ~"the topic does not exist".fogg wrote:I've moved the topic...
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: Toggle floating preview script help
Thank you too!!!
This script also work. I use your script now.
BUt i didnot move the topic!SammaySarkar wrote: I've moved the topic...
got me mildly panicking a bit there! I was typing a response and submitted only to get ~"the topic does not exist".
s404:signature not found.
Re: Toggle floating preview script help
Also i want help to automactic count number of files? Now I write $NUMBER=56 when 56 files and other number for other files. I wish like this:???
Code: Select all
$NUMBER=count("files");s404:signature not found.
Re: Toggle floating preview script help
Count which files, all existing
or e.g. only txt files?
Code: Select all
$NUMBER = listfolder(, , 1+32);Code: Select all
$NUMBER = listfolder(, "*.txt", 1+32);One of my scripts helped you out? Please donate via Paypal
Re: Toggle floating preview script help
counting items: I believe you are looking for item count to run the while loop on them to select and run in notepad. You'd better use the items' full paths instead of blind list indexes (in case list might have other items besides your to-preview files). Try something like this:This will get a list of all txt files in current list (adjust pattern in listpane() to fit your needs), and loop thru only these files, selecting and opening in notepad.
(Also, I moved the floating preview opening logic after the selection statement, because I discovered the FP won't open if there happens to be no valid selection before the script starts.)
HTH.
--- ---
Code: Select all
$ITEMS = listpane(, "*.txt", 1); // |-separated list of only pdf files in list.
foreach ($ITEM, $ITEMS) { // walk thru each item on the $ITEMS list
selectitems($ITEM, 2); // select $ITEM. unlike sel, selectitems can select by full path
if (get("#178")==0) { #178; } // open FP. get("#178")==0 means floating preview is NOT active. #178 opens it.
run "notepad ""$ITEM""",,1,1; // open notepad. note the doublequotes around $ITEM. the fullpath can have spaces
}
#178; // since FP is sure to be open at this point, this will toggle it off
(Also, I moved the floating preview opening logic after the selection statement, because I discovered the FP won't open if there happens to be no valid selection before the script starts.)
HTH.
--- ---
Sorry I meant to say that to highend.fogg wrote:BUt i didnot move the topic!SammaySarkar wrote: I've moved the topic...
got me mildly panicking a bit there! I was typing a response and submitted only to get ~"the topic does not exist".
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: Toggle floating preview script help
@Sammay
Do you really think he wants to open .pdf files in standard Windows notepad?
Do you really think he wants to open .pdf files in standard Windows notepad?
One of my scripts helped you out? Please donate via Paypal
Re: Toggle floating preview script help
heh!
Ii think I was just copying your post.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: Toggle floating preview script help
It occurred to me that he was probably not attempting to open those files so I changed it a minute later 
One of my scripts helped you out? Please donate via Paypal
Re: Toggle floating preview script help
Well, 
I'm not exactly sure what's the purpose of the script: opening the same file in the FP and notepad? What does this accomplish?fogg wrote:select one file and floating preview and open this file in notepad.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]
[ this user is asleep ]
Re: Toggle floating preview script help
No clue but hey, it's his script...
One of my scripts helped you out? Please donate via Paypal
XYplorer Beta Club