Jump to content

Cant create a file with the correct name


Recommended Posts

Global $date = @MON & "-" & @MDAY & "-" & @YEAR
$sFile = _FileCreate(@ScriptDir & "\" & $date & " " & _NowTime() & ".txt")
$File = FileOpen($sFile,1)

Looking for the file name to be : 12-29-2015 10:38:25PM.txt The above creates 0.txt

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Link to comment
Share on other sites

  • Moderators

That would be because : is not a usable character in file names. This works just fine:

#include <Date.au3>
#include <File.au3>

Global $date = @MON & "-" & @MDAY & "-" & @YEAR
$sFile = _FileCreate(@ScriptDir & "\" & $date & " " & @HOUR & "_" & @MIN & "_" & @SEC & ".txt")
$File = FileOpen($sFile,1)

 

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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