Jump to content

adamchapman

Active Members
  • Posts

    47
  • Joined

  • Last visited

Everything posted by adamchapman

  1. I'm trying to scrape the live score of a soccer game contained within the html source snippet below: ... <div class="bf-col-19-24 inplay" ng-class="sportsHeaderCtrl.data.event.status == 'Finished' ? 'finished' : 'inplay'" ng-if="sportsHeaderCtrl.data.hasScores"><!----><ng-include src="'app/modules/sports-header/source/views/partials/sports/avb.html'"><!----><div ng-if="sportsHeaderCtrl.data.hasScores"><div class="title avb"><span title="LD Alajuelense">LD Alajuelense</span> <span class="score" ng-class="{ finished: sportsHeaderCtrl.data.event.status == 'Finished' }">0-1</span> <span title="CD Olimpia">CD Olimpia</span></div></div><!----><!----></ng-include><p class="time-elapsed inplay" ng-class="{ inplay: sportsHeaderCtrl.data.event.status !== 'Finished' }"><!----> <!----><span ng-if="!sportsHeaderCtrl.data.moduleConfig.eventStatus[sportsHeaderCtrl.data.event.status]">50'</span><!----><halftime-fulltime status="sportsHeaderCtrl.data.event.status" score="sportsHeaderCtrl.data.event.score" eventtypeid="sportsHeaderCtrl.data.event.eventTypeId"><!----><span class="halftime-fulltime" ng-if="data.results">(<!----><span ng-repeat="result in data.results">HT 0-1</span><!---->)</span><!----></halftime-fulltime></p></div> ... I can see that the score (1-0) is contained in the <span class="score"> element. Copying the method from rootx's post here, I have: Local $oIE = _IECreate("https://www.betfair.com/exchange/plus/football/market/1.133040513?group-by=time", 0, 1 ,1,0) $target = "" $tags = $oIE.document.GetElementsByTagName("span") ConsoleWrite("-- $oIE.document.GetElementsByTagName --" & $tags & @CR) For $tag in $tags $class_value = $tag.GetAttribute("class") consolewrite("class " & string($class_value) & @CRLF) If string($class_value) = "score" Then $target = $tag ConsoleWrite("Tag Found " & $target.outerText & @CRLF) ExitLoop EndIf Next _IEQuit ($oIE) Unfortunately, $tags appears to be empty because the first consoleWrite command only prints "-- $oIE.document.GetElementsByTagName --", with nothing else on the row. If anybody can offer a hint to get this working it would be really helpful. Thanks!
  2. Thanks Universalist, I'd not seen that method before. As impressive as that is, I have a problem getting that string from the html via Autoit. That encoded string is not in the original html that builds the chart - instead, the encoded png string is constructed by calling a Google-API function "getImageURI()" once the chart has been drawn in the browser. I've tried opening the html of the chart page using _IELoadWait and then get the modified html with _IEDocReadHTML, but am having no luck. I expected the _IEDocReadHTML function would return a string containing the encoded png. The html that constructs the chart is given below: <html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", '1', {packages:['corechart']}); google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Element', 'Density', { role: 'style' }], ['Copper', 8.94, '#b87333', ], ['Silver', 10.49, 'silver'], ['Gold', 19.30, 'gold'], ['Platinum', 21.45, 'color: #e5e4e2' ] ]); var options = { title: "Density of Precious Metals, in g/cm^3", bar: {groupWidth: '95%'}, legend: 'none', }; var chart_div = document.getElementById('chart_div'); var chart = new google.visualization.ColumnChart(chart_div); // Wait for the chart to finish drawing before calling the getImageURI() method. google.visualization.events.addListener(chart, 'ready', function () { chart_div.innerHTML = '<img src="' + chart.getImageURI() + '">'; console.log(chart_div.innerHTML); }); chart.draw(data, options); } </script> </head> <body> <div id='chart_div'></div> </body> </html> _IEDocReadHTML simply returns "<html><head></head><body></body></html>". I wonder if I could invoke the function which gets the encoded png as a string from autoit, and get the response back in the autoit environment rather than trying to read it from html?
  3. I'm trying to automate a process to save my Google charts (built with the goggle charts API in html code) as png images. As described at (https://developers.google.com/chart/interactive/docs/printing), you can get an encoded png as a string through the google API, although I guess when accessed through the browser address bar it is the browser that decodes the string and displays an image. I've tried encoding the chart and saving it with Inetget, although the code below returns an "unterminated string" error on the line the string is defined on, before reaching the inetget call. #include<Inet.au3> $imageUri = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA7AAAADICAYAAADRJA3zAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABfGSURBVHhe7d1NjB1XgS/w8pMm8zTECfNiWyQgyGBbiuNhg8OHkLGfkExYwALhRT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V4O6rL3n3mbt2nu6GiuZIcQAAABUQYAFAACgCoYQL9CxY8eaycnJrtY0Bw8ebHbs2NHVmmbXrl3dvabZunVrc+TIka4GALB6GUJMzQwhroce2AVIcD19+nRz6tSptiS8Hjp0qDl//nw7/fDhw83OnTunp1++fHlG2AUAAGDxBNgF2L17d3PixImu1rQ9r+vXr29eeOGFtv773/9+Rm9swuwf/vCHrgYAAMA4BNglsGHDhvb2ypUrzf3339/ej/vuu6+5evVqVwMAAGAcAuwYzpw504bW9LqWYcRDGUYMAADA+FzEaQy5YFO5iFMC7MTERHP06NFm8+bN7fSc/3ry5MkZw47n69y5c909AICV7+6739asnSpQo+uv/615faoMbdu2rbvHSiHALtL+/fubLVu2NPv27eseuRlohwH27NmzrkQMAKx6rkJMzVyFuB6GEC9CguowvEYu6HTp0qWu1jTXrl1r1q1b19UAAAAYhwC7ABkmnPCaqxEPw2s8/PDD7XmxRf7lzkMPPdTVAAAAGIchxAuQ//OaUDpUAm3Ca/4vbLF161bDhwG46T//z1T5+78hUIV/2jlV/ndXGc0QYmpmCHE9BFgAuBOuPjVVvtZVoDLrptruuie7ymgCLDUTYOthCDEAAABVEGABAACoggALAABAFQRYAAAAqiDAAgAAUAUBFgAAgCoIsAAAAFRBgAUAAKAKAiwAAABVEGABAACoggALAABAFQRYAAAAqiDAAgAAUAUBFgAAgCoIsAAAAFRBgAUAAKAKAiwAAABVEGABAACoggALAABAFQTYRTp//nyzZ8+ernZTHtu1a9eMMjk52U0FAABgHALsIiSoTkxMdLVbLl261GzdurU5derUdNm9e3c3FQAAgHEIsAt0+PDhNrwmqA5dvny5WbduXVcDAABgKQmwC7R+/fq2Z3X79u3dI7dcu3atnQ4AAMDSE2AXaN++fd29v/fiiy+257yW81/379/fTQEAAGBcAuwSyhDinPNazn/dsmVLO+QYAACA8a25MaW7zwKkp/XkyZPNiRMnukf+3nzmmc25c+e6ewCsBvf/w/HmgbuOdzWoyytv7G0u/fferjba3Xe/rVk7VaBG11//W/P6VBnat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W7Or8q8ZVpZrh4rllvaXnr/+xdxSvubb49pzm+N/m8g7TohtiwvQSAX84CVIO0zbb60z9Lms80tfwOG2+SE1PwmhrJ9788312gcWG7l+hmlPUYCbblORw62py3nKsQLkd9LtuNZZpblOgasRmtuTOnuw1tKNu7DQFukZzdH9fMHBgAAWBn0wAIAAFAFARYAAIAqGEIMAABAFfTAAgAAUAUBFgAAgCoIsAAAAFRBgAUAAKAKAiwAAABVEGABAACoggALAABAFQRYAAAAqiDAAgAAUAUBFgAAgCoIsAAAAFRBgAUAAKAKAiwAAABVEGABAACoggALAABAFQRYAAAAKtA0/x9G19ZTQyImEwAAAABJRU5ErkJggg==" $hDownload = InetGet($imageUri, 'chart_image.png') Perhaps the encoded png string is just too long to handle. If anybody can suggest a more elegant way to perform the task of invoking the javascript function that encodes the chart into a png, and then save that png to a local file I'd love to hear it. In my limited experience I guess this all needs to be performed through a web browser, and using the IE or Inet functions in autoit is the only way I can imagine.
  4. I've reverted back to the old version - the icons are now fine and the exe is back down to 8 kB in size
  5. I've just updated to Autoit v3.3.10.2 and the compiling seems a bit odd - My compiled programs are now twice the size they were before (one script went from 8kB compiled to 15 kB compiled with new version) Also my compiled exe's have no icons. When I compile in the SciteLite version that ships with the AutoIt installer, there is no verbose text telling me what happened in the compilation, It just says the time taken to run in the standard blue text output. I was running "Scite for AutoIt" yesterday, but installed it before installing the new Autoit version. The version of AutoIt I was running up until today was v3.3.8.1 If anybody can help or has seen similar behaviour could let me know I'd appreciate it sincerely
  6. My mistake, the password field was actually 5 not 6. Hope this helps any future-folk reading this. Future!
  7. I'm trying to make an auto-login script for betfair.com. In the code below I've read and printed out the id of each form element - this helped me find the username and password fields. #include<IE.au3> $oIE = _IECreate("http://www.betfair.com/exchange") $oForms = _IEFormGetCollection($oIE) $formcount = 0; For $oForm In $oForms $formcount = $formcount+1 $newID = $oForm.id ConsoleWrite(@CRLF & 'formcount = ' & $formcount & @CRLF) ConsoleWrite('New ID = ' & $newID & @CRLF) If $formcount = 2 Then ; login form is the 2nd form on the webpage Local $oQuery = _IEFormElementGetCollection($oForm, -1) $elementcount = 0 For $oQuery2 In $oQuery ; read through the ogin form ; print details of each element of form $elementcount = $elementcount + 1 ConsoleWrite('$elementcount = ' & $elementcount & @CRLF) $a = _IEFormElementGetValue( $oQuery2 ) ConsoleWrite('$a = ' & $a & @CRLF) If $elementcount = 4 Then ; username field _IEFormElementSetValue( $oQuery2 ,"MYUSER") EndIf If $elementcount = 6 Then ; password field _IEFormElementSetValue( $oQuery2 ,"MYPASS") EndIf Next EndIf Next However, after the script has run, if I click on the "password" field in the webpage, the string "MYPASS" disappears. Does this mean I didn't set the form element value correctly? The html code for the form is a bit complex, perhaps someone can see something in it that I don't understand well enough to spot.
  8. Wow that was fast - thanks very much
  9. I'm trying to make a clickable link in a GUI with the following code: #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) $hGUI = GUICreate("Test", 300, 200) $label = GUICtrlCreateLabel("www.autoitscript.com", 50, 80, 200, 30) GUICtrlSetFont(-1, 16, 100, 4) GUICtrlSetColor(-1, 0x000000) GUICtrlSetCursor($label,0) GUISetOnEvent($label, "labelFun") GUISetState() ; set loop to make GUI persistent: While 1 sleep(100) WEnd ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func labelFun() ConsoleWrite("label clicked" & @CRLF) ShellExecute('http://www.autoitscript.com') ; open web site when clicking label EndFunc I don't even have a suggestion for why this doesn't work, I'm very confused! Thanks for any help offered
  10. - The call to "ObjCreate" returned zero, so was unsuccessful
  11. Thanks for the fast response water. I read that the object with version 3.0 of MSSOAP should be called "MSSOAP.SoapClient30", so updated my code and added an error handler: $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") $SOAPClient = ObjCreate("MSSOAP.SoapClient30") $SOAPClient.mssoapinit('http://localhost/Webservice/WS_HelloWorld.asmx?wsdl') #forceref $oErrorHandler, $oIEEvents ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite("err.number is: " & @TAB & $oError.number & @CRLF & _ "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ "err.description is: " & @TAB & $oError.description & @CRLF & _ "err.source is: " & @TAB & $oError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ "err.retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF) EndFunc ;==>_ErrFunc the error returned is: err.number is: -2147221005 err.windescription: Invalid class string err.description is: err.source is: err.helpfile is: err.helpcontext is: 15832000 err.lastdllerror is: 1008 err.scriptline is: 5 err.retcode is: 15834960 err.number is: 169 err.windescription: Variable must be of type 'Object'. err.description is: err.source is: err.helpfile is: err.helpcontext is: 15832000 err.lastdllerror is: 0 err.scriptline is: 8 err.retcode is: 15834960 Thanks for taking a look Adam
  12. @ptrex, Everytime I run the two lines of code below: $SOAPClient = objcreate("MSSOAP.SOAPClient") $SOAPClient.mssoapinit('https://api.betfair.com/global/v3/BFGlobalService.wsdl') I receive an error on the 2nd line: ==> Variable must be of type "Object". I guess the object The SOAP toolkit I downloaded and installed is from http://www.microsoft.com/en-gb/download/details.aspx?id=7043 . I wonder if this is the same version you are using, and if you had to add anything to your classpath in order to get this to run from autoit? I'm running WIndows 7 Home Premium, service pack 1 if that clarifies anything. I you have any ideas to get this running I'd be very grateful Adam
  13. I can't figure out why the commands are blank in both posts above, but I've made a batch file with the command in it... aws s3 cp C:UsersAdministratorDesktopvpntimeout_text.txt s3:/clustertesting/vpntimeout_text.txt If I double-click the batch file it runs perfectly. However even using ShellExecuteWait("mybatch.bat") doesn't work from autoit. Autoit Doesn't appear to wait for a response before closing the process. This is very odd
  14. the editor on this forum is acting strange. my command prompt is : aws s3 cp C:UsersAdministratorDesktopvpntimeout_text.txt s3:/clustertesting/vpntimeout_text.txt and the response is: upload: myfolder/file1.txt to s3:/mybucket/myfolder/file1.txt but nothing comes back in autoit
  15. I have installed the amazon command-line interface (http://aws.amazon.com/cli/) and have it working in my cmd prompt dos window. For example, If I set the working directory to C:UsersAdministrator and run the command below to upload a file to the S3 service: aws s3 cp C:UsersAdministratorDesktopvpntimeout_text.txt s3:/clustertesting/vpntimeout_text.txt I get the response: upload: myfolder/file1.txt to s3:/mybucket/myfolder/file1.txt However, trying to replicate the same command in Autoit with : --------------------------------------------------------------------------- #include <Constants.au3> ;$ami_ID = "ami-1a0d912a" ;$n=1 ; Command: ;$DOS = Run(@ComSpec & ' /k' & "aws ec2 run-instances " & $ami_ID & " -n " & $n & " -k windows --instance-type t1.micro -g quicklaunch-1", "", "", $STDERR_CHILD + $STDOUT_CHILD) $workingdir = "C:UsersAdministrator" ConsoleWrite($DOS & @CRLF) Local $output While 1 $line = StdoutRead($DOS) If @error Then ExitLoop ConsoleWrite($line) Wend ConsoleWrite($line & @CRLF) ConsoleWrite("error = " & @error & @CRLF) --------------------------------------------------------------------------- The dos window flashes up and a PID is returned in $DOS, and the error value is zero. However, unlike my command performed in the command prompt, the autoit version does not upload my file to S3 and does not print a response. Does anyone see what I've done wrong in Autoit? From what I can tell me code should be performing the same command sorry I haven't used the code editor for this post- it failed to work in two browsers o I ended up just pasting the raw text
  16. Found a solution, although fairly long-winded: ocal $hDownload = InetGet("http://169.254.169.254/latest/meta-data/instance-id","localID.txt",4,1) ConsoleWrite("reading ID..." & @CRLF) Do Sleep(250) Until InetGetInfo($hDownload, 2) ; Check if the download is complete. InetClose($hDownload) ; Close the handle to release resources. ; Now read that file in ASCII: $Localidf=FileOpen("localID.txt", 0); read mode, no write permission LOCAL ID FILE $instanceID = FileReadLine($LocalIDf, 1) ConsoleWrite($instanceID) ConsoleWrite(@CRLF) FileClose($LocalIDf) Writing the page text to a file with InetGet while forcing ASCII in the INetGet options, than reading the file back works fine. Strange how InetRead didn't act the same way though
  17. I'm using InetRead to access a machine's ID on the amazon ec2 service. to access the string containing the machine's ID I'm using the line: $instanceID = InetRead("http://169.254.169.254/latest/meta-data/instance-id",4) ConsoleWrite($instanceID) ConsoleWrite(@CRLF) $instanceID = StringLeft($instanceID,10) ; use the first ten characters ConsoleWrite($instanceID) ConsoleWrite(@CRLF) I think the "4" option in the InetRead function call should force ASCII format, but it must be struggling. The first ConsoleWrite returns: i-aa0fa69e (which is the properly formatted machine ID) and the second ConsoleWrite returns: 0x692D6161 which appears to be the hex equivalent of the original string. Does any body know how I can force the $instanceID variable to be an ASCII string? This one is really confusing me
  18. Sorry for the late reply - I noticed that the string"HKLMSoftwareMicrosoftWindows NTCurrentVersionWinLogon" I had to be changed to "HKEY_LOCAL_MACHINE...) and tried that a few times. I checked the registry each time but no DefautUserName was ever visible. I've started using Shawn Remerdes' solution from https://forums.aws.amazon.com/thread.jspa?messageID=315613 . It's working fine today and I think it is a bit more secure too, as the "autologon" program he mentions also encrypts the username and password in the registry. Thanks for your help storme, I really appreciate the time you put in but I've found a solution that works for me now. For anybody reading this in the future: Autologon download -- http://technet.microsoft.com/en-us/sysinternals/bb963905
  19. Thanks for the fast response John, Unfortunately I've had no luck so far... I've tried your method by running your "Autologon" function, then restarting the server. If it worked I expected to see icons for the programs in my startup folder in the task bar when I login manually (with rdp) 10 minutes after restarting ( I figure 10 minutes is plenty of time for these programs to initiate). Next I setup task scheduler to run a compiled version of rudi's RunAsWait("Administrator", "DomainName", "Password", 0, "Autolog.exe /U /MSDom:bau /MSUsr:DomainUser /MSPass:password /Mode:1") method. Again logging in manually the startup folder programs had not been initiated by the time I arrived. I wonder if it is logging in automatically with both methods, but still not running anything from the startup folder, although I have no idea how to check
  20. Does your "AutoLogon" function cause the machine to log in when the function is called, or does it set credentials to automatically log in next time the machine is rebooted? I'm trying to use it to allow my application to run on a server as if somebody has logged in already, to work around the issue here: https://forums.aws.amazon.com/message.jspa?messageID=481709#481709
  21. This is a nightmare. I've tried 4 different methods for exchanging files with the Amazon S3 service, and am yet to find one that I can get to work!
  22. Thanks for uploading this, I am personally interested in your automation of the s3.exe tool. Have you used the S3 put function recently? because I consistently receive a 403 error using S3 put. Just want to check if I'm not the only one seeing this problen
  23. Hi Cusem, did you manage to use the "list" command using the s3 tool from autoit? my code below returns nothing: #include <Constants.au3> dim $cmdOUT $PID = run("s3.exe list",@TempDir,@SW_MAXIMIZE,$STDOUT_CHILD) ProcessWait($PID) While 1 $line = StdoutRead($PID) If @error = -1 Then ExitLoop $cmdOUT &= $line Wend $rawIPC = $cmdOUT MsgBox(1,"$cmdOUT=",$rawIPC)
  24. This is unrelated to the topic I posted earlier today. I'm using inetget to retrieve a file online. sometimes this works, sometimes it doesn''t work but inetgetinfo gives a non-zero error number. Atleast I have an idea about what went wrong in that case. However, the most confusing of all is I sometimes get no error message but the file does not appear in my target directory. my code is pasted below: $i=99999 $keyword = "amazon" $hDownload = InetGet("http://www.google.com/trends/fetchComponent?q=" & $keyword & "&geo=US&cid=TIMESERIES_GRAPH_0&export=3&date=today%203-m&cmpt=q", @DesktopDir & "data_" & $i & ".txt",0,1) $inetgettime=0 Do Sleep(250) $inetgettime=$inetgettime+0.25 If $inetgettime>10 Then $timedout=1 InetClose($hDownload) ConsoleWrite("timed out waiting for download " & $inetgettime & @CRLF) $timedout=1 ExitLoop EndIf Until InetGetInfo($hDownload, 2) ; Check if the download is complete. $err = InetGetInfo($hDownload) ConsoleWrite("internet error = " & $err[4] & @CRLF) When the strange non-saving while $err=0 behaviour occurs, it is too fast for my 10 second timeout loop. The script takes about 0.9 seconds to run when the behaviour I described above is shown. Does anybody have an idea as to the cause of this?
×
×
  • Create New...