Jump to content

Running compiled exe on command line with log path as parameter


Go to solution Solved by FredMellink,

Recommended Posts

$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 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)

userbar.png

Link to comment
Share on other sites

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

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

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