javip Posted August 25, 2011 Share Posted August 25, 2011 Hello all, I created a gui using Koda to port over a very simple batch script. here's the batch file line "C:\stuff\ports\audio video\hd pvr\KLToolBox2.3\rcTVCap.exe" "C:\stuff\ports\audio video\hd pvr\rcTVCap\mines.GRF" "File Dump" 10800 "C:\caps\capd.ts" this line works perfectly from within a CMD window. I can't get autoit to run it without throwing out a syntax error. here's my autoit script. i was currently trying the _RunDos function to try and run that line. aside from this the other thing i need help with is getting the path that i selected into the CAPD.TS part of my CMD line. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Process.au3> #region ### START Koda GUI section ### Form=c:\startstopcap.kxf $MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}" $Form1_1 = GUICreate("Form1", 292, 175, 192, 159) $Button1 = GUICtrlCreateButton("start cap", 8, 136, 137, 33) $Button2 = GUICtrlCreateButton("stop cap", 160, 136, 121, 33) $Button3 = GUICtrlCreateButton("select file", 8, 16, 137, 17) $Input1 = GUICtrlCreateInput(" ", 8, 112, 137, 21) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() If $nMsg = -3 Then Exit If $nMsg = $Button1 Then button1() If $nMsg = $Button3 Then $capd = FileSaveDialog("Choose a name.", $MyDocsFolder, "Scripts (*.ts)", 2) If $nMsg = $Button3 Then button3() WEnd Func button1() _RunDOS("C:\stuff\ports\audio video\hd pvr\KLToolBox2.3\rcTVCap.exe" "C:\stuff\ports\audio video\hd pvr\rcTVCap\mines.GRF" "File Dump" 10800 "C:\caps\capd.ts") EndFunc ;==>button1 Func button3() GUICtrlSetData($Input1, $capd) EndFunc ;==>button3 can anyone offer some guidance? Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 25, 2011 Share Posted August 25, 2011 You need proper enclosure of your command line, which includes some double quotes: _RunDOS('"C:\stuff\ports\audio video\hd pvr\KLToolBox2.3\rcTVCap.exe" "C:\stuff\ports\audio video\hd pvr\rcTVCap\mines.GRF" "File Dump" 10800 "C:\caps\capd.ts"') Also, is 10800 supposed to be the resolution (maybe 1080 instead)? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
UEZ Posted August 25, 2011 Share Posted August 25, 2011 Try this: Func button1() _RunDOS("start 'C:\stuff\ports\audio video\hd pvr\KLToolBox2.3\rcTVCap.exe' 'C:\stuff\ports\audio video\hd pvr\rcTVCap\mines.GRF' File Dump 10800 " & GUICtrlRead($Input1)) ;~ ShellExecute("'C:\stuff\ports\audio video\hd pvr\KLToolBox2.3\rcTVCap.exe'", "'C:\stuff\ports\audio video\hd pvr\rcTVCap\mines.GRF File Dump' '10800' " & GUICtrlRead($Input1)) EndFunc ;==>button1 Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
javip Posted August 25, 2011 Author Share Posted August 25, 2011 (edited) You need proper enclosure of your command line, which includes some double quotes: _RunDOS('"C:\stuff\ports\audio video\hd pvr\KLToolBox2.3\rcTVCap.exe" "C:\stuff\ports\audio video\hd pvr\rcTVCap\mines.GRF" "File Dump" 10800 "C:\caps\capd.ts"') Also, is 10800 supposed to be the resolution (maybe 1080 instead)? the 10800 part of the line is time in minutes to record. part of the parameters for rctvcap.exe i got the line to work with the regular RUN function: $console = Run('"C:\caps\tools\rcTVCap.exe" "C:\caps\tools\mines.GRF" "File Dump" 10800 "' & GUICtrlRead($Input1)) UEZ and PsaltyDS thanks for all the help so far. it put me on the write track to at least get the program running. Edited August 25, 2011 by pixeldotz Link to comment Share on other sites More sharing options...
rcmaehl Posted August 25, 2011 Share Posted August 25, 2011 What is this Koda I've heard about?? My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
UEZ Posted August 25, 2011 Share Posted August 25, 2011 Install the full SciTE package, start it and press Alt+m in SciTE... Br,UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
javip Posted September 2, 2011 Author Share Posted September 2, 2011 Hello again everyone.Using the knowledge I gained here and in a previous thread concerning a simple wrapper for windows 'ping';I have been able to write my wrapper for rcTVcap (a video capture utility). Everything works exactly as it should (even though the code might seem raw and written inefficiently) The problem I'm having is that the $autoname variable is getting passed as a string instead of as a command.I use this line with rcTVcap in a batch file to autoname files as they get created. date/time stamp in case i'm recordingmultiple videos one right after another.Global $autoname = "C:\caps\capd_%date:~-4,4%_%date:~-7,2%_%date:~-10,2%_%time:~-8,2%_%time:~-5,2%.ts" since it doesn't get processed the same way through autoit as it would in a batch file, rcTVcap spits out an error that the "save filename is invalid"but when used within the batch file, this line is perfectly valid. is there something i'm missing?the code in it's entirety is as follows. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Process.au3> #include <GUIConstantsEx.au3> #include <Constants.au3> #region ### START Koda GUI section ### Form=c:\documents and settings\pxl\my documents\dropbox\startstopcap.kxf $MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}" $Form1_1 = GUICreate("pxldtz [rcTVcap.exe frontend]", 720, 428, 295, 164) $Button1 = GUICtrlCreateButton("start cap", 440, 56, 113, 33) $Button2 = GUICtrlCreateButton("stop cap", 600, 56, 113, 33) $Button3 = GUICtrlCreateButton("file", 552, 56, 49, 33) $Button4 = GUICtrlCreateButton("settings", 440, 92, 273, 33) $Input1 = GUICtrlCreateInput("", 440, 32, 273, 21) $Label1 = GUICtrlCreateLabel("selected file path", 440, 8, 228, 17) $hEdit = GUICtrlCreateEdit("", 8, 8, 425, 377) GUICtrlSetData(-1, "") $Edit1 = GUICtrlCreateEdit("", 440, 160, 273, 225) GUICtrlSetData(-1, "") $chkbox1 = GUICtrlCreateCheckbox("autoname", 440, 136, 97, 17) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### Global $capd Global $console Global $console2 Global $autoname = "C:\caps\capd_%date:~-4,4%_%date:~-7,2%_%date:~-10,2%_%time:~-8,2%_%time:~-5,2%.ts" ;==this entire section shows the output of the console into you're editbox While 1 $data = StdoutRead($console) If $data Then GUICtrlSetData($hEdit, $data, 1) EndIf $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit ;===start capping Case $nMsg = $Button1 startcap() ;===stop the capping process Case $nMsg = $Button2 stopcap() ;===filesave browser Case $nMsg = $Button3 filebrowse() Case $nMsg = $Button4 Run(@WorkingDir & '\tools\mines.grf') ;===disables the input box and filebrowser button depending on the state of the checkbox Case $nMsg = $chkbox1 If GUICtrlRead($chkbox1) = 1 Then GUICtrlSetState($Input1, $gui_disable) GUICtrlSetState($Button3, $gui_disable) Else GUICtrlSetState($Input1, $gui_enable) GUICtrlSetState($Button3, $gui_enable) EndIf EndSelect WEnd ;==>rctvcap parameters ;=== start cap function Func startcap() If $console Then ProcessClose("rcTVCap.exe") GUICtrlSetData($hEdit, "===========Resetting=====") If GUICtrlRead($chkbox1) = 1 Then $console = Run('"C:\caps\tools\rcTVCap.exe" "C:\caps\tools\mines.GRF" "File Dump" 10800 "' & $autoname, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Else $console = Run('"C:\caps\tools\rcTVCap.exe" "C:\caps\tools\mines.GRF" "File Dump" 10800 "' & GUICtrlRead($Input1), "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) EndIf Local $line EndFunc ;=== stop cap function Func stopcap() If $console Then ProcessClose("rcTVCap.exe") GUICtrlSetData($hEdit, "Cap stopped") EndFunc ;===file browse function Func filebrowse() $capd = FileSaveDialog("Choose a name.", $MyDocsFolder, "stream file (*.ts)", 2) GUICtrlSetData($hEdit, "") ;This line erases the editbox GUICtrlSetData($Input1, $capd) ;this sets the input box contents to whatever the $capd variable is holding EndFunc Link to comment Share on other sites More sharing options...
UEZ Posted September 2, 2011 Share Posted September 2, 2011 (edited) You have to convert the %date:~-4,4% format from Batch to AutoIt format! Look for the date functions or date macros. Br, UEZ Edited September 2, 2011 by UEZ javip 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
javip Posted September 3, 2011 Author Share Posted September 3, 2011 (edited) You have to convert the %date:~-4,4% format from Batch to AutoIt format! Look for the date functions or date macros. Br, UEZ thanks for pointing me in the write direction. it was really simple with macros, way simpler than the huge line in batch file. the resulting code was. $console = Run('"C:\caps\tools\rcTVCap.exe" "C:\caps\tools\mines.GRF" "File Dump" 10800 "' & "C:\caps\capd_" & @hour & @MIN & @SEC & ".ts", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) @HOUR & @MIN & @SEC was the missing part. thanks again!, my program is pretty much complete thanks to everyone who helped. Edited September 3, 2011 by pixeldotz Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now