gripper Posted April 18, 2011 Share Posted April 18, 2011 I have a script that is suppose to go to a website and do a search function and save the results to a spreadsheet. It is supposed ot do the following Step 1 read and entry in an excel spreadsheet Step 2 transfer that cell content to a web interface and then do a search function Step 3 when the results are back it should save the results as a csv file in a predetermined directory / path Step 4 not open excel then loop onto the next search item Steps 1 and 2 work fine I am having problems doing the "Save As" function to the correct path and file name and also the excel sheet is opening and messing things up. My goal is to have it save to the correct location and correct file name and not open excel results at all. I am new user of autoit and this is my stab at this. ************************************************** #Include <Excel.au3> ;YOU MAY CHANGE THIS: $sExcelFileName = "keyword Seed.xlsx" ; SHOULD BE SAVED IN THE SAME DIRECTORY AS THE AUTOIT SCRIPT $sRootSaveDir = "c:\raw_keywords" ; THIS DIRECTORY SHOULD EXIST. DO NOT ADD TRAILING SLASH $sExcelFilePath = @ScriptDir & "\" & $sExcelFileName If Not FileExists($sExcelFilePath) Then MsgBox(16 + 4096 + 262144,"ERROR: Input File Missing", $sExcelFilePath & " does NOT exists") Exit EndIf $oExcel = _ExcelBookAttach($sExcelFilePath) If @error = 1 Then $oExcel = _ExcelBookOpen($sExcelFilePath, 1) If @error = 1 Then MsgBox (16 + 4096 + 262144,"ERROR","Cannot open " & $sExcelFilePath & "!") Exit EndIf EndIf $nExcelBaseColumn = 1 $nExcelRow = 2 $sBaseWord = StringStripWS(_ExcelReadCell($oExcel, $nExcelRow, $nExcelBaseColumn),7) While StringLen($sBaseWord) > 0 $nExcelSeedColumn = 2 $sSeedWord = StringStripWS(_ExcelReadCell($oExcel, $nExcelRow, $nExcelSeedColumn),7) While StringLen($sSeedWord) > 0 $sCSVFilePath = $sRootSaveDir & "\" & StringLower(StringReplace($sBaseWord & "_" & $sSeedWord & ".csv"," ","_")) ;YOUR WEB FORM SEARCH AND EXPORT SCRIPT starts HERE: mouseclick("left", 328,405,1) send("{F5}") sleep(15000) mouseclick("left", 328,405,1) send($sSeedWord) ; send("gold mining") send("{tab 4}") send("{ENTER}") ;search button sleep(25000) ;sleep while searching send("{TAB 2}") send("{ENTER}") ;download button send("{DOWN}") ;choose "all" send("{ENTER}") sleep(1500) send("{TAB}") ;download pop up window sleep (1000) send("{ENTER}") sleep(10000) WinWaitActive("File Download", "&Save") sleep(1500) send ($sCSVFilePath) sleep(1500) send ("!s") ;sleep(2000) ;send("{enter}") ;YOUR WEB FORM SEARCH AND EXPORT SCRIPT ends HERE: $nExcelSeedColumn += 1 $sSeedWord = StringStripWS(_ExcelReadCell($oExcel, $nExcelRow, $nExcelSeedColumn),7) WEnd $nExcelRow += 1 $sBaseWord = StringStripWS(_ExcelReadCell($oExcel, $nExcelRow, $nExcelBaseColumn),7) WEnd Link to comment Share on other sites More sharing options...
enaiman Posted April 18, 2011 Share Posted April 18, 2011 Well, I got almost fooled by your request and even started looking for a solution ... then I found this:send($sSeedWord) ; send("gold mining")You should be aware that game automation is a forbidden topic around here - there is a big announcement at the top of every forum section: http://www.autoitscript.com/forum/forum-2/announcement-12-game-bots-and-automation/If you weren't aware, now you are; and any further argument, posts about this subject won't do anything but make things worse. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
gripper Posted April 19, 2011 Author Share Posted April 19, 2011 This is absolutely not game automation. It is a script I built that goes to a website and searches keywords to give me various ideals for creating new websites. I am not a gamer and would not know where to start. I understand your concern though I have found my issue last evening and was able to fix it. This has been a great learning experience for me. Link to comment Share on other sites More sharing options...
enaiman Posted April 19, 2011 Share Posted April 19, 2011 No problem. Glad you found the solution and glad I've been wrong about you. Good luck, SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) 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