majstang Posted April 25, 2017 Share Posted April 25, 2017 (edited) Hi! I wonder if there is a chance to add some nicer separator handling for name pattern eventually? The issue is if the variable is empty the separator gets applied no matter what, which looks a bit odd in the file name. This is my name pattern: %year%m%d_%time_%station_%event - %title Perhaps using some ternary operators to handle it? For example the title (sub-title) after identifying which separators the user has (in an AHK sample): (title ? " - " : "") which implies if title has value the - separator gets applied with a leading and trailing space, else title is empty and the - separator gets removed together with the leading and trailing spaces. Regards majstang Edited April 25, 2017 by majstang Quote Link to comment
Griga Posted April 26, 2017 Share Posted April 26, 2017 ?? ?? Can you give an example of a filename, how it actually looks and how it should look? Quote Link to comment
majstang Posted April 26, 2017 Author Share Posted April 26, 2017 Quite often shows dont have a sub-title which implies this file name: 20170425_20-59-04_TV3_Världens bästa burgare -.ts After %event the leading space and the "-" is still there. The trailing space actually seems to be removed cuz the punctuation comes directly after " -" separator. With some separator handling the file name would look like this: 20170425_20-59-04_TV3_Världens bästa burgare.ts This handling could be applied to all name pattern variables if for some unknown reason they might be empty. Quote Link to comment
majstang Posted April 26, 2017 Author Share Posted April 26, 2017 (edited) Here is a code sample: ;20170425_20-59-04_TV3_Världens bästa burgare -.ts ;%year%m%d_%time_%station_%event - %title year := "2017" m := "04" d := "25" time := "20-59-04" station := "TV3" event := "Världens bästa burgare" title := "" ;title := "“Las Vegas”" ext := ".ts" string := % year . m . (d ? d "_" : "") . (time ? time "_" : "") . (station ? station "_" : "") . event . (title ? " - " title : "") . ext msgbox % string Tricky part is to identify which separators the user is having in name pattern string and construct the ternary operators thereafter, but it is doable with some RegEx or SubStr()/InStr() and nifty wit to cover all possible cases Edited April 26, 2017 by majstang Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.