Hi,
I never did a XYplorer script before and from the docs I was unsure how to approach this:
I have a folder full of .jpg files and one file called default.jpg.pnt.
What I need to do is, for each .jpg file in the current folder, I need to create a copy of the default.jpg.pnt but with the name of the .jpg files instead of the "default".
So
filename.jpg will duplicate the default.jpg.pnt file as filename.jpg.pnt
otherfile.jpg will duplicate the default.jpg.pnt file as otherfile.jpg.pnt
and so on...
My idea is, that I have some kind of list of all the .jpg files in the folder as an array and then copy the default.jpg.pnt file for each .jpg file replacing the first part of the name with the name from the array.
If anybody has some pointers for me how to do this, I'd be thankful. In the meantime I'll try how far I can get on my own...
Thanks and cheers,
Tom
Rather special file copy question...
-
- Posts: 39
- Joined: 21 Dec 2016 15:08
- Contact:
Rather special file copy question...
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." - Rumi
ScreenDream|Thomas Helzle Mastodon
ScreenDream|Thomas Helzle Mastodon
-
- Posts: 39
- Joined: 21 Dec 2016 15:08
- Contact:
Re: Rather special file copy question...
Okay so in theory I figured it out:
But in practice nothing happens, although I can see with Try Script that all the right things seem to happen internally.
Am I missing something basic here?
Thanks for any pointers!
Tom
$folder = inputfolder(, "Select Input Folder"); $itemlist = listfolder($folder, ".jpg", 1 + 4); foreach($image, $itemlist) { copyitem "$folder\default.jpg.pnt" "$folder\$image.pnt"; }
But in practice nothing happens, although I can see with Try Script that all the right things seem to happen internally.
Am I missing something basic here?
Thanks for any pointers!
Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." - Rumi
ScreenDream|Thomas Helzle Mastodon
ScreenDream|Thomas Helzle Mastodon
-
- Posts: 39
- Joined: 21 Dec 2016 15:08
- Contact:
Re: Rather special file copy question...
Weird, when I use "new" instead of "copyitem" it works...
So my script now looks like:
$folder = inputfolder(, "Select Input Folder");
$itemlist = listfolder($folder, ".jpg", 1 + 4);
foreach($image, $itemlist) {
new("$folder\$image.pnt", , "$folder\default.jpg.pnt");
}
Not really that intuitive but works for my needs now.
Cheers,
Tom
So my script now looks like:
$folder = inputfolder(, "Select Input Folder");
$itemlist = listfolder($folder, ".jpg", 1 + 4);
foreach($image, $itemlist) {
new("$folder\$image.pnt", , "$folder\default.jpg.pnt");
}
Not really that intuitive but works for my needs now.
Cheers,
Tom
"Out beyond the ideas of wrongdoing and rightdoing, there is a field. I’ll meet you there." - Rumi
ScreenDream|Thomas Helzle Mastodon
ScreenDream|Thomas Helzle Mastodon