Update jobs bar info during long running script?

Hello again :slight_smile:

When running a long-running script, I notice that Opus automatically shows a 'long-running task' indicator (e.g. in the jobs bar, if configured to do so).

However, during this particular script I'm working on (the checksum checker), I know how long I'm going to take. e.g. I know how many files will have checksums calculated for them.

Is it possible to provide these counts as information to the progress indicator so it can show the user something sensible?

Perhaps something like Script.UpdateProgress(min, max) or even just Script.UpdateProgress(text).

Many thanks,
T

Scripting Objects: Progress

Well that's embarrassing. I swear I had spent ages flicking through the help looking for that :confused:

Is there a common gotcha that results in the 'standard' progress plus my one showing?


Is that when using the provided Command.Progress object, or is it obtained/created in another way?

How is the script being run in the files?

Function OnCommandGenerateChecksum( scriptCmdData )

    ...

    Dim progress : Set progress = scriptCmdData.func.command.Progress

    progress.Init scriptCmdData.func.sourcetab.lister, "Calculating checksums"
    
    With progress
        .owned = true
        .bytes = false
        .abort = true
        .pause = false
        .skip  = false
    End With


    progress.Show
    progress.SetStatus "Counting files..."

    ...
    
    progress.SetStatus "Calculating checksums..."

    For Each file in scriptCmdData.func.args.files

        ...
            progress.SetName CStr(file)
            CalculateFile fsu, outputStream, outputPath, file, progress
            progress.StepFiles 1
        ...

    Next '' file

    progress.Hide

I've added a GenerateChecksumFile command and running it with:

@nodeselect 
Select DESELECT checksums.md5
GenerateChecksumFile {allfilepath$} 

I've attached the script for reference - I'm intending to make it available to all once I've ironed out these issues anyway.
Checksum.zip (2.33 KB)

Any thoughts on this?

I think one progress dialog is for the button (@nodeselect and the other two lines) while the other progress dialog is for the script.

If you do everything from a single script-button, it should work how you want.

You may also be able to avoid the button's progress dialog by removing {allfilepath$} and having the script command pick them up implicitly, as I suspect that's what's triggering the unwanted progress dialog.

I'll try your suggestions, many thanks!

12.3.2 has a new @noprogress which can help in this situation, too.

Just saw that, thanks!