TheSaint Posted August 27, 2013 Share Posted August 27, 2013 (edited) $logFile = _FileCreate($CmdLine[1] & $CmdLine[2]) Are the two CmdLine elements parts of one path or two completely separate paths? Either way, you are missing a separator or joiner between ... either a space or backwards slash. So perhaps either --> $logFile = _FileCreate($CmdLine[1] & " " & $CmdLine[2]) or $logFile = _FileCreate($CmdLine[1] & "" & $CmdLine[2]) And what is $logFile supposed to be to you? In reality it is a success or failure return value (1 or 0) from the _FileCreate function, not a file. Edited August 27, 2013 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
FredMellink Posted August 27, 2013 Author Share Posted August 27, 2013 Hello John, This is the command line: "C:Program Files (x86)AutoIt3AutoIt3.exe" C:SnapsAutoITfrednotepad_exercise20130826.au3 C:FredTestNotepadLog.txt" Link to comment Share on other sites More sharing options...
FredMellink Posted August 27, 2013 Author Share Posted August 27, 2013 I like to run "mytestscript.exe C:myLogPathmytestlog.csv" and the script should create the path and file and append logging from the test steps. I like to know the easiest way to establish this. Thanks you all wizkids to help me Link to comment Share on other sites More sharing options...
hannes08 Posted August 27, 2013 Share Posted August 27, 2013 Hello Fred,if you use FileOpen("<yourfile>", 9) it automatically creates your directories and the file if it doesn't exist.This information can be found in the helpfile under FileOpen() as well. Take your time and look at the description of the parameters in the helpfile it is really usefull. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
JohnOne Posted August 27, 2013 Share Posted August 27, 2013 FileWrite($CmdLine[1], '') Will create path and file. 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...
hannes08 Posted August 27, 2013 Share Posted August 27, 2013 Well, I never really understood why you'll need a function to create a new empty file. :-D Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
FredMellink Posted August 27, 2013 Author Share Posted August 27, 2013 The following little test I run: #include <WindowsConstants.au3> #include <Date.au3> #include <File.au3> Global $answer, $timer, $Secs, $Mins, $Hour, $Time1, $Time2 If $CmdLine[0] = 0 Then Exit MsgBox(0, 'Command Line Info', 'No arguments passed') Else MsgBox(0, 'Command Line Info', 'There are ' & $CmdLine[0] & ' arguments passed') MsgBox(0, 'Command Line Info', 'The first argument is ' & $CmdLine[1]) $logFile = FileOpen($CmdLine[1],9) MsgBox(0, "Check logfile creation", 'The logfile is: ' & $logFile) _FileWriteLog($logFile, "version20130826") EndIf And I get the message "The first argument is C:FredTestNotepadLog.txt" and :The logfile is: 1 using commandline: "C:Program Files (x86)AutoIt3AutoIt3.exe" C:SnapsAutoITfrednotepad_exercise20130826.au3 C:FredTestNotepadLog.txt" Link to comment Share on other sites More sharing options...
FireFox Posted August 27, 2013 Share Posted August 27, 2013 And what's wrong with that?The FileOpen function returns a file handle as stated in the helpfile.Br, FireFox. Link to comment Share on other sites More sharing options...
FredMellink Posted August 27, 2013 Author Share Posted August 27, 2013 (edited) Yes, so how to result a file?? By using $logFile = FileOpen(" & $CmdLine[1] & ",9) ? commandline execution using $CmdLine is new to me. Edited August 27, 2013 by FredMellink Link to comment Share on other sites More sharing options...
JohnOne Posted August 27, 2013 Share Posted August 27, 2013 What is it you are expecting/wanting $logfile to contain? 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...
FredMellink Posted August 27, 2013 Author Share Posted August 27, 2013 I want to add logging output of each test step using _FileWriteLog($logFile, "test step" & $i & "result") Link to comment Share on other sites More sharing options...
FireFox Posted August 27, 2013 Share Posted August 27, 2013 Your first syntax was correct:$logFile = FileOpen($CmdLine[1], 9)PS: to post your code, use the autoit tags. Link to comment Share on other sites More sharing options...
JohnOne Posted August 27, 2013 Share Posted August 27, 2013 If the file is not being created and written to then you might be trying to write to a location which needs admin rights. Put this in code #RequireAdmin Anywhere, but top is usual. 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...
Solution FredMellink Posted August 27, 2013 Author Solution Share Posted August 27, 2013 Thanks John... and all others, Now it works 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