merge files in order
-
Stretto
- Posts: 108
- Joined: 30 Jan 2012 06:43
merge files in order
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*?
-
Twisten
- Posts: 204
- Joined: 27 Apr 2008 10:30
Re: merge files in order
Try looking up the readfile() function/script-command, I think the short answer is: yes, it can be done.
-
Stretto
- Posts: 108
- Joined: 30 Jan 2012 06:43
Re: merge files in order
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.
-
nas8e9
- Posts: 2232
- Joined: 21 Jun 2008 14:50
Re: merge files in 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.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.
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: merge files in order
nas8e9 is right, that would be the only solution atm.
One of my scripts helped you out? Please donate via Paypal
-
admin
- Site Admin
- Posts: 66252
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: merge files in order
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.
FAQ | XY News RSS | XY X
-
Stefan
- Posts: 1360
- Joined: 18 Nov 2008 21:47
- Location: Europe
Re: merge files in order
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:
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:
To clear the array use:
::perm $pListArray; perm $pLCount;
Of course we can also concatenate the files for you too ;-)
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>"; 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:
(see XYplorer help "\ advanced \ variables" for parameter to collect the file name only)"X:\xyplorer\XYcopy.exe" + "X:\xyplorer\XYplorer.chm" + "X:\xyplorer\XYplorer.exe" + "X:\xyplorer\XYplorer.url" +
To clear the array use:
::perm $pListArray; perm $pLCount;
Of course we can also concatenate the files for you too ;-)
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: merge files in order
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.
This could then be iterated over to merge the files.
-
Stretto
- Posts: 108
- Joined: 30 Jan 2012 06:43
Re: merge files in order
Ok, I'll work on it. Going to put in a request for mouse action though...
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: merge files in order
There really isn't a need for a separate request, as Don typically reads everything.Stretto wrote:Ok, I'll work on it. Going to put in a request for mouse action though...
Such an action will likely be part of Custom Event Actions (CEA) which is on the roadmap.
-
Stretto
- Posts: 108
- Joined: 30 Jan 2012 06:43
Re: merge files in order
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:
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.
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!";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.
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: merge files in order
It wasn't. The report takes the files in alphabetical order.not sure if the order was correct or not
The code itself is working. Just merged a few files with it. The status message is... in the status bar in the lowerSo whats stopping this code from working? and where does the status messages go?
right corner of your XYplorer.
To see the attached files, you need to log into the forum.
One of my scripts helped you out? Please donate via Paypal
XYplorer Beta Club