Small GUI to start

Find quick help here to get you started with Hollywood
Post Reply
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Small GUI to start

Post by papiosaur »

Hi all!

First, thanks a lot Andreas for Hollywood and others components!

I begin with Hollywood and i would like to do a GUI for FFMPEG soon.

Before, i would like to do a simple GUI for the AmigaDOS command "Join".

i know Execute() command but how to execute a AmigaDOS command with variables from Hollywood ?

Example : i select files to join in a requester (ISO, VOB, etc.)

How to write : Execute(Join smallfile1 smallfile2 smallfile3 AS bigfile) and how to get and write variables for Execute() command please ?

Thanks a lot!
plouf
Posts: 467
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Small GUI to start

Post by plouf »

Welcome
If you read theRTFM see that Execute() has at least two parameters second parameter is arguments passed to command

Execute(file$[, args$, t])

Also note that many videos can be played internally with AVCodec plugin (if it helpfull to your utility)
Christos
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Small GUI to start

Post by jPV »

papiosaur wrote: Fri Mar 31, 2023 6:12 pm Before, i would like to do a simple GUI for the AmigaDOS command "Join".

i know Execute() command but how to execute a AmigaDOS command with variables from Hollywood ?

Example : i select files to join in a requester (ISO, VOB, etc.)

How to write : Execute(Join smallfile1 smallfile2 smallfile3 AS bigfile) and how to get and write variables for Execute() command please ?
Well... this isn't anywhere near a real GUI, but a minimal example for what you asked :)

Code: Select all

@VERSION 9,0 ; Require Hollywood 9.0
@APPTITLE "Joiner"
@APPVERSION "$VER: Joiner 1.0 (02.04.23)"
@APPDESCRIPTION "Joins files."
@DISPLAY {Hidden=True} ; No need for the graphical display this time

files = FileRequest("Select some files", {Mode = #REQ_MULTISELECT})

; In the multiselect mode, the last item is "". If it's also the first, then nothing was selected.
If files[0] <> ""
    Local outfile$ = FileRequest("Select an output file", {Path = "RAM:", File = "joinedfiles"})
    If outfile$ And Exists("C:Join")
        ; Let's build an argument string. Local variable because we don't need this elsewhere in the program.
        Local args$ = ""

        For Local i = 0 To ListItems(files) - 2 ; -2 because we'll skip the last empty item
            ; Let's encapsulate file paths in quotation marks to work with paths with spaces.
            args$ = args$ .. "\"" .. files[i] .. "\" "
        Next

        ; Add the rest to the args string. Outfile in quotation marks too.
        args$ = args$ .. "AS \"" .. outfile$ .. "\""

        ; Just to check that our arguments look ok. ConsolePrint() is another way if you don't see this.
        DebugPrint(args$)

        ; Enable this line only after checking everything is ok with DebugPrint() or ConsolePrint()
        Execute("C:Join", args$)
    EndIf
EndIf
BTW. did you get my mail about translation ;)
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Small GUI to start

Post by papiosaur »

Thanks a lot plouf and jPV for your precious help!

@jPV: yes, i have answer you, thanks for your help!

Small problem, i don't have information when the join is terminated in output window.

Is it possible to replace output window by a progress bar (MUI) and close it when is finished and open the destination window after that?
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Small GUI to start

Post by jPV »

papiosaur wrote: Sun Apr 02, 2023 6:37 pm @jPV: yes, i have answer you, thanks for your help!
Have answered or will answer? Haven't got any mail yet :)
Small problem, i don't have information when the join is terminated in output window.
When you launch a program with Execute(), Hollywood will then wait until the launched program will finish and return, and Hollywood script continues after then. So, you can add something after the Execute() line to know it's finished. Pop up a requester or print a line in the shell or anything.
Is it possible to replace output window by a progress bar (MUI) and close it when is finished and open the destination window after that?
Basically there shouldn't be an output window, at least if you don't have a ConslolePrint() line or something like that. The DebugPrint/ConsolePrint I suggested should be only temporarily there for development purposes.

The external Join command doesn't let us know about any progress (there's no shell output or anything), so we can't know where is it going and thus we don't know when to update a progress bar. We only know when it has finished.

The only option with it would be to join files one by one instead of giving all files in one line and update a progress bar then, but it gets quite clumsy, because the Join command doesn't work if you join the same file as should be the output file too. "Join outfile part2 as outfile" doesn't work. We should use a temp file like "Copy outfile outfile.tmp", "Join outfile.tmp part2 as outfile", and so on. It wastes time and space.

So, this is not a practical solution, but do you want such code as an example anyway? The Join command is a bit bad example about using external programs, but if you want, I can do it.

If the aim is to make a proper solution for joining files, instead of just being a theoretical example, then file joining should be done with Hollywood's internal functions instead of the external command.
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Small GUI to start

Post by papiosaur »

Hi all,

thanks a lot for your help :-)

My first GUI is available:

https://www.morphos-storage.net/?find=joingui
Post Reply