shankey Posted November 23, 2008 Share Posted November 23, 2008 Hi, I am new to autoit and it is very very good. I am trying to create a GUI for ffmpeg to create DVDs. For adding subtitles, it is necessary to use a command line tool called spumux. It is necessary to create an xml file with the necessary tags. I have opened a file using the fileopen tag. Is there a way to save the file without the save file dialog? The code is below. _FileCreate($temp) $file=FileOpen($temp, 2) _FileWriteToLine($file, 1, '<subpictures>',1) _FileWriteToLine($file, 2, '<stream>', 1) _FileWriteToLine($file, 3, '<textsub filename="' & $sub_data & '" characterset="ISO8859-1"', 1) _FileWriteToLine($file, 4, 'fontsize="' & $txt & '" font="arial.ttf" horizontal-alignment="center"', 1) _FileWriteToLine($file, 5, 'vertical-alignment="bottom" left-margin="60" right-margin="60"', 1) _FileWriteToLine($file, 6, 'top-margin="20" bottom-margin="30" subtitle-fps="' & $fps & '"', 1) _FileWriteToLine($file, 7, 'movie-fps="' & $fps_mov & '" movie-width="' & $Resolution[1] & '" movie-height="' & $Resolution[2] & '"', 1) _FileWriteToLine($file, 8, '/>',1) _FileWriteToLine($file, 9, '</stream>', 1) _FileWriteToLine($file, 10, '</subpictures>', 1) When I check in the directory there is an xml file but the size is 0 bytes. Will the fileclose tag save the contents before it closes? Link to comment Share on other sites More sharing options...
Pain Posted November 23, 2008 Share Posted November 23, 2008 $file=FileOpen($temp, 2+8); 2 = Write mode 8 = Create directory structure if it doesn't exist ; I prefer using FileWriteLine since you doesn't need to write to line 5,2,3,4,8,9,1 etc. FileWriteLine($file, '<subpictures>') FileWriteLine($file, '<stream>') FileWriteLine($file, '<textsub filename="' & $sub_data & '" characterset="ISO8859-1"') FileWriteLine($file, 'fontsize="' & $txt & '" font="arial.ttf" horizontal-alignment="center"') FileWriteLine($file, 'vertical-alignment="bottom" left-margin="60" right-margin="60"') FileWriteLine($file, 'top-margin="20" bottom-margin="30" subtitle-fps="' & $fps & '"') FileWriteLine($file, 'movie-fps="' & $fps_mov & '" movie-width="' & $Resolution[1] & '" movie-height="' & $Resolution[2] & '"') FileWriteLine($file, '/>') FileWriteLine($file, '</stream>') FileWriteLine($file, '</subpictures>') FileClose($file) Link to comment Share on other sites More sharing options...
shankey Posted November 23, 2008 Author Share Posted November 23, 2008 $file=FileOpen($temp, 2+8); 2 = Write mode 8 = Create directory structure if it doesn't exist ; I prefer using FileWriteLine since you doesn't need to write to line 5,2,3,4,8,9,1 etc. FileWriteLine($file, '<subpictures>') FileWriteLine($file, '<stream>') FileWriteLine($file, '<textsub filename="' & $sub_data & '" characterset="ISO8859-1"') FileWriteLine($file, 'fontsize="' & $txt & '" font="arial.ttf" horizontal-alignment="center"') FileWriteLine($file, 'vertical-alignment="bottom" left-margin="60" right-margin="60"') FileWriteLine($file, 'top-margin="20" bottom-margin="30" subtitle-fps="' & $fps & '"') FileWriteLine($file, 'movie-fps="' & $fps_mov & '" movie-width="' & $Resolution[1] & '" movie-height="' & $Resolution[2] & '"') FileWriteLine($file, '/>') FileWriteLine($file, '</stream>') FileWriteLine($file, '</subpictures>') FileClose($file) Wow. Thanks... That did the trick... Thanks again... 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