C2A Posted July 8, 2011 Share Posted July 8, 2011 hii have a list of names in a text file.the list looks like this:SmithAndersonClarkWrightMitchellI have to enter all these names in another file.Here is the process which i want to automate.Press the Tab button 3 times, then pick the name from list and press enter.After this next name needs to be added by the same process mentioned above.What i know is how to use loop and press the button automatically.but i dont know how 'll i pick names from list and then write them using the Send command.I need help with this. Link to comment Share on other sites More sharing options...
Zedna Posted July 8, 2011 Share Posted July 8, 2011 Probably something like this: FileDelete(@ScriptDir & '\data_out.txt') $data = FileRead(@ScriptDir & '\data_in.txt') $data = StringSplit($data, @CRLF, 1) For $i = 1 To $data[0] FileWrite(@ScriptDir & '\data_out.txt', @TAB & @TAB & @TAB & $data[$i] & @CRLF) Next Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Xandy Posted July 8, 2011 Share Posted July 8, 2011 (edited) This code will send selected text to the clipboard, and set $var= to clipboard #include <misc.au3> $var= 0 $done= 0 While $done= 0;tester loop if _IsPressed("1b") Then;when ESC down $var= getselection() ConsoleWrite($var) endif wend func getselection() send("^c");force user to store selection in clipboard return clipget();retrieve selection from clipboard endfunc edit: opps from file, my bad Edited July 8, 2011 by songersoft Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
C2A Posted July 8, 2011 Author Share Posted July 8, 2011 Thank you but sorry i was forgot to mention that i have to put these names on a web page. mistakenly i used "file" instead of "page". Tab button selects the field and then i have to send the name. Link to comment Share on other sites More sharing options...
Zedna Posted July 8, 2011 Share Posted July 8, 2011 Then use IE UDF. Details/Examples in Autoit's helpfile. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
C2A Posted July 8, 2011 Author Share Posted July 8, 2011 No, i dont want to use any UDF. i only have basic info about programming and i am very new to AutoIt. Help me correcting this: For $x = $Name_1 to $Name_x Send("{TAB}") Sleep(30) Send("{TAB}") Sleep(30) Send("{TAB}") Sleep(30) Send($Name) Sleep(30) Send("{Enter}") Next Are u understanding what i want to do? using UDF 'll be complicated for me. so, i want to use this simple way. i 'll learn the other methods later. Link to comment Share on other sites More sharing options...
C2A Posted July 8, 2011 Author Share Posted July 8, 2011 is this not possible what i said without UDF? Link to comment Share on other sites More sharing options...
Xandy Posted July 8, 2011 Share Posted July 8, 2011 (edited) Where are we getting the data from again? It is data in a file? or data in an application window? both what? and we output to a file, that may be used for html or something? I don't know who you are anymore! lol Edited July 8, 2011 by songersoft Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
C2A Posted July 8, 2011 Author Share Posted July 8, 2011 Data is in a text file and i have to put it online on a web page.Text file have names in it.like thisSmithAndersonClarkWrightMitchelland i have to put these names one by one on the page.the procedure ispress Tab button for 3 times and then Send the namethen hit enter and the same process goes again but with the new name, next name.that it.i know this is an invalid script but i need something like this:For $x = $Name_1 to $Name_xSend("{TAB}")Sleep(30)Send("{TAB}")Sleep(30)Send("{TAB}")Sleep(30)Send($Name)Sleep(30)Send("{Enter}")Next; another name next time Link to comment Share on other sites More sharing options...
Xandy Posted July 8, 2011 Share Posted July 8, 2011 I am writing the script. Now the name data file, is it just a list of names, line by line? Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
C2A Posted July 8, 2011 Author Share Posted July 8, 2011 yes, just names line by line. some names have figures and symbols too! Link to comment Share on other sites More sharing options...
smartee Posted July 8, 2011 Share Posted July 8, 2011 (edited) hi C2A,Welcome to the forums !!!Using UDFs are just as easy as using built in functions Just add #include <TheUDFScriptName.au3> at the top of your script and you're ready to go Using UDF's is the simple way, trying to do it all with sends is like trying to code in binary!!Clarify some things please, so we can better help you.What is the exact format of the file? Please give a small snippet like:abc def john maryWhat web page are you trying to automate? Please give its URL, its source or a relevant snippet of its source.Also, paste your code between AutoIt tags like [autoit]this[/autoit], it improves readability Good luck -smarteeEDIT:fixed tag ex Edited July 8, 2011 by smartee Link to comment Share on other sites More sharing options...
Xandy Posted July 8, 2011 Share Posted July 8, 2011 (edited) will load data file when F6 is pressed it will send formated data output ;change $PATH_TO_DATA_FILE to the path of your data file #include <misc.au3> $PATH_TO_DATA_FILE= @ScriptDir&"\namelist.txt" $namesmax= filecountlines($PATH_TO_DATA_FILE) dim $names[$namesmax] $file= FileOpen($PATH_TO_DATA_FILE);will open file at path for reading for $i= 0 to $namesmax-1 $names[$i]= FileReadLine($file) next FileClose($file) while _IsPressed("75")= False ;F6 trigger key presses wend for $i= 0 to $namesmax-1 Send("{TAB}") Sleep(30) Send("{TAB}") Sleep(30) Send("{TAB}") Sleep(30) Send($names[$i]) Sleep(30) Send("{Enter}") next func filecountlines($path) $count= 0 $file= FileOpen($path, 0) while @error= 0 FileReadLine($file) if @error<> 0 then exitloop $count= $count+1 wend FileClose($file) return $count EndFunc Edited July 8, 2011 by songersoft Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
C2A Posted July 13, 2011 Author Share Posted July 13, 2011 hi songersoft this is really a very good script, you saved my hours of work! Thank you so much. @smartee thanks for the welcome and suggestions, i will try to learn about udf. thanks all 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