I had the same issue before you updated again. But the script won't install, says "Failed methods."
It won't work if you add it through the scripts window, it needs to be added via the command editor for a User Command or on a button. Like this:
The reason is that I believe scripts installed via the scripts window need some additional things to define the commands or columns or whatever is being added. But in this case we just directly add the command script as its own thing.
I'll add a little section in the original post with instructions.
I don't want to bother you, as I could fix it myself with some help of AI, but this row seems to be throwing an error:
var baseNameRegex = new RegExp('^(.+)' + backupExtension.replace('.', '\.') + '(\d*)$');
These are the errors in the output:
5/27/2024 Mon 17:50 Main process started.
5/27/2024 Mon 17:50 Error at line 60, position 4 (raw line 64)
5/27/2024 Mon 17:50 'selectedItem' is undefined (0x800a1391)
7/2/2024 Tue 9:26 Main process started.
7/2/2024 Tue 14:37 Error at line 68, position 97 (raw line 80)
7/2/2024 Tue 14:37 ...eplace('.', '\\.') + '(\\d*));
7/2/2024 Tue 14:37 ^
7/2/2024 Tue 14:37 Unterminated string constant (0x800a03f7)
7/2/2024 Tue 14:37 Parse error - script aborted
7/2/2024 Tue 18:32 Error at line 68, position 97 (raw line 80)
7/2/2024 Tue 18:32 ...eplace('.', '\\.') + '(\\d*));
7/2/2024 Tue 18:32 ^
7/2/2024 Tue 18:32 Unterminated string constant (0x800a03f7)
7/2/2024 Tue 18:32 Parse error - script aborted
7/2/2024 Tue 18:39 004 Opus bak Files ThioJoe 5-21-2024 ORG.js: Script does not implement any known events and was unloaded
7/2/2024 Tue 18:40 Error at line 1, position 10 (raw line 3)
7/2/2024 Tue 18:40 Make_bak RESTORE BACKUP_EXTENSION=".bak"
7/2/2024 Tue 18:40 ^
7/2/2024 Tue 18:40 Expected ';' (0x800a03ec)
7/2/2024 Tue 18:40 Parse error - script aborted
7/2/2024 Tue 18:40 004 Opus bak Files ThioJoe 5-21-2024 ORG.js: Script does not implement any known events and was unloaded
7/2/2024 Tue 18:41 004 Opus bak Files ThioJoe 5-21-2024 ORG.js: Script does not implement any known events and was unloaded
7/2/2024 Tue 18:43 004 Opus bak Files ThioJoe 7-2-2024 ORG.js: Script does not implement any known events and was unloaded
7/2/2024 Tue 19:51 Error at line 1, position 7 (raw line 2)
7/2/2024 Tue 19:51 @label:KeyDown("shift") ? ".bak (Restore)" : ".bak"
7/2/2024 Tue 19:51 ^
7/2/2024 Tue 19:51 Conditional compilation is turned off (0x800a0406)
7/2/2024 Tue 19:51 Parse error - script aborted
7/2/2024 Tue 19:52 Error at line 1, position 7 (raw line 2)
7/2/2024 Tue 19:52 @label:KeyDown("shift") ? ".bak (Restore)" : ".bak"
7/2/2024 Tue 19:52 ^
7/2/2024 Tue 19:52 Conditional compilation is turned off (0x800a0406)
7/2/2024 Tue 19:52 Parse error - script aborted
7/2/2024 Tue 19:54 Error at line 1, position 7 (raw line 2)
7/2/2024 Tue 19:54 @label:KeyDown("shift") ? ".bak (Restore)" : ".bak"
7/2/2024 Tue 19:54 ^
7/2/2024 Tue 19:54 Conditional compilation is turned off (0x800a0406)
7/2/2024 Tue 19:54 Parse error - script aborted
Looks like you're still using the old version of the script that had the error mentioned in the post before yours.
Why do you think so? I see the dollar sign in the regex of the script. The error message seems to not picking it up, which might be causing the error.
Copilot suggested:
- The script file might not be saved or refreshed: If you're running the script in an environment that caches or compiles scripts, it's possible that an older version of the script (with the error) is being executed. Ensure the script is saved and, if necessary, clear any caches or restart the script execution environment.
Is that possible in Opus? Could it be using a cached version of the older script? Is there a place to clear cache in Opus?
7/2/2024 Tue 14:37 ...eplace('.', '\\.') + '(\\d*));
7/2/2024 Tue 14:37 ^
7/2/2024 Tue 14:37 Unterminated string constant (0x800a03f7)
The error tells you the problem and even shows you where it is
The string is missing its terminating '
character. Should be '(\\d*)');
Copilot suggested
Advice from AI is mostly nonsense and won't help you.
I get it, but I can't fix something that doesn't exist. The regex in the script is not the same as in the error.
Can you show a screenshot of that line in your button? It's just out of view in your screenshot above.
I think part of the problem at least is in that last screenshot you need to remove this line:
@script Jscript
I tried adding it like you have there and it generated similar errors.
I believe that tells Opus to treat everything in the box as Jscript, which it's not. Even though the User Command is JScript, it's isolated to its own context.
Worked! Backup and restore both work great. Thanks, Joe! Love your videos, by the way!
ok, works now.
Forgot the argument template.
But is it correct, that the bak is kept after restoring?
In the script is mentioned rename, but it makes a copy with new/original name if I see it correct.
Yea it keeps the bak after restoring, the mention of 'rename' is just a mistake - it actually copies.