polkamatador Posted August 16, 2006 Share Posted August 16, 2006 (edited) Hi I got the following Problem:I want the user to enter a code: e.g. we say: abcdefgthen he should download with InetGet a file from my Server which is named abcdefg.txt(the insert code).That was my Idea.. but I got an Error when starting:Error: Variable must be of type Object...$code = String(InputBox("Enter","place your code")) InetGet("http://myhomepage/codes/" & $code.txt, @SysDir & "\something.txt")Somebody got an idea?Typolka Edited August 16, 2006 by polkamatador Link to comment Share on other sites More sharing options...
lod3n Posted August 16, 2006 Share Posted August 16, 2006 $code = InputBox("Enter","place your code") if $code <> "" then InetGet("http://myhomepage/codes/" & $code & ".txt", @SystemDir & "\"& $code &".txt") endif [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
DaleHohm Posted August 16, 2006 Share Posted August 16, 2006 (edited) Redundant reply Dale Edited August 16, 2006 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
polkamatador Posted August 17, 2006 Author Share Posted August 17, 2006 (edited) Thx for the fast reply,but I hit the next problem :/I'd like to check the .txt for 2 words:Word1 = alphaWord2 = betathis the words.txt******words.txt ******alphabetaalphabetaalphaalphaalphaalphabeta********************I'd like to check if the word alpha is more than two times in a rowas in the example (4 times).I tryed it with:$file= FileOpen(@TempDir & "\words.txt", 0) $count = 0 While 1 $read= FileReadLine($file, $i) If $read= "alpha" Then $count =+1 EndIf If $read= "beta" Then $count = 0 EndIf If $count = 3 Then MsgBox(0, "Row!!!", $i) Endif $i += 1 Wend ; other codeBut he run's the loop 2 times, and then continues with the main code :/ Edited August 17, 2006 by polkamatador Link to comment Share on other sites More sharing options...
lod3n Posted August 17, 2006 Share Posted August 17, 2006 slightly modified from the help file (latest beta) #include <file.au3> Dim $aRecords If Not _FileReadToArray(@TempDir & "\words.txt",$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf $betacount = 0 For $x = 1 to $aRecords[0] if stringinstr($aRecords[$x],"beta" then $betacount += 1 Next msgbox(0,"",'Number of times "beta" was found in file: "'&$betacount) if $betacount > 2 then ; do something else ; do something else endif [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
polkamatador Posted August 17, 2006 Author Share Posted August 17, 2006 (edited) thx seems very nice but I got a problem:is it right that you missed here a ")" ? if stringinstr($aRecords[$x],"beta") then $betacount += 1and the code always returns 0 betacount :/ don't know whats wrong,TyPolka Edited August 17, 2006 by polkamatador Link to comment Share on other sites More sharing options...
lod3n Posted August 17, 2006 Share Posted August 17, 2006 No, it is not right that I missed there a ")" I don't know why it the betacount does not increase. Put this in the top of the script: #include <Array.au3> That will ensure that it has actually loaded the file. You're sure that it's in your Temp folder? [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] 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