Script Request - File Selector

Discuss and share scripts and script files...
PeterH
Posts: 2785
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Script Request - File Selector

Post by PeterH »

Stefan wrote:500
Congratulations :D

Though it's history in the meantime :D :roll: :D

And I must say: really helpful! Even for someone like me - just getting some ideas from your codings!

So keep up your good work:
Danke!

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Script Request - File Selector

Post by Stefan »

Thanks Peter!

SkyFrontier wrote:@Stefan:
1) Yeah, I tested one OR another. Post both for a matter of being concise.
OH, i had an coma to less, sorry. :lol:
SkyFrontier wrote: 2) A message box would be nice (if it bothers me in real usage, I guess I can disable it easier than enabling it from a non-message box script).
3) Yes, ideally this must work for any number of files' addresses, no matter what input their nature is: URLs or local paths, mixed up or not.
Check this out:

Code: Select all

sel; //Deselect all.

    $Source = inputselect("Input from: (select only one)", "+File|Clipboard",,2);

    IF    ($Source=="File")      { $Source = readfile("e:\Temp\a.txt");}
    elseif($Source=="Clipboard") { $Source = "<clipboard>";}
    else                         { msg "only one selection please."; end(1);}

    $Loop = 1;
    while(1)
    {
    $Line = gettoken($Source, $Loop, "<crlf>");
    IF ($Line == "") {break;}
    
      IF (strpos($Line,"\") == -1)
      {
      $Item = regexreplace($Line,".+/(.+)","$1");
      }else{
      $Item = regexreplace($Line,".+\\(.+)","$1");
      }
    
    selfilter """$Item""",,,1;
    incr $Loop;
    }


SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - File Selector

Post by SkyFrontier »

Works!
Need to do some testing.
Noticed the following:

-can both tick boxes be EMPTY by default?
-if only one file is a target, it's not selected and ready to go - it's only highlighted. Can this be improved?
Will report later on any other issues.
Thank you very much!

EDIT
: doesn't worked with:

Code: Select all

http://download.microsoft.com/download/2/1/8/218C926D-9400-43D6-9E81-E236AD9ED2A5/MicrosoftFixit50450.msi
http://download.microsoft.com/download/B/C/7/BC767024-747D-417A-BFCF-3C0806826140/MicrosoftFixit50154.msi
http://download.microsoft.com/download/D/1/8/D1893A85-9299-4372-9B51-DAACE77CEDEE/MicrosoftFixit50416.msi
Micro$oft's curse? :wink:
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - File Selector

Post by SkyFrontier »

One other thing:
If it's set to read FILE, it could ask for the path file to be read.
*even if the file is there (hardcoded under "e:\temp\a.txt"), step check pops up and blinks an error!* (Tested with links pointing to the .msi files above mentioned...)

Edit: It's more useful for what I have in mind if it correctly translates the URL files than the local paths... Ideally, one input or another, all mixed up regardless any number of each.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - File Selector

Post by SkyFrontier »

:mrgreen: Mom, I'm scripting! :mrgreen:
Managed to have default option UNchecked... lol

Code: Select all

$Source = inputselect("Input from: (select only one)", "File|Clipboard",,2);
>Removed the "+" from the section *"File|Clipboard"*
Last edited by SkyFrontier on 27 Jul 2010 01:51, edited 1 time in total.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - File Selector

Post by SkyFrontier »

Took a time to realize what was going on...
FlashGet was told to auto-rename files after completion, so original URLs were not matching existing files on list. That was the problem.
Also, step check pops up only if there is no matching files among list/a.txt. Some better error checking could be done, but I can deal with that as it is (ignoring a.txt and using only the clipboard option.
Even the "highlighted only" problem has gone...
Mixing URLs/local paths as input doesn't affect anything.
Double/mixed entries are ignored.
Works like a charm.

Many thanks!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - File Selector

Post by SkyFrontier »

Clipboard-driven version of the same (plus FOCUS command to avoid getting highlighted-not-selected file(s); also added a little function to paste the selected files' names into clipboard:

Code: Select all

sel; //Deselect all.

    focus;

    $Source = <clipboard>;

    $Loop = 1;
    while(1)
    {
    $Line = gettoken($Source, $Loop, "<crlf>");
    IF ($Line == "") {break;}
   
      IF (strpos($Line,"\") == -1)
      {
      $Item = regexreplace($Line,".+/(.+)","$1");
      }else{
      $Item = regexreplace($Line,".+\\(.+)","$1");
      }
   
    selfilter """$Item""",,,1;
    incr $Loop;
    }
    #102;
Mom, I'm a happy monkey! :mrgreen:
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Script Request - File Selector

Post by SkyFrontier »

Can the original code have a 3rd option for user input, so it can be appended to option 2 - clipboard? (of course, both tick boxes could be allowed to be marked...)
It could also allow more than one option to append, like:

Code: Select all

[ ] User selected entry >>> art;music;*.jpeg
A section to disable this and enable ONLY THIS last option would be nice, in terms of the second code (no-GUI) being used instead of the first.
So attached to a CKS, it could just (invisibly read the clipboard) and pop-up an input box asking for which else should be selected. "Ok" and voilá - additional files selected, among the originals from clipboard!
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Post Reply