News:

--

Main Menu

How to make a simple script?

Started by sneffel, May 01, 2024, 10:20:22 AM

Previous topic - Next topic

sneffel

Hi. I haven't found any documentation on how to make a simple script.

I really want to have a checkbox when saving a video to delete the original vid.

For example
I'm editing original.mp4. I save it as FINAL.mkv. I want original.mp4 to be deleted at the end of the process.

Another unrelated request is that I want a checkbox in the Select File to Save window that would be called "Export the whole video" as opposed to only the time selection. I rarely want to export the selection, it's often just a mistake and I forgot to press Ctrl + Top arrow at the end.

 ;D

eumagga0x2a

Quote from: sneffel on May 01, 2024, 10:20:22 AMI want original.mp4 to be deleted at the end of the process.

I strongly discourage you from doing that before you have watched FINAL.mkv from beginning to the end.

Anyway, this is impossible by means of internal Avidemux scripting.

Quote from: sneffel on May 01, 2024, 10:20:22 AMI want a checkbox in the Select File to Save window that would be called "Export the whole video" as opposed to only the time selection. I rarely want to export the selection, it's often just a mistake and I forgot to press Ctrl + Top arrow at the end.

At the next level a user will forget to check the checkbox ;-)

adm = Avidemux()
ed = Editor()
gui = Gui()

if not adm.isFileOpen():
    return 0

adm.markerA = 0
adm.markerB = ed.getVideoDuration()

ext = adm.getOutputExtension()

if ext is None:
    return 0

outname = gui.fileWriteSelectEx("Select output file", ext)

if outname is None:
    return 0

return adm.save(outname)

Save this as "Reset Markers and Save.py" in the "custom" subfolder of Avidemux profile.

Please also consider using alternative keyboard shortcuts, where the default keyboard shortcut to reset markers is simply "R".