foggy101 Posted March 25, 2010 Posted March 25, 2010 (edited) Hey, Im new to autoit and i was wondering if any one could give me a lead on how to copy text from a website to a excel file. if this helps, the website is www.cardbotmtgo.com i got the script to write the cards i need to search for i just need to know how to write the price of ea card in a excel file so that the card name is in column a and price in column 2 of the excel file. Thx for all your help Simon Edited March 25, 2010 by foggy101
Negative1 Posted March 25, 2010 Posted March 25, 2010 (edited) Hey,Im new to autoit and i was wondering if any one could give me a lead on how to copy text from a website to a excel file.if this helps, the website is www.cardbotmtgo.com i got the script to write the cards i need to search for i just need to know how to write the price of ea card in a excel file so that the card name is in column a and price in column 2 of the excel file. Thx for all your helpSimonHi Simon,First off I didn't check out the site that you posted however what i expect you need to read up on is two UDF'sExcel.au3 IE.au3Specifically you will need to use_IEBodyReadText --------------------------------------------------------------------------------Returns the Text inside the <body> tag of the document._IEBodyReadHTML --------------------------------------------------------------------------------Returns the HTML inside the <body> tag of the document.and _ExcelBookNew --------------------------------------------------------------------------------Creates new workbook and returns its object identifier._ExcelWriteCell --------------------------------------------------------------------------------Write information to a cell on the active worksheet of the specified Excel object._ExcelWriteArray --------------------------------------------------------------------------------Write an array to a row or column on the active worksheet of the specified Excel object.Hope this gets you started on your way. Just a tip: if you need further help give it a try yourself and then post your code that you have tried.Cheers -1 Edited March 25, 2010 by Negative1 What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.
foggy101 Posted March 25, 2010 Author Posted March 25, 2010 This is what i got so far, it searches for a card, and writes it in excel, now the only problem is that on that website its a javascript that gives the price i cant do a _IEBodyReadText, _IEBodyReadHTML at less what i am doing is not working, so is their a way to copy and paste the highlighted price and put it in excel? Thx a lot for your help!!! #include <Excel.au3> Local $oExcel = _ExcelBookNew() ;Create new book, make it visible Sleep(3000) WinActivate("[CLASS:MozillaUIWindowClass]", "") ;open Firefox so i can seach for card MouseClick("left", 400, 425) ;where the search box is Send("Armament Master") ;name of card Send("{enter}") ;enter to search _ExcelWriteCell($oExcel, "Armament Master", 1, 1) ;Write to the Cell Sleep(2000) MouseClick("left", 400, 425) Send("Arrow Volley Trap") Send("{enter}") _ExcelWriteCell($oExcel, "Arrow Volley Trap", 2, 1) ;Write to the Cell Sleep(2000) _ExcelBookSaveAs($oExcel, @DesktopCommonDir & "\m10excel.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
Negative1 Posted March 25, 2010 Posted March 25, 2010 as far as how to highlight the text that will be a little clunky but if the text is already highlighted use: send("^C") ;to copy the text highlighted $textString=clipget() ;to save the text stored in clipboard to a variable. -1 What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.
foggy101 Posted March 25, 2010 Author Posted March 25, 2010 (edited) as far as how to highlight the text that will be a little clunky but if the text is already highlighted use:send("^C") ;to copy the text highlighted$textString=clipget() ;to save the text stored in clipboard to a variable.-1what do i do with clipget()? i tried _ExcelWriteCell($oExcel, $ArmamentMaster, 1, 2) ;Write to the Cell but it opens the css page source of that website. it does add the price besides the name in excel, but how come it open the css page source? Edited March 25, 2010 by foggy101
foggy101 Posted March 26, 2010 Author Posted March 26, 2010 nvm got it to work, had a cap C so like CTRL+Shift C
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