From 39249b596fd066326b945a599c36c70c2b6ea752 Mon Sep 17 00:00:00 2001 From: garret Date: Wed, 11 Aug 2021 21:10:21 +0100 Subject: get path with aegi save dialogue --- chapters.lua | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'chapters.lua') diff --git a/chapters.lua b/chapters.lua index fa81714..e9ade7d 100644 --- a/chapters.lua +++ b/chapters.lua @@ -1,7 +1,7 @@ script_name = "Chapter Generator" script_description = "makes chapters" script_author = "garret" -script_version = "2021-04-25" +script_version = "2.0.0-dev" language = "eng" language_ietf = "en" @@ -34,10 +34,15 @@ function get_sane_path() elseif audio_path ~= "?audio" then return audio_path else - return nil + return "" end end +function get_user_path(sane_path) + local path = aegisub.dialog.save("Save Chapter File", sane_path, "chapters.xml", "XML files (.xml)|.xml|All Files (.)|.", false) + return path +end + function main(sub) local times = {} local names = {} @@ -60,14 +65,15 @@ function main(sub) chapters = chapters.." \n "..humantime.."\n \n "..name.."\n "..language_ietf.."\n "..language.."\n \n \n" end chapters = chapters.." \n" - path = get_sane_path() + sane_path = get_sane_path() + path = get_user_path(sane_path) if path ~= nil then - local chapfile = io.open(path.."/chapters.xml", "w") + local chapfile = io.open(path, "w") chapfile:write(chapters) chapfile:close() - aegisub.log("saved to "..path.."/chapters.xml") + aegisub.log("saved to "..path) else - aegisub.log("\n\n") + aegisub.log("\n\n") aegisub.log(chapters) end end -- cgit v1.2.3-70-g09d2