Jump to content

Recommended Posts

Posted

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)

 

Posted
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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...