UnknownUser Posted December 2, 2019 Posted December 2, 2019 Hello, I'm programming an automated email and have a line that is really long. I am using SciTE as my console. Here is that line in test. $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $aArray2[$i][3], $Subject, "This is a form letter meant for " & $aArray2[$i][1] &" "& $aArray2[$i][2]&"." & @CRLF & "The letters in "& $aArray2[$i][1] &" "& $aArray2[$i][2] & "'s first name are " & $aArray2[$i][4] &" " & $aArray2[$i][5] &" "&$aArray2[$i][6] &" "& $aArray2[$i][7] &" "&$aArray2[$i][8] &" "& $aArray2[$i][9] & @CRLF & chr(13) & "Thank you." & chr(13) & " ", $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) The body of the email that the $rc function is creating begins after $Subject and ends after chr(13) & " ",. That body is the primary cause of the length. When this goes live, I can easily see adding 3000+ characters to this line. Is there a line limit? Is there a way to wrap text in SciTE? Do you have a trick to break that line up into multiple lines for ease of coding and reading? "Ideally I would like to be able to type text like this " & @CRLF & "so that I could read what I am writing easily " & @CRLF & "without having to keep scrolling to the right or " & @CRLF & "to the left. Scrolling is quite a pain in the neck " & @CRLF & "and with 5000 characters, it might even become " & @CRLF & "a programming showstopper." I am not able to pass this entire string as a variable because this string contains variables embedded in a for loop. Thus, in so doing, I would multiplicate the loop. I'll take any help I can get!
seadoggie01 Posted December 2, 2019 Posted December 2, 2019 (edited) Yes, you can wrap text in AutoIt with & _ and continue on the next line like this. Also, you could simply read a file that you store locally and replace specific sequences... like "|username|" with the actual user's name with StringReplace. I use water's OutlookEx UDF and do something similar with an Outlook template email. Edit: That's a ampersand, a space, and an underscore there... kind of hard to see. Edited December 2, 2019 by seadoggie01 UnknownUser 1 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
Moderators JLogan3o13 Posted December 3, 2019 Moderators Posted December 3, 2019 (edited) Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team Edited December 3, 2019 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
RTFC Posted December 3, 2019 Posted December 3, 2019 This help page lists AutoIt limits and defaults; the 3rd entry specifies 4095 chars as max linelength in scripts. And welcome to the forums. UnknownUser 1 My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O
SlackerAl Posted December 3, 2019 Posted December 3, 2019 (edited) expandcollapse popup; one line using continuation string Global $sLongSingleLine $sLongSingleLine = "Ideally I would like to be able to type text like this " & @CRLF & _ "so that I could read what I am writing easily " & @CRLF & _ "without having to keep scrolling to the right or " & @CRLF & _ "to the left. Scrolling is quite a pain in the neck " & @CRLF & _ "and with 5000 characters, it might even become " & @CRLF & _ "a programming showstopper." MsgBox(0, "debug", $sLongSingleLine) ; basic approach avoiding character limit in single line Global $sLongString $sLongString = "Ideally I would like to be able to type text like this " & @CRLF $sLongString &= "so that I could read what I am writing easily " & @CRLF $sLongString &= "without having to keep scrolling to the right or " & @CRLF $sLongString &= "to the left. Scrolling is quite a pain in the neck " & @CRLF $sLongString &= "and with 5000 characters, it might even become " & @CRLF $sLongString &= "a programming showstopper." MsgBox(0, "debug", $sLongString) ; keeping the same basic format with the assumption that you want to iteratively parse variables later Global $sLongStringWithVars $sLongStringWithVars = "Ideally I would like to be able to type text like this " & @CRLF $sLongStringWithVars &= "so that I could read what I am writing easily " & @CRLF $sLongStringWithVars &= "without having to keep scrolling to $aArray2[$i][0] the right or " & @CRLF $sLongStringWithVars &= "to the left. Scrolling $aArray2[$i][1] is quite a pain in the neck " & @CRLF $sLongStringWithVars &= "and with 5000 characters, it might even become " & @CRLF $sLongStringWithVars &= "a programming showstopper." ; some trivial substitutions to make Global $aArray2[2][2] = [["Mr. Bob", "Yellow"], ["Mr. Fred", "Red"]] Global $sLongStringWithVars_subs ; making the substitutions later in your code ; you can see how the search string could also be constructed by the loop, but hard coded here for clarity For $i = 0 To 1 $sLongStringWithVars_subs = StringReplace($sLongStringWithVars, "$aArray2[$i][0]", $aArray2[$i][0]) $sLongStringWithVars_subs = StringReplace($sLongStringWithVars_subs, "$aArray2[$i][1]", $aArray2[$i][1]) MsgBox(0, "debug", $sLongStringWithVars_subs) Next Edited December 3, 2019 by SlackerAl UnknownUser 1 Problem solving step 1: Write a simple, self-contained, running, replicator of your problem.
Nine Posted December 3, 2019 Posted December 3, 2019 Also take a look at Opt ("ExpandVarStrings", 1). You can embed variables and macros directly into the string. It doesn't work with arrays tho. UnknownUser 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
UnknownUser Posted December 3, 2019 Author Posted December 3, 2019 Seriously thank you all so much! I'm always astonished at how smart the folks in the forum are here compared to other forums! ROCKON
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