scatterp Posted September 9, 2007 Posted September 9, 2007 HiI am new to autoit i have basic programing experience i was trying to make something that would take a long list of wordsand post them to https://adwords.google.com/select/TrafficEstimatorSandbox i want to select USD = 100 all languages all countrysand have the keyword list in a file (5000 keywords) i am trying to do this from command line $oIE = _IECreate ("https://adwords.google.com/select/trafficestimatorsandbox?cmd=TrafficEstimatorSandbox&keywords=" & $ret & "¤cy=USD&price=100&budget=&language=*&geoselection=&countryList=*", 0, 1, 1)i guess this needs changing to use IEFormSubmitand some how to take the values from a text file also needs code to download the csv instead of grabing text from the pagecan any one help me with thisnote i am in the freenode irc channelirc://irc.freenode.net/autoitexpandcollapse popup#include <GuiConstants.au3> #include <IE.au3> #include <String.au3> #include <array.au3> #include <File.au3> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GUICreate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $endf=0 $addtoold=0 ;<exefilename> -k test $ret = _ReadCmdLine("k"); ; ; read the command line parameters and return value ; ; options are separated by "-" ; Func _ReadCmdLine($switch) If $CmdLine[0] > 0 Then $Cmdopt = StringSplit($CmdLineRaw, "-"); options are separated by "-" ; _ArrayDisplay($Cmdopt, "options") ; start with 2 For $I = 2 To UBound($Cmdopt) - 1; $param = StringLeft($Cmdopt[$I], 1); "f" - 1 char ; value is now rest of switch $value = StringRight($Cmdopt[$I], StringLen($Cmdopt[$I]) - 1); take rest as value $value = StringStripWS($value, 3); ; found it ?? If $param = $switch And $value <> "" Then Return $value EndIf; value F? Next; all params EndIf Return 0; default EndFunc;==>_ReadCmdLine ;GuiCreate("Traffic Estimator", 220, 200,(@DesktopWidth-191)/2, (@DesktopHeight-157)/2) ;$button1 = GuiCtrlCreateButton("Run", 45, 160, 130, 20) ;GuiSetState() While 1 ; $msg = GuiGetMsg() Select ; Case $msg = $GUI_EVENT_PRIMARYUP ; Case $msg = $GUI_EVENT_CLOSE Or $endf = 1 ; ExitLoop Case $ret = $ret $oIE = _IECreate ("https://adwords.google.com/select/trafficestimatorsandbox?cmd=TrafficEstimatorSandbox&keywords=" & $ret & "¤cy=USD&price=100&budget=&language=*&geoselection=&countryList=*", 0, 1, 1) _IELoadWait ($oIE) $Line = _IEDocReadHTML($oIE) _IEQuit ( $oIE ) $Start = StringInStr($Line,"<TABLE class=report") $End = StringInStr($Line,"<TBODY></TBODY></TABLE>") - $Start $HtmlTag = StringMid($Line,$Start,$End) $Start = StringInStr($HtmlTag,"noWrap align=right>") + 18 $End = StringInStr($HtmlTag,"<TR bg") - $Start -11 $HtmlTag = StringMid($HtmlTag,$Start,$End) $HtmlTag = StringReplace($HtmlTag,"<TD noWrap align=right>","") $HtmlTag = StringReplace($HtmlTag,"<TD","") $HtmlTag = StringReplace($HtmlTag,"<TR","") $HtmlTag = StringReplace($HtmlTag,"<TH","") $HtmlTag = StringReplace($HtmlTag,"</TH","") $HtmlTag = StringReplace($HtmlTag,"</TR","") $HtmlTag = StringReplace($HtmlTag,"</TD","") $HtmlTag = StringReplace($HtmlTag,"<","") $HtmlTag = StringReplace($HtmlTag,">","") $HtmlTag = StringReplace($HtmlTag,"vAlign=center bgColor=#e8e8cf","") $HtmlTag = StringReplace($HtmlTag,"align=leftSearch Network Total","") $HtmlTag = StringReplace($HtmlTag,"noWrap align=right","") $HtmlTag = StringReplace($HtmlTag,"align=right ","") ;~ $HtmlTag = StringReplace($HtmlTag,"<TR>","<TR><TD>" & $Item & "</TD><TD>" & $Stroke & "</TD><TD>" & $Colour & "</TD><TD>" & $Size & "</TD><TD>M&S Requirement</TD>" & "<TD>"& _NowDate() &"</TD>") ;~ $Line = StringMid($Line,$Start+$End) ;~ $Html = $Html & $HtmlTag $file = FileOpen("test.txt", 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWriteLine($file, $HtmlTag & @CRLF) FileClose($file) Exit ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OpenPage;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;; EndSelect WEnd
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