ending Posted June 27, 2006 Share Posted June 27, 2006 I need to write a program that writes to a file with the information given by command line. I wrote one just fine and dandy, however it fails to work correctly when I pass large amounts of data to it. Here's the code: If $CmdLine[0] < 3 Then Exit(1) If $CmdLine[0] = 4 Then $strin = StringReplace($CmdLine[2],$CmdLine[4]," ") Else $strin = $CmdLine[2] EndIf $strout = StringSplit($strin,$CmdLine[3]);returns For $i = 1 To $strout[0] Step 1 FileWrite($CmdLine[1],$strout[$i] & @CRLF) Next Exit It will exit if there are less than 3 params in the command line. The params are as follow: [filepath] [text to write] [new line delimiter] {space delimiter} So I can pass: "C:\test.txt" "this_is_a_test~line2" "~" "_" And it will write: this is a test line2 However, if I pass a large amount of information to be written (for instance, html code) it screws up and doesn't write anything correctly. I don't know if there are any limits on how large a string can be that is passed by command line. I could, I guess...run the program several times with small amounts of data, however I could just use DOS instead if this was the case. The reason why I don't want to use DOS originally is because it pops up that shell console which isn't cool. Link to comment Share on other sites More sharing options...
GaryFrost Posted June 27, 2006 Share Posted June 27, 2006 just have the information written to a file then your script could read in the file. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Valuater Posted June 27, 2006 Share Posted June 27, 2006 this doesn't make sense If $CmdLine[0] < 3 Then Exit(1) If $CmdLine[0] = 4 Then.... if it is less than 3 ( 2 or 1 only )... then ask if it = 4 8) Link to comment Share on other sites More sharing options...
ending Posted June 28, 2006 Author Share Posted June 28, 2006 (edited) @qafrost The file isn't for the script to read. The script is exporting the file. I'm using another scripting engine that is totally seperate from AutoIt. I want to export it's variables to an HTML file that I have defined in the script with the file exporting program that I have written in AutoIt. The other scripting engine cannot write to files, however it can execute files and pass on command line parameters. @Valuater Thats because it requires 3 parameters, the 4th is optional. Hence the [] and {}. If the 4th param is present (as I said, the 4th param is the space delimiter) then parse out spaces. Then continue on. Edited June 28, 2006 by ending Link to comment Share on other sites More sharing options...
MHz Posted June 28, 2006 Share Posted June 28, 2006 I don't know if there are any limits on how large a string can be that is passed by command line.63 parameters4096 characters per parameterYou maybe able to use more parameters in AutoIt 3.1.1.0, but the AutoIt Beta enforces the specs above. Link to comment Share on other sites More sharing options...
ending Posted June 28, 2006 Author Share Posted June 28, 2006 Ok, that solves my problem. I'll have to use DOS then. Thanks MHz. 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