Here ...
Windows Batch-File to JScript - #2 by lxp - Help & Support - Directory Opus Resource Centre
... @lxp gave me the start of my current button, which now deals not only with the actors, but also with the rest of the crew (director, writer...) (The button helps me to easily move info files into their respective folders.)
<function type="normal">
<instruction>Copy FILE=/down\*.jpg TO=/pix-pers</instruction>
<instruction>Copy FILE=/down\*.md TO=/actor</instruction>
<instruction />
<instruction>Copy MOVE FILE=/down\*.jpg TO=/preTrash</instruction>
<instruction>Copy MOVE FILE=/down\*.md TO=/preTrash</instruction>
</function>
The basic function is
- Copy images from "/down" (download folder, alias) to
"/pix-pers" (image folder, alias)
This action is the same for all cast and crew. The images will end up in one image folder.
- Copy "*.md" files from "/down" (download folder, alias) to
"actors" (actors folder, alias)
This action moves *.md
files to their respective folders, so it's a copy to different targets (actor, director, writer ...).
- Make a temporary backup of all files in "/preTrash
This action moves the files to a temporary folder called "/preTrash", so they're still there until I delete "/preTrash" manually.
In the button step #3 is repeated verbatim for
- actor
- director
- writer
- camera
- composer
- producer
- other
```
Copy MOVE FILE=/down\*.jpg TO=/preTrash
Copy MOVE FILE=/down\*.md TO=/preTrash
```
What I want to do is put these 2 lines into a function and replace them in their respective (sub)buttons with a function call:
allTempFolder()
So the function might look like this:
function allTempFolder() {
Copy MOVE FILE=/down\*.jpg TO=/preTrash
Copy MOVE FILE=/down\*.md TO=/preTrash
return
}
(I have attended a 3,5 hours online course on JavaScript. That's it)
I have not the foggiest idea how to do this...Please help
Here is the code for the complete button. Via copypaste I expanded it 6 times and exchanged the actual folder paths with aliases.
<?xml version="1.0"?>
<button backcol="none" display="icon" label_pos="right" textcol="none" type="menu_button">
<label>Cast && Crew</label>
<tip>Moving info files to appropriate folder | keeping a copy in preTrash</tip>
<icon1>/button\nobody 02.jpg,0</icon1>
<icon2>/button\nobody 02 - inverted.jpg,0</icon2>
<function type="normal">
<instruction>Copy FILE=/down\*.jpg TO=/pix-pers</instruction>
<instruction>Copy FILE=/down\*.md TO=/actor</instruction>
<instruction />
<instruction>Copy MOVE FILE=/down\*.jpg TO=/preTrash</instruction>
<instruction>Copy MOVE FILE=/down\*.md TO=/preTrash</instruction>
</function>
<button backcol="none" display="both" label_pos="right" textcol="none">
<label>Director</label>
<tip>Create New Director</tip>
<icon1>/button\director.png,0</icon1>
<function type="normal">
<instruction>Copy FILE=/down\*.jpg TO=/pix-pers</instruction>
<instruction>Copy FILE=/down\*.md TO=/director</instruction>
<instruction />
<instruction>Copy MOVE FILE=/down\*.jpg TO=/preTrash</instruction>
<instruction>Copy MOVE FILE=/down\*.md TO=/preTrash</instruction>
</function>
</button>
<button backcol="none" display="both" label_pos="right" textcol="none">
<label>Writer</label>
<tip>Create New Writer</tip>
<icon1>/button\writer.png,0</icon1>
<function type="normal">
<instruction>Copy FILE=/down\*.jpg TO=/pix-pers</instruction>
<instruction>Copy FILE=/down\*.md TO=/writer</instruction>
<instruction />
<instruction>Copy MOVE FILE=/down\*.jpg TO=/preTrash</instruction>
<instruction>Copy MOVE FILE=/down\*.md TO=/preTrash</instruction>
</function>
</button>
<button backcol="none" display="both" label_pos="right" textcol="none">
<label>Camera</label>
<tip>New Camera</tip>
<icon1>/button\cinematographer.png,0</icon1>
<function type="normal">
<instruction>Copy FILE=/down\*.jpg TO=/pix-pers</instruction>
<instruction>Copy FILE=/down\*.md TO=/camera</instruction>
<instruction />
<instruction>Copy MOVE FILE=/down\*.jpg TO=/preTrash</instruction>
<instruction>Copy MOVE FILE=/down\*.md TO=/preTrash</instruction>
</function>
</button>
<button backcol="none" display="both" label_pos="right" textcol="none">
<label>Composer</label>
<tip>Create New Composer</tip>
<icon1>/button\composer j.jpg,0</icon1>
<function type="normal">
<instruction>Copy FILE=/down\*.jpg TO=/pix-pers</instruction>
<instruction>Copy FILE=/down\*.md TO=/music</instruction>
<instruction />
<instruction>Copy MOVE FILE=/down\*.jpg TO=/preTrash</instruction>
<instruction>Copy MOVE FILE=/down\*.md TO=/preTrash</instruction>
</function>
</button>
<button backcol="none" display="both" label_pos="right" textcol="none">
<label>Producer</label>
<tip>New Producer</tip>
<icon1>/button\producer.png,0</icon1>
<function type="normal">
<instruction>Copy FILE=/down\*.jpg TO=/pix-pers</instruction>
<instruction>Copy FILE=/down\*.md TO=/producer</instruction>
<instruction />
<instruction>Copy MOVE FILE=/down\*.jpg TO=/preTrash</instruction>
<instruction>Copy MOVE FILE=/down\*.md TO=/preTrash</instruction>
</function>
</button>
<button backcol="none" display="both" label_pos="right" textcol="none">
<label>Other</label>
<tip>New Other</tip>
<icon1>/button\000.png,0</icon1>
<function type="normal">
<instruction>Copy FILE=/down\*.jpg TO=/pix-pers</instruction>
<instruction>Copy FILE=/down\*.md TO=/other</instruction>
<instruction />
<instruction>Copy MOVE FILE=/down\*.jpg TO=/preTrash</instruction>
<instruction>Copy MOVE FILE=/down\*.md TO=/preTrash</instruction>
</function>
</button>
</button>