Page 2 of 2

Re: Toggle floating preview script help

Posted: 06 Jul 2017 11:28
by fogg
Thank you everyone!!
SammaySarkar wrote:Well,
fogg wrote:select one file and floating preview and open this file in notepad.
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? :eh:
Actually script is not full complete. I am wanting to view 1 png and open 1 txt in other folder. I have some scans page in png, and putting texts in same names txt files.

As example i have scan png such as 0001.png,0002.png,0003.png,0004.png.....0056.png etc... in one folder E:\doc-x43\scan\ and i have 0001.txt,0002.txt,0003.txt,0004.txt etc... in other folder E:\doc-x43\text\. I want script opens 0001.png in floting preview and opens 0001.txt in notepad and as same again 0002.png and 0002.txt etc.

I try adjust your helping script like here

Code: Select all

  $ITEMS = listpane(, "*.png", 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.
    
    $TEXT = replace($ITEM, "png", "txt");
    run "notepad ""$TEXT""",,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

How to script now? Please help? opening same names txt in notepad? :cry:

Re: Toggle floating preview script help

Posted: 06 Jul 2017 11:39
by highend

Code: Select all

$TEXT = replace(replace($ITEM, "png", "txt"), "\scan", "\text");

Re: Toggle floating preview script help

Posted: 06 Jul 2017 11:56
by fogg

Code: Select all

  $ITEMS = listpane(, "*.png", 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.
   
    $TEXT = replace(replace($ITEM, "png", "txt"), "\scan", "\text");
    run "notepad ""$TEXT""",,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

THANK YOU SO MUCH!!! :appl: :appl: :appl: :appl:
script works in other doc scan folders also!!! :biggrin: :biggrin: :biggrin:

Re: Toggle floating preview script help

Posted: 06 Jul 2017 11:58
by bdeshi
I feel this make it more foolproof. 8)

Code: Select all

    $TEXT = regexreplace(<curpath>, '\\scan$', '\text').'\'.gpc($ITEM,'base').'.txt';
I mean what if fog's scanned projects are moved to a dedicated E:\scan\ (or similar) folder.

Also, @fogg I really hope you used OCR to generate the txts... :maf:

Re: Toggle floating preview script help

Posted: 07 Jul 2017 14:58
by fogg
Hello, what is pattern for includeing *.jpg scans for floating preview?

Re: Toggle floating preview script help

Posted: 07 Jul 2017 15:10
by highend
Replace

Code: Select all

$ITEMS = listpane(, "*.png", 1);
with

Code: Select all

$ITEMS = quicksearch("/nf /types=png;jpg", , "|");
but ofc you need to edit your
$TEXT
stuff as well, depending on the extension...

Re: Toggle floating preview script help

Posted: 07 Jul 2017 17:48
by fogg
Thank you!!! My script is now like this -
It's works beautifully!!!

Code: Select all

  $ITEMS = quicksearch("/nf /types=png;jpg", , "|");
  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.
   
    $TEXT = replace(replacelist($ITEM, "png,jpg", "txt,txt", ","), "\scan", "\text");
    run "notepad ""$TEXT""",,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