legend Posted October 20, 2012 Share Posted October 20, 2012 Hi. Let's say I have 5000 characters in 1 line, then i get this error "Unterminated string" It seems autoit can't handle that, is it by any way possible to make it able to handle it? I now I can just make a new line, but in this case I want to have 5000 characters in 1 line Link to comment Share on other sites More sharing options...
Developers Jos Posted October 20, 2012 Developers Share Posted October 20, 2012 Show us the code you are having issues with. 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...
FireFox Posted October 20, 2012 Share Posted October 20, 2012 (edited) Hi, You have to split your data to X chars, I don't remember how much. Global $sData = "blabla..." & _ ;split here "blabla" ;continue here at the next line Edit : After checking it's 4094 chars max per line. Br, FireFox. Edited October 20, 2012 by FireFox Link to comment Share on other sites More sharing options...
legend Posted October 20, 2012 Author Share Posted October 20, 2012 (edited) here's my script, it converts to hex. (1400) defines how many characters per line it should be. So if there's too many lines, it can't handle it, and if there's too many characters in a line, it also can't handle it. $file = FileOpenDialog('Open the the file', @ScriptDir, 'script (*.exe)', 1) $file2 = FileSaveDialog('Save the file Autoit script', @ScriptDir, 'script (*.au3)') _CheckExt($file2, 'au3') $hfile = FileOpen($file, 16) $hfile2 = FileOpen($file2, 2) FileWrite($hfile2, 'Global $sModule = "0x"' & "& _" & @CRLF) While 1 $data = FileRead($hfile, 1400); how many chars we read at the time $data = FileRead($hfile)will read whole file If @error Then ExitLoop FileWrite($hfile2, '"' & StringTrimLeft($data,2) & '" & _' & @CRLF) WEnd MsgBox(0, 'Done!!', 'completed') Func _CheckExt(ByRef $s_file, $s_ext) If StringRight($s_file, StringLen($s_ext)) <> $s_ext Then $s_file &= '.' & $s_ext EndFunc ;==>_CheckExt Func _CheckCapital(ByRef $s_file, $s_cap) If StringLeft($s_file, StringLen($s_cap)) <> $s_cap Then $s_file = $s_cap & $s_file EndFunc ;==>_CheckExt?oÝ?÷ FileWriteLine($hfile2, "''") I want it so, even you set it to 5000, then it can handle it, but i'm not sure it's actually possible Edited October 20, 2012 by legend Link to comment Share on other sites More sharing options...
FireFox Posted October 20, 2012 Share Posted October 20, 2012 (edited) if there's too many lines, it can't handle it I think by splitting the lines too it works : Global $sData = "blabla..." & _ "blabla" $sData &= "blabla" ;continue here Just check how many lines until the error. Br, FireFox. Edited October 20, 2012 by FireFox Link to comment Share on other sites More sharing options...
Developers Jos Posted October 20, 2012 Developers Share Posted October 20, 2012 Looks like you always finish the last line with an _ at the end which obviously will trigger the error. maybe something like this works: While 1 $data = FileRead($hfile, 1400); how many chars we read at the time $data = FileRead($hfile)will read whole file If @error Then ExitLoop FileWrite($hfile2, '"' & StringTrimLeft($data, 2) & '" & _' & @CRLF) WEnd FileWrite($hfile2, '""') 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...
legend Posted October 20, 2012 Author Share Posted October 20, 2012 (edited) the thing is, autoit supports up to 4094 chars per line, but I want to exceed that number, so I can use example: 20000 chars per line. so i tried to set the number down, from 2000 to 50 chars per line, but then instead of the error: unterminated string, I get the error: yacc stack overflow, because now there's too many lines for autoit to handle. Edited October 20, 2012 by legend Link to comment Share on other sites More sharing options...
Developers Jos Posted October 20, 2012 Developers Share Posted October 20, 2012 the thing is, autoit supports up to 4094 chars per line, but I want to exceed that number, so I can use example: 20000 chars per line. so i tried to set the number down, from 2000 to 50 chars per line, but then instead of the error: unterminated string, I get the error: yacc stack overflow, because now there's too many lines for autoit to handle.Do you really think this is the best approach for including data for your program? Why not simply FileInstall() the data?Anyway, you can also opt for not running au3check, but you will still have to fix your code to ensure it runs with autoit3. 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...
BrewManNH Posted October 20, 2012 Share Posted October 20, 2012 If you need a very long string, longer than 4094 characters, you need to split it so that AutoIt won't complain. ; this is pseudo code, probably won't run when I'm done with it $String = "abcdefg...." ; up to the line limit of 4094 characters $String &= "a1b1c1d1e1f1g1..."; up to the line limit of 4094 characters ; you now have a string twice as long as the line limit that autoit can handle, yet it is still one long string. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Chance Posted October 20, 2012 Share Posted October 20, 2012 error: yacc stack overflow, because now there's too many lines for autoit to handle.I gotten this before when including some picture as a string. never figured it out until I saw that someone said that you have to break it down into variables the way firefox just showed you apparantly. Link to comment Share on other sites More sharing options...
legend Posted October 20, 2012 Author Share Posted October 20, 2012 (edited) then i would have around maybe 100000 variables thx for you help Edited October 20, 2012 by legend Link to comment Share on other sites More sharing options...
BrewManNH Posted October 20, 2012 Share Posted October 20, 2012 then i would have around maybe 100000 variables thx for you help What's that in reference to? Because the techniques that FireFox posted and the one I posted after his (missed his originally) doesn't use more than one variable to hold a string of any length up to what you computer's memory can handle. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
caleb41610 Posted October 21, 2012 Share Posted October 21, 2012 then i would have around maybe 100000 variables thx for you help You won't be using any more variables than you already are. Multi-Connection TCP Server 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