davidsinko Posted July 22, 2019 Share Posted July 22, 2019 Until now I had no problems using .exe parameters. But when I write a script where I write something in .txt file, it won't work 🙄 For example: $var = $CmdLine[1] FileWrite("datamatrix.txt", $var) does not write anything to datamatrix.txt. Even if I try something like this: $var = $CmdLine[1] FileWrite("datamatrix.txt", "This is an example.") it doesn't write "This is an example." in datamatrix.txt. But if I remove "$CmdLine[1]" from my code then I can write whatever I want to the datamatrix.txt. Is this a bug?🙄  Thanks 😊 Link to comment Share on other sites More sharing options...
Developers Jos Posted July 22, 2019 Developers Share Posted July 22, 2019 (edited) How exactly do you start the program? Do you get an error when you run it? Jos Edited July 22, 2019 by Jos SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
davidsinko Posted July 22, 2019 Author Share Posted July 22, 2019 Well if I run .exe by double-clicking I get an error because there are no parameters. But if I enter a parameter through command line nothing happens - it just won't write to the file. I wrote a test program that shows the written parameter in a separate window, and that works. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 22, 2019 Developers Share Posted July 22, 2019 Ok... so show me the commandline you do and which directory you are in at that time. Jos SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
davidsinko Posted July 22, 2019 Author Share Posted July 22, 2019 Here is also my script: xml_modify.au3 Link to comment Share on other sites More sharing options...
Developers Jos Posted July 22, 2019 Developers Share Posted July 22, 2019 Your file is created in: "c:\users\david.sinko" as that is the workdir.  Jos SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
davidsinko Posted July 22, 2019 Author Share Posted July 22, 2019 Oh my god, THANK YOU. I tought the files are always being created there where the .exe file exists. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 22, 2019 Developers Share Posted July 22, 2019 22 minutes ago, davidsinko said: I tought the files are always being created there where the .exe file exists. No, "of course not", they are created in your case relative to the Working Directory (@workdir).  So just make the file fully qualified and you should be in business. The easiest way is: FileWrite(@scriptdir & "\datamatrix.txt", $var) Jos SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. 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