Sign in to follow this  
Followers 0
pintas

cmd line help

4 posts in this topic

I'm trying to get the radio button variable input into the ffmpeg cmd line but i simply can't...

What is wrong with this picture?

Local $radio1, $radio2, $radio3, $radio4, $msg
      $radio1 = GUICtrlCreateRadio("64", 10, 120, 30, 20)
      $radio2 = GUICtrlCreateRadio("128", 50, 120, 45, 20)
      $radio3 = GUICtrlCreateRadio("192", 100, 120, 45, 20)
      $radio4 = GUICtrlCreateRadio("256 (lento)", 150, 120, 70, 20)
      $Kbps= ""
GUICtrlSetState($radio2, $GUI_CHECKED)

While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
        Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
            $Kbps = "64"
        Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
            $Kbps = "128"
        Case $msg = $radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED
            $Kbps = "192"
        Case $msg = $radio4 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
            $Kbps = "256"
        Case $GUI_EVENT_CLOSE
              Exit
        EndSwitch
  WEnd

$c = "ffmpeg.exe -i " & '"' & $title1 & '"' & " -b " & $Kbps & '"' & $title2 & ".mp3" & '"' ;
      $pid = RunWait($c, @ScriptDir, @SW_HIDE, $STDERR_CHILD)      ProcessSetPriority($pid, 0);; lowest

Is seems to me the problem is in the $c (last lines). I've tried every alternative but no good news so far...

Share this post


Link to post
Share on other sites



Instead of checking for radio messages, just see what's checked before you start the encoding. (Otherwise the default of 128 won't be detected)

Also, it looks like you need a space between the bitrate and the file name.

Until you get everything worked out, throw $c in a MsgBox to see what's wrong.


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Thanks for your reply, but i couldn't figure out what you meant with "See what's checked before you start the encoding" and "throw $c in a MsgBox to see what's wrong". The last gives me a '1' in the MsgBox. :)

Can you please clarify this a bit? English is not my native language.

Share this post


Link to post
Share on other sites

Thanks for your reply, but i couldn't figure out what you meant with "See what's checked before you start the encoding"

Since you didn't post your entire GUI code, I'm filling in the blanks on the buttons and functions.

Now that I've looked at it again, I noticed that you are using a Switch statement like a Select.

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Button1
            ; Read Bitrate
            Select
                Case BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
                    $Kbps = "64"
                Case BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
                    $Kbps = "128"
                Case BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED
                    $Kbps = "192"
                Case BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
                    $Kbps = "256"
                case Else
                    $Kbps = "128"
            EndSelect
            ; Do Encoding
            _EncodeIt("Title1", "Title2", $Kbps)
            
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

and "throw $c in a MsgBox to see what's wrong". The last gives me a '1' in the MsgBox. :)

Can you please clarify this a bit? English is not my native language.

Func _EncodeIt($title1, $title2, $bitrate)
    $c = "ffmpeg.exe -i " & '"' & $title1 & '"' & " -b " & $bitrate & ' "' & $title2 & ".mp3" & '"'
    MsgBox(0, "Is this Commandline Correct?", $c)
;~     $pid = RunWait($c, @ScriptDir, @SW_HIDE, $STDERR_CHILD)
;~     ProcessSetPriority($pid, 0);; lowest
EndFunc

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0