Command: ScriptWizard (multipurpose scripting resources aid)

Introduction:
ScriptWizard is a script addin which helps to keep your other script addins uptodate. It is able to automatically download newer versions if requested and generally helps in up-/downloading, maintaining and writing directory opus script add-ins. Wether you're a script writer or not, I recommend adding this to your dopus installation, as it offers some comfort for everyone.

Features:

  • updating of scripts to latest versions
  • about dialog for scripts with various functions b[/b]
  • script details columns providing update status, version, modified, enabled etc. b[/b]
  • upload wizard to streamline the process of preparing and uploading your scripts
  • visit resource center thread, automatic archiving, renaming/deleting of scripts directly from prefs (if they support ScriptWizard)
  • supports js, vb and and script packages (*.osp files) and an extensive logfile for troubleshooting
  • multilanguage (english and german currently)

QuickStart Menu-Button:
To give you a quick start, here is a menu button featuring nearly all you can do with ScriptWizard.
For parameters, watch the menu buttons. Notice, some of the functions require you to select a script file or package beforehand.

v0.2 / 2015.07.18 - entry to clear the scriptdetails colum cache added:
ScriptWizard_MenuButton.dcf (5.01 KB)


Some icons for the button in small & large. Thanks to wowbagger! o)



Rename the *.dis.zip to *.dis and import from prefs -> toolbars -> icons:
ScriptWizard_MenuButton-Icons.dis.zip (18.2 KB)

Script-Writers notice:
In case you'd like to offer updating of your scripts from within DO by ScriptWizard, make sure to use the "Prepare Upload" functionality on your script. A wizard will appear and aid you to add some required pieces to your script. Scripts are backup-ed automatically. Your uploaded filename should never include the version string, put it in the corresponding file comment textbox instead. SW will insert the correct filename and path to your script into the clipboard automatically. Using that (by just pasting it here) is the fastest and easiest way to upload an add-in.

Configuration:
There have been several script config items added in the meantime, I guess most of them are self-explanatory. If not just ask!

Installation:
To install the add-in, download the *.js.txt file below and drag it to Preferences / Toolbars / Scripts.
To install the button, download the *.dcf file above and drag it to any toolbar while DO is in customize mode.
After that, the add-in (the menu button, the command itself, the columns and the about-dialog) shall be ready to use.

Download:

2 Likes

After draging it to Preferences / Toolbars / Scripts, it is invisible here but exist in /dopusdata\Script AddIns

I added this to the script Column: Lines (number of lines in text files). I found that your regex's doesn't work if the lines in OnInit contains tabs/multiple spaces like this:

data.name        = "Column.File: Lines";

You should add the modifier @runmode:hide to the lines running cmd.exe:

cmd.SetModifier("runmode", "hide");
cmd.RunCommand('cmd /c start '+props.resUrl.replace(/\&/g,"^&"));

hi guys!

@fred
If the script does not show up then it either errored or your dopus version is to low I guess.

@kundal
Yes, yes. Thanks for reporting! o)
I rewrote this from scratch, things like that should be fixed and shiny in the upcoming version, please stay tuned! o)

Another little issue you should fix in function OnAboutScript(data): The dialog also opens the website if Cancel was clicked. It should be if (DOpus.Dlg.Request("...") ==1)

It's done! I overhauled the inital post of this thread completly, please look at it! o)
ScriptWizard replaces the former "ScriptHelper" completly (and will delete it if found), but it is backward compatible.

To get everyone involved as easy as possible, ScriptWizard "knows" all of the major uploads done here, so it can be used right away.
Still, I'd like to encourage everyone to apply necessary tweaks to your next script upload to reach full functionality and reliability.

Wow! Congratulations, I'm really impressed and it seems to work great. :thumbsup:

However, I encountered two little bugs:

  • This only happens with some files when clicking the info button and more than one lister currently opened:
    Command.Generic: ScriptWizard: Fehler in Zeile 139, Position 3
    Command.Generic: ScriptWizard: Das Objekt ist keine Auflistung. (0x800a01c3)

  • The about dialog doesn't show german Umlauts correctly.

I'm currently working on my own scripts Tagger and FullScreenMetaEdit to make them fully support ScriptWizard. It's a bit of work because to make use of the update function I have to get rid of the separate AutoHotkey scripts and make the scripts create them as temporary files instead.

As always :smiley: I have a feature request:

Please add update support for the scripting area of the german forum. I'd really like to offer a german version there, if that's OK for you.

Hallo Kundal! Thanks for giving SW a spin! o)

Can you send me a script, which throws an error and for which SW does not display umlauts correctly by email?
The german forum uses a a very similar software, SW might work right out of the box. Please try that first, if things don't work as expected, I will look into it! o)

A german version is fine for me. o) I'd suggest to not create a german "branch", we should probably use some internal dictionary instead to avoid constantly merging any fixes or enhancements.

The error occurs with ScriptWizard itself and several of your other scripts as well for me (e.g. SetVar = no error, StartHidden = error). It always happens when I have more than one lister open. As soon as I close all but one listers it's working fine again. If I close the last lister having only the preferences window open the error occurs again. The dialog will always open fine when started from the button you provided. Uncommenting line 139 fixes the error but probably makes other problems.

In fact I found that I only had a single script where german Umlauts didn't show correctly. Changing the character encoding from Unicode, UTF-8 to Windows 1252: Western European fixed the issue.

SW is currently not working with the german forum. I tried with the german version of FullSceenMetaEdit. The Visit Forum button is working fine but the Check Version button throws this error:

2014.11.22 07:54:55 Opening url [haage-partner.de/forum/viewtopic.php?f=45&t=4751]
2014.11.22 07:55:06 Check..
2014.11.22 07:55:06 UpdateCheck(): "Command.File_FullscreenMetaEdit.vbs.txt":
2014.11.22 07:55:06 E   Error: Verweis auf eine nicht definierte Entität 'uuml'.
2014.11.22 07:55:06 E       Line#: 118
2014.11.22 07:55:06 E       Line :         <li title="Produkt&uuml;bersicht"><a href="http://www.haage-partner.de/software.html">Software</a></li>
2014.11.22 07:55:06 E   Failure: Resource parsing error - reason [Verweis auf eine nicht definierte Entität 'uuml'.

I expected to get the message Unsupported: No downloads found for script! because the download is a Zip-file.
For some reason SW is searching the wrong site [b]http://www.haage-partner.de/software.html[/b] with title: ProduktĂĽbersicht. Perhaps you only need to modify some regex to match [b]http://www.haage-partner.de/forum/[/b] instead of [b]http://resource.dopus.com/[/b] or something?

That sounds great although I have no idea how this could be done. I'd be glad to assist translating dialogs, column names etc. (I'm gone for some days but next friday I'll be back).

Updated to v0.4.2

  • support for german h&p directory opus forum (was an easy adjustment, but still considered alpha status)
  • full caching of column data (alpha status, do not enable for regular use, cached data won't refresh, but is lightning fast! o)
  • added some default resource center urls for various add-ins

@kundal
With the updated version I get your expected results for the german forum (no downloads/no version in download details).
Which is either because there were *.zip files used or because of no version information is found in the uploaded file comments.

That 139er error you get is obscure.
I just try to get the enumerator for selected files from the sourcetab and wouldn't know why that would fail.
You say it always works when "about" is called from the button, so how do you actually run SW to get the error? Thx! o)

I just updated to v0.4.2 and the file was broken. Encoding was UTF16LE and it contained some invalid characters at lines 1190/1191. When manually downloading the file it was Windows 1252: Western European and working.

Support for the german forum seems to work now. The "Unsupported: No downloads found for script!" message is because it's a *.zip file. I'll test with a valid script file.

The error occurs when clicking the Info button of a script in Preferences=>Toolbars=>Scripts. It possibly doesn't make much sense to enumerate selected files in this case? I couldn't find anything not working when uncommenting the line. However, I don't know if this makes sense for you but changing line 144 to if (files) return { enumerator:new Enumerator(files), count:files.count}; also works fine for me.

Update from the german forum doesn't work. I always get Failure: unique version id mismatch. After deleting the uid from the local file (older version) the update succeded but the downloaded file was UTF16LE containing only some characters this forum refuses to show and PNG.
This happens if the file on the forum is UTF-8. If it's Windows 1252: Western European I get the error Systemfehler: -1072896748 which means that there is an encoding problem.

How should the Update MD5 function work? I expected that the MD5 string shown if Show Details was clicked would be added to the script but it doesn't.

I forgot to provide a link to the script at the german forum that I prepared to work with SW for testing purposes (encoded Windows 1252):
http://www.haage-partner.de/forum/viewtopic.php?f=45&t=4612

Updated to v0.4.3:

  • MD5 hash creation bugfix
  • german forum download bugfix
  • upload prepared files will be automatically converted to unicode (utf16)
  • downloads always treated binary

Sorry Kundal! o)
Any download for a german script-resource was attempted at this site, that's why that PNG file sneaked in for no obvious reason. o)
"Show Details" does not modify a script. For the hash to update, you need to choose "Update MD5 Hash" or use "Prepare Upload" which does that automatically (only if the file was modified). But the last download was faulty in that regard, should be working again.

The "Unique version id mismatch" was caused, because a PNG file does not have that ID.
That UID-safety feature kicked in here, preventing SW from overwriting your pretious script-addin (additionally safety to the backup made).

Thanks for the link and your patience! o)
With that script of yours an update was possible for me now. I hope it works for you too.

Yeah! Everything working fine now (except the mysterious multiple lister error, now line 150). I'm glad I could help to optimize this great masterpiece.

Next weekend I'll join the party and make all my scripts fully support SW (already done but unpublished for Tagger).

For the internal english-german dictionary I think it's enough to translate dialogs and column names. German users are very used to english script output and log file contents. A dictionary is a nice idea which I can probably also use with my own scripts making it unnecessary to always maintain two versions.

Hello tbone,

and many thanks for your efforts.

I have the same problem with DO11.8 English, but German Windows 7 Professional, 64 Bit:

File Command.Generic_ScriptWizard.js.txt is renamed to Command.Generic_ScriptWizard.js and saved in ...\Directory Opus\Script AddIns as fred stated.
Any hints?

Many thanks and greetings
opusfreak

The extension doesn't matter as long as it's .js.txt or .js. Opus will rename it automatically if you drop it on the scripts folder, but either works.

This is exactly my setup. Could you open the "Other Logs" utility panel (script log) and see what happens there, if you rename the file "Command.Generic_ScriptWizard.js(.txt)" in "/dopusdata/script addins" into "Command.Generic_ScriptWizard-Test.js"? DO will reload the file after the rename and you maybe see an error message. If the log stays clean, the add-in needs to appear in preferences / toolbars / scripts, unless there's some unknown magic going on.

Please report your findings.. o)

@fred
In case you read this, did you manage to get it working?

@tbone

I normally run Opus in Windows 7 at the office or Windows 8.1 at home but I also maintain an XP virtual machine for testing purposes. When I fired up my current configuration on the XP VM, DOpus threw a couple of error messages...


..and thereafter DOpus behaved badly and had to be killed with Process Explorer. I figured it had to be a script causing the problem and after removing all and selectively restoring isolated it to Command.Generic_ScriptWizard.js

I have not done any further debugging.

Regards, AB

Hi aussie! o)
I can only guess where this error comes from. If you fire up DO, it will intialize ScriptWizard, which trys to delete a deprecated script in "script addins".
The deprecated script is called "Command.Generic_ScriptHelper.js(.txt)". There's no other "delete" action going on in the initialization phase of ScriptWizard.
Maybe you could try to comment out the corresponding lines and see if it cures the Problem? Search for "deprecatedScriptPath" and the two DELETE QUIET FORCE raw commands (around line 82).

I don't know why DO gives you that error, as it should not. But maybe that's the same problem user fred and opusfreak ran into.
Unfortunately, they did not report back yet. So fred and opusfreak? Please come back, so we can fix this all together! o)