Page 1 of 1
merge files in order
Posted: 02 Feb 2012 09:00
by Stretto
I'm new to XYplorer but it seems it has some very good scripting capabilities. I have written a vbs script which allows me to merge(copy /b) files through the command line. Is it possible or do there exists scripts to do this in XYplorer but do it through mouse selection *in order of selection*?
Re: merge files in order
Posted: 02 Feb 2012 10:55
by Twisten
Try looking up the readfile() function/script-command, I think the short answer is: yes, it can be done.
Re: merge files in order
Posted: 02 Feb 2012 13:09
by Stretto
reading the files are not the issue... it's getting the files, in order, that were selected with the mouse. I'd like to select the files I want to process in the a specific order and have them passed to the script in that same order.
Re: merge files in order
Posted: 02 Feb 2012 13:37
by nas8e9
Stretto wrote:reading the files are not the issue... it's getting the files, in order, that were selected with the mouse. I'd like to select the files I want to process in the a specific order and have them passed to the script in that same order.
I don't think that's possible directly, but as a workaround you could enable Tools > Customize List > Manual Sorting, order the List the way you want and then have a script take the manually sorted list as input, optionally resetting the view after completion.
Re: merge files in order
Posted: 02 Feb 2012 14:04
by highend
nas8e9 is right, that would be the only solution atm.
Re: merge files in order
Posted: 02 Feb 2012 14:07
by admin
One could also collect the files one by one in a permanent variable (using a script), and then process it (using another script). That would also allow to merge files in different locations.
Re: merge files in order
Posted: 02 Feb 2012 15:02
by Stefan
I would use an "User-Defined Command" (UDC)
For an how-to see
How to execute a script ? (click) Scroll down to > A > 3.) Use User-Defined Commands (UDC)
Script to use:
Code: Select all
perm $pLCount; perm $pListArray; $pListArray = $pListArray . quote("<curitem>") . " + ";
$pLCount++; status "Added No. $pLCount: <curitem>";
Assign an keyboard shortcut to that command.
Now select an file and press your shortcut to collect that file to the array. Do this file after file.
To see what you have collected so far use this command in the XYplorer address bar:
::text $pListArray;
Example output:
"X:\xyplorer\XYcopy.exe" + "X:\xyplorer\XYplorer.chm" + "X:\xyplorer\XYplorer.exe" + "X:\xyplorer\XYplorer.url" +
(see XYplorer help "\ advanced \ variables" for parameter to collect the file name only)
To clear the array use:
::perm $pListArray; perm $pLCount;
Of course we can also concatenate the files for you too ;-)
Re: merge files in order
Posted: 02 Feb 2012 15:22
by TheQwerty
I'd also suggest checking out
Don's Item Store snippet, which creates a new toolbar button that allows you to add items to a permanent variable.
This could then be iterated over to merge the files.
Re: merge files in order
Posted: 02 Feb 2012 16:12
by Stretto
Ok, I'll work on it. Going to put in a request for mouse action though...
Re: merge files in order
Posted: 02 Feb 2012 16:32
by TheQwerty
Stretto wrote:Ok, I'll work on it. Going to put in a request for mouse action though...
There really isn't a need for a separate request, as Don typically reads everything.
Such an action will likely be part of Custom Event Actions (CEA) which is on the roadmap.
Re: merge files in order
Posted: 02 Feb 2012 17:17
by Stretto
Ok, Sky Frontier PM'ed me with some script code that worked with some modification for my needs, but after modifying it more then code no longer works:
Code: Select all
foreach($file, <get selecteditemspathnames |>)
{
end(getinfo("CountSelected") < 1), "No file matching was found.<crlf>Script will now shut.";
$rep = Report("*NAME*: {Name} - Mod/created dates: M- {modified}, C- {created} - Size: {size bb}, size flex: {size flex}", $file);
$a = readfile("$file");
writeFile("__MergedFile.mpg", $a, "a", "b");
}
status "Merging done!";
The original code displayed a box to select the way to merge which I removed and was for text which I converted to binary. With his code and the slight modifications I could select the files I wanted to merge then run the script, an input box would appear and I would hit 2 for "selected files", and it would merge them(not sure if the order was correct or not.
With this code(which I simply deleted the input box code and extension filter), it displays the code at the lower bottom of the screen where I can select a line but doesn't do anything. Not sure if that means it's a bug or what.
So whats stopping this code from working? and where does the status messages go? I would like to print "Merged file1 + file2 + file3 + ...." somewhere.
This seems to be really close to what I was looking for in the first place.
Re: merge files in order
Posted: 02 Feb 2012 17:59
by highend
not sure if the order was correct or not
It wasn't. The report takes the files in alphabetical order.
So whats stopping this code from working? and where does the status messages go?
The code itself is working. Just merged a few files with it. The status message is... in the status bar in the lower
right corner of your XYplorer.
Unbenannt.png