Page 1 of 1
Create empty copy
Posted: 17 Aug 2015 21:32
by admin
Just a quickie that I happened to need a lot recently. I creates an empty copy of the currently selected item in the same location, and with a similar name:
Code: Select all
// create empty copy of current item
if (exists(<curitem>) == 2) {
new("<curname>", "dir", , "r");
} else {
new("<curname>", "file", , "r");
}
PS: hmmm, looking at that code now I think we could use a variable <curtype> to return drive, folder/dir, or file.

Re: Create empty copy
Posted: 05 Mar 2017 04:58
by Theo
This appears to be exactly what I'm looking for, but I get the following error when using it...
Code: Select all
1 C:\Program Files (x86)\XYplorer v15\Data\Scripts\create_empty_file.xys
Overflow
1 0 / 0
I copied the script to a text file and gave it an
xys extension. I then put it in the
Scripts folder. I made a Custom Toolbar Button with
C:\Program Files (x86)\XYplorer v15\Data\Scripts\create_empty_file.xys in the
On left click: line.
Am I missing something?
Re: Create empty copy
Posted: 05 Mar 2017 09:43
by admin
The "On left click:" expects a script, not the path of a script file.
Either
- paste the script directly into the field (use the Edit... button right of the field)
Or
- load your script file by pasting this into the field:
Code: Select all
load "C:\Program Files (x86)\XYplorer v15\Data\Scripts\create_empty_file.xys";
Re: Create empty copy
Posted: 05 Mar 2017 20:27
by Theo
Thank you for the quick reply. I actually figured it out on my own after quite a few hours of reading the help file and learning many other things about XYplorer that I didn't know it could do. I wish I could have deleted my post to save you the time replying to me. Sorry about that.
I also found a much easier way to do what I needed to do...
It was THAT simple!
My entry on the Left click portion of the button...
I really love the scripting capability of XYplorer and plan to learn and do more with it now that I found the list of commands and how to use them LOL.
I have another question related to my use of the script, but I'll open a new topic since it's not related to this one.
Thanks again, for the help.
Re: Create empty copy
Posted: 06 Mar 2017 07:48
by admin
Well, this drops the extension, and it does not work for folders, right? But if you are happy with it, okay.
And welcome to the club!
Don
Re: Create empty copy
Posted: 06 Mar 2017 16:57
by Theo
I haven't tried it with folders - I only need it for files.
Thanks for all the help. This forum is one of the most helpful I have seen anywhere, and quick to reply also. Another thing I like is that you, the developer, is involved. Try using the Logitech and Kaspersky (to some extent) forums for help. Company people are nowhere to be found. I know a lot of users are very knowledgeable, but it's a plus to see the developer involved too. You truly earn and deserve the money to make.