bostjan35 Posted February 20, 2019 Share Posted February 20, 2019 Hey all, Could someone please help n00b with this? I was searching everywhere, but couldn't find a proper solution. I'm trying to read random line from text file and insert it into specific field (popup contact form, textarea). While reading func works, as well as inserting, I cannot put those two together, it always throws error parsing variable. Here's my messed code so far: 1. Reading random line $sFile = "myfile.txt" $lines = _FileCountLines($sFile) $sFile = FileOpen($sFile) $line = FileReadLine($sFile, Random(1, $lines, 1)) ;send line into textarea Send($line) ; 1st try ;ClipPut($line) ; 2nd try ;send("+{insert}") ; 2nd try FileClose($sFile) 2. Inserting Local $data2 = _IEGetObjByName ($oIE, "message[body]") _IEFormElementSetValue($data2, $line) ;replaced text with $line, added the whole thing before fileClose, but no luck :( Help, pls:) Link to comment Share on other sites More sharing options...
Billy Posted February 27, 2019 Share Posted February 27, 2019 Based on your "Inserting" segment it looks like you want to put the text into an Internet Explorer field. If that's the case you have more work to do staring with including the IE UDFs (IE.AU3) and creating an IE object (_IECreate). The first 2 entries in the help file for IE Management are helpful in getting your head around the topic. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 27, 2019 Developers Share Posted February 27, 2019 On 2/20/2019 at 4:33 AM, bostjan35 said: I'm trying to read random line from text file and insert it into specific field (popup contact form, textarea). What is the purpose for wanting to do this at all? 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...
Dwalfware Posted February 27, 2019 Share Posted February 27, 2019 (edited) Something like this? But not tested yet sorry. ON HOLD Fixed it a bit. Edited February 27, 2019 by Dwalfware Link to comment Share on other sites More sharing options...
Developers Jos Posted February 27, 2019 Developers Share Posted February 27, 2019 @Dwalfware, Maybe there was a reason for me asking that question.... and maybe it would have been wise to hold off posting your answer and wait for the OP to answer my question first? 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...
Dwalfware Posted February 27, 2019 Share Posted February 27, 2019 (edited) 9 hours ago, Jos said: @Dwalfware, Maybe there was a reason for me asking that question.... and maybe it would have been wise to hold off posting your answer and wait for the OP to answer my question first? Jos OK Chief, I see now what IT could be Bit too fast on my side, sorry went from first post to answer without checking the other posts. We learn. Edited February 27, 2019 by Dwalfware Link to comment Share on other sites More sharing options...
bostjan35 Posted March 7, 2019 Author Share Posted March 7, 2019 Hi, sorry for late reply. No special reason, just learning autoit. But I figured it out already, so thanks anyway. Take care:) Link to comment Share on other sites More sharing options...
Developers Jos Posted March 7, 2019 Developers Share Posted March 7, 2019 2 hours ago, bostjan35 said: Hi, sorry for late reply. No special reason, just learning autoit. But I figured it out already, so thanks anyway. Take care:) Yea right .... 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