wklw2010 Posted June 29, 2017 Author Share Posted June 29, 2017 Can someone please make a suggestion? Does this make since? Link to comment Share on other sites More sharing options...
mikell Posted June 29, 2017 Share Posted June 29, 2017 I'm not sure about what you want to achieve. If you want to name the new file according to the name of the original file, you could do it like this ; read file path from input $file = GUICtrlRead($Input1) If $file = "" Then ContinueLoop ; extract filename from full path (assuming that the file has no extension) $filename = StringRegExpReplace($file, '.+\\(.+)', "$1") ; some code here... ;..... ; open dest file in write/overwrite mode, creating path if doesn't exist ; using flag 10 = $FO_OVERWRITE (2) + $FO_CREATEPATH (8) $hFile = FileOpen("C:\Users\Public\Documents\BatchPlots\" & filename & "_new", 10) FileWrite($hFile, $out) FileClose($hFile) wklw2010 1 Link to comment Share on other sites More sharing options...
wklw2010 Posted June 29, 2017 Author Share Posted June 29, 2017 48 minutes ago, mikell said: I'm not sure about what you want to achieve. If you want to name the new file according to the name of the original file, you could do it like this ; read file path from input $file = GUICtrlRead($Input1) If $file = "" Then ContinueLoop ; extract filename from full path (assuming that the file has no extension) $filename = StringRegExpReplace($file, '.+\\(.+)', "$1") ; some code here... ;..... ; open dest file in write/overwrite mode, creating path if doesn't exist ; using flag 10 = $FO_OVERWRITE (2) + $FO_CREATEPATH (8) $hFile = FileOpen("C:\Users\Public\Documents\BatchPlots\" & filename & "_new", 10) FileWrite($hFile, $out) FileClose($hFile) Thank you Mikell, you're the best.. I've learned a lot from you. Link to comment Share on other sites More sharing options...
mikell Posted June 29, 2017 Share Posted June 29, 2017 You're welcome 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