AlanB22 Posted April 23, 2014 Share Posted April 23, 2014 I am not sure if it is a bug or my interpretation of the help? I have tried the following: $fn = _tempfile(@scriptdir & "dir1dir2","AB_",".txt") OR $tpath = @scriptdir & "dir1dir2" $fn = _tempfile($tpath,"AB_",".txt") In both cases the result for $fn is that it substitutes the directory path held in %Temp% By using an expilcit path it works. $fn = _tempfile("C:dirAdirBdir1dir2","AB_",".txt") Is this as designed, as I expected all to be evaluated correctly and that the temp path would be defaulted to when "" a blank parameter was enetered. Alan Link to comment Share on other sites More sharing options...
JohnOne Posted April 23, 2014 Share Posted April 23, 2014 There is no mention in help that it requires a literal path, but it appears to be the case. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted April 23, 2014 Share Posted April 23, 2014 Actually that's wrong, it defaults if the folder does not exist. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
sahsanu Posted April 23, 2014 Share Posted April 23, 2014 Checking the _Tempfile() function seems that if the path doesn't exist then the default is @Tempdir, this is the line in function _Tempfile(): If $sDirectoryName = Default Or (Not FileExists($sDirectoryName)) Then $sDirectoryName = @TempDir Link to comment Share on other sites More sharing options...
AlanB22 Posted April 23, 2014 Author Share Posted April 23, 2014 Hi Guys Thanks, for clarifying the operation of this function. I was using the tempfile() function to create a random unique filename which I was subsequently opening using fileopen($fn,10) to create the path and open the file if it did not exists. I have used the _tempfile function previously without a problem. All has become clear. Cheers Alan 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