Jump to content

ajenkins

Active Members
  • Posts

    46
  • Joined

  • Last visited

ajenkins's Achievements

  1. thats what i came up with also. thanks for the answers!
  2. thanks guys, is there a way to write the 2d array in this fasion? i keep getting error for the un-declared variable. any way around it? Global $check_arr[58][2] = [ _ ["3G2", GUICtrlCreateCheckbox($check_arr[0][0], 32, 128, 97, 17)], _ ["3GP",GUICtrlCreateCheckbox($check_arr[1][0], 32, 152, 97, 17)], _ just for learning purposes. if not, i will do it the other way.
  3. I hope im asking this right. I am trying to cut this script down. Global $Checkbox1 = GUICtrlCreateCheckbox("3G2", 32, 128, 97, 17) GUICtrlSetState(-1, $GUI_CHECKED) Global $Checkbox2 = GUICtrlCreateCheckbox("3GP", 32, 152, 97, 17) GUICtrlSetState(-1, $GUI_CHECKED) Global $Checkbox3 = GUICtrlCreateCheckbox("A52", 32, 176, 97, 17) GUICtrlSetState(-1, $GUI_CHECKED) Global $Checkbox4 = GUICtrlCreateCheckbox("AAC", 32, 200, 97, 17) GUICtrlSetState(-1, $GUI_CHECKED) Global $Checkbox5 = GUICtrlCreateCheckbox("AC3", 32, 224, 97, 17) GUICtrlSetState(-1, $GUI_CHECKED) Global $Checkbox6 = GUICtrlCreateCheckbox("ASF", 32, 248, 97, 17) If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.3G2") RegDelete("HKCR\.3G2") RegWrite("HKCR\.3G2","","REG_SZ",'vlcfile') EndIf If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.3GP") RegDelete("HKCR\.3GP") RegWrite("HKCR\.3GP","","REG_SZ",'vlcfile') EndIf If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.A52") RegDelete("HKCR\.A52") RegWrite("HKCR\.A52","","REG_SZ",'vlcfile') EndIf If GUICtrlRead($Checkbox4) = $GUI_CHECKED Then RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.AAC") RegDelete("HKCR\.AAC") RegWrite("HKCR\.AAC","","REG_SZ",'vlcfile') EndIf If GUICtrlRead($Checkbox5) = $GUI_CHECKED Then RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.AC3") RegDelete("HKCR\.AC3") RegWrite("HKCR\.AC3","","REG_SZ",'vlcfile') EndIf If GUICtrlRead($Checkbox6) = $GUI_CHECKED Then RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ASF") RegDelete("HKCR\.ASF") RegWrite("HKCR\.ASF","","REG_SZ",'vlcfile') EndIf It keeps going until $checkbox59... Each time only changing one small element. I used this to check all checkboxes. For $checkbox = 1 to 59 GUICtrlSetState($Checkbox,$GUI_CHECKED) Next i was thinking I could use something similar, and include my elements into an array But how can I loop through the variables and an array of elements?
  4. works perfect. Thanks!
  5. thanks for the suggestions, but still no difference. I don't know if this helps, but here is the output if i filewrite() instead of msgbox() out2.txt
  6. when I run the process in cmd i get this output Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved. C:\"eac3to.exe" "f:\" 1) 00800.mpls, 1:42:13 [879+880+881+882+883+884+885+886+887+888+800].m2ts - Chapters, 16 chapters - h264/AVC, 1080p24 /1.001 (16:9) - DTS Master Audio, English, multi-channel, 48kHz - DTS Master Audio, Japanese, multi-channel, 48kHz 2) 00801.mpls, 1:42:13 [879+889+881+890+883+891+885+892+887+888+800].m2ts - Chapters, 16 chapters - h264/AVC, 1080p24 /1.001 (16:9) - DTS Master Audio, English, multi-channel, 48kHz - DTS Master Audio, Japanese, multi-channel, 48kHz 3) 00861.mpls, 00887.m2ts, 0:54:14 - h264/AVC, 1080p24 /1.001 (16:9) - DTS Master Audio, English, multi-channel, 48kHz - DTS Master Audio, Japanese, multi-channel, 48kHz 4) 00856.mpls, 00883.m2ts, 0:24:14 - h264/AVC, 1080p24 /1.001 (16:9) - DTS Master Audio, English, multi-channel, 48kHz - DTS Master Audio, Japanese, multi-channel, 48kHz 5) 00404.mpls, 0:15:43 [908+909+910+911].m2ts - Chapters, 4 chapters - h264/AVC, 1080p24 /1.001 (16:9) - AC3, English, stereo, 48kHz C:\ when I run my script Func _GetTrack() $sStdout = "" $prog = @TempDir & "\eac3to.exe" $input = "F:\" $hPid = Run('"' & $prog & '""' & $input & '"',$input,@SW_HIDE,0x2) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE exitprog() EndSwitch $sStdout &= StdoutRead($hPid,False) If @error Then ExitLoop If StringLen($sStdout) > 0 Then MsgBox(0,"TRACKS",$sStdout) EndIf WEnd EndFunc ;==>_GetTrack I get this in my msgbox... is there a way I can clean up the output so the msgbox displays only the text?
  7. works great, thanks for all the help guys.
  8. this is working without error, but the progress bar keeps dropping back and forth. any ideas? Func _GetDuration($sStdErr) If Not StringInStr($sStdErr, "PRGV:") Then Return SetError(1, 0, 0) Local $aRegExp = StringRegExp($sStdErr, "(?i)PRGV.+?([0-9,]+)", 3) If @error Or Not IsArray($aRegExp) Then Return SetError(1, 0, 0) Local $sTime = $aRegExp[UBound($aRegExp) - 1] Local $aTime = StringSplit($sTime, ",", 2) If @error Or ubound($aTime) < 3 Then Return SetError(1, 0, 0) If Not @error Then Return $aTime[1]/$aTime[2]*100 EndFunc ;==>_GetDuration
  9. Thanks for the help FUBAR, I am always amazed how fast people reply on this forum. I see what you mean about stringsplit returns an array. I tried your edited script, the gui doesn't crash now, but the progress bar doesn't mov anymore. I am working on figuring it out now.
  10. I am getting this error, It happens after running my script for 2-30 seconds. Then my gui crashes. "Array variable has incorrect number of subscripts or subscript dimension range exceeded.: Return $aTime[1]/$aTime[2]*100 Return $aTime[1]/^ ERROR" ripgui() Func ripgui() #Region ### START Koda GUI section ### Form=j:\my builds\all-rip\all-rip.kxf $QuickQualityEncode = GUICreate("ALL-RIP", 350, 197, 223, 219) GUISetBkColor(0x000000) $RIP_Button1 = GUICtrlCreateButton("RIP", 255, 110, 75, 25) GUICtrlSetColor(-1, 0x808080) $Pic1 = GUICtrlCreatePic(@TempDir & "\ALL-RIP\risa1.jpg", 0, 2, 100, 140) GUICtrlSetState(-1, $GUI_DISABLE) $INPUT_Button1 = GUICtrlCreateButton("INPUT", 255, 10, 75, 25) GUICtrlSetColor(-1, 0x808080) $OUTPUT_Button1 = GUICtrlCreateButton("OUTPUT", 255, 60, 75, 25) GUICtrlSetColor(-1, 0x808080) Global $Progress1 = GUICtrlCreateProgress(10, 160, 325, 25, $WS_BORDER) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $INPUT_Button1 Global $input = FileSelectFolder("Select Input Location", "") $INPUT_Label1 = GUICtrlCreateLabel($input, 105, 10, 148, 25) GUICtrlSetColor(-1, 0xFFFFFF) Case $OUTPUT_Button1 Global $output = FileSelectFolder("Select Output Location", "") $OUTPUT_Label1 = GUICtrlCreateLabel($output, 105, 60, 148, 25) GUICtrlSetColor(-1, 0xFFFFFF) Case $RIP_Button1 rip() EndSwitch WEnd EndFunc Func rip() $prog = @TempDir & "\ALL-RIP\makemkvcon.exe" $sStdErr = "" $iTicksDuration = 0 $hPid = Run('"' & $prog & '" --robot --messages=-stderr --minlength=3600 mkv --progress=-same file:' & $input & ' all ' & $output,$output,@SW_HIDE,$STDIN_CHILD + $STDERR_CHILD) $nBegin = TimerInit() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE exitprog() EndSwitch If TimerDiff($nBegin) > 500 Then $sStdErr &= StderrRead($hPid) If @error Then ExitLoop If StringLen($sStdErr) > 0 Then $iTicksDuration = _GetDuration($sStdErr) If Not @error Then $sStdErr = "" GUICtrlSetData($Progress1, $iTicksDuration) EndIf $nBegin = TimerInit() EndIf WEnd ProgressOff() EndFunc Func _GetDuration($sStdErr) If Not StringInStr($sStdErr, "PRGV:") Then Return SetError(1, 0, 0) Local $aRegExp = StringRegExp($sStdErr, "(?i)PRGV.+?([0-9,]+)", 3) If @error Or Not IsArray($aRegExp) Then Return SetError(1, 0, 0) Local $sTime = $aRegExp[UBound($aRegExp) - 1] Local $aTime = StringSplit($sTime, ",", 2) If @error Or Not IsArray($aTime) Then Return SetError(1, 0, 0) Return $aTime[1]/$aTime[2]*100 EndFunc ;==>_GetDuration Func exitprog() if ProcessExists("makemkvcon.exe") Then ProcessClose("makemkvcon.exe") EndIf if ProcessExists("cmd.exe") Then ProcessClose("cmd.exe") EndIf FileDelete(@TempDir&"\All-RIP") Exit EndFunc ;==>exitprog I have been at it for a whille and at this point it feels like im running in circles. So any help would be great! Thanks.
  11. The Solution to the key send was stdinwrite(). That combined with the changes from M23 solved all problems. Thanks M23 for all the help! #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <File.au3> #include <ProgressConstants.au3> #include <Constants.au3> #include <GuiEdit.au3> #include <Date.au3> #include <ButtonConstants.au3> Global $fInterrupt = 0, $Button2, $Button3 gui1() Func gui1() $Form1 = GUICreate("Form1", 615, 478, 192, 124) Global $Edit1 = GUICtrlCreateEdit("", 8, 16, 601, 289) GUICtrlSetData(-1, "Edit1") Global $Progress1 = GUICtrlCreateProgress(8, 320, 593, 33) Global $Progress2 = GUICtrlCreateProgress(8, 368, 601, 33) $Button1 = GUICtrlCreateButton("Start", 24, 432, 89, 25) $Button2 = GUICtrlCreateButton("next", 128, 432, 89, 25) $Button3 = GUICtrlCreateButton("Exit", 232, 432, 89, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $Button3 exitprog() Case $Button1 start() EndSwitch WEnd EndFunc ;==>gui1 Func start() $somefolder = FileSelectFolder("Select Encode Folder", "") $Afiles = _FileListToArray($somefolder) $sStdErr = "" $iTicksDuration = 0 $iTicksTime = 0 $ffmpeg = $somefolder & "\ffmpeg.exe" For $i = 1 To $Afiles[0] $file = $Afiles[$i] $hPid = Run($ffmpeg & ' -i "' & $file & '" -y "' & StringTrimRight($file, 4) & '_output.mp4"', $somefolder, @SW_HIDE, $STDIN_CHILD + $STDERR_CHILD) ; Get a timestamp $nBegin = TimerInit() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $Button3 exitprog() Case $Button2 StdinWrite($hPid, "q") EndSwitch ; Do this every 500 ms If TimerDiff($nBegin) > 500 Then $sStdErr &= $file & StderrRead($hPid) If @error Then ExitLoop GUICtrlSetData($Edit1, $sStdErr) If StringLen($sStdErr) > 0 Then If Not $iTicksDuration Then $iTicksDuration = _GetDuration($sStdErr) $iTicksTime = _GetTime($sStdErr) If Not @error Then $sStdErr = "" GUICtrlSetData($Progress1, $iTicksTime * 100 / $iTicksDuration) EndIf ; Reset the timer $nBegin = TimerInit() EndIf WEnd ProgressOff() GUICtrlSetData($Progress2, ($i / $Afiles[0]) * 100) Next EndFunc ;==>start Func _GetDuration($sStdErr) If Not StringInStr($sStdErr, "Duration:") Then Return SetError(1, 0, 0) Local $aRegExp = StringRegExp($sStdErr, "(?i)Duration.+?([0-9:]+)", 3) If @error Or Not IsArray($aRegExp) Then Return SetError(1, 0, 0) Local $sTime = $aRegExp[UBound($aRegExp) - 1] Local $aTime = StringSplit($sTime, ":", 2) If @error Or Not IsArray($aTime) Then Return SetError(1, 0, 0) Return _TimeToTicks($aTime[0], $aTime[1], $aTime[2]) EndFunc ;==>_GetDuration Func _GetTime($sStdErr) If Not StringInStr($sStdErr, "time=") Then Return SetError(1, 0, 0) Local $aRegExp = StringRegExp($sStdErr, "(?i)time.+?([0-9:]+)", 3) If @error Or Not IsArray($aRegExp) Then Return SetError(1, 0, 0) Local $sTime = $aRegExp[UBound($aRegExp) - 1] Local $aTime = StringSplit($sTime, ":", 2) If @error Or Not IsArray($aTime) Then Return SetError(1, 0, 0) Return _TimeToTicks($aTime[0], $aTime[1], $aTime[2]) EndFunc ;==>_GetTime Func exitprog() If ProcessExists("ffmpeg.exe") Then ProcessClose("ffmpeg.exe") EndIf Exit EndFunc ;==>exitprog
  12. after a bit of trial and error, I got the controlsend() to work but only when sterrRead is disabled, and run(@SW_SHOW). I am out of time tonight, But will hopefully take another crack at it tomorrow.
  13. M23, not Z anymore, not old but most people I know in Japan say GMT+9. ajenkins
  14. sorry, you beat me. I'll try it and get back to you. Can I ask what time zone are you on? I don't usually get live contact on my time.
×
×
  • Create New...