Jump to content

download a file based on userspecific inserts


Recommended Posts

Hi :P

I got the following Problem:

I want the user to enter a code: e.g. we say: abcdefg

then 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?

Ty

polka

Edited by polkamatador
Link to comment
Share on other sites

Redundant reply

Dale

Edited 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

Thx for the fast reply,

but I hit the next problem :/

I'd like to check the .txt for 2 words:

Word1 = alpha

Word2 = beta

this the words.txt

******words.txt ******

alpha

beta

alpha

beta

alpha

alpha

alpha

alpha

beta

********************

I'd like to check if the word alpha is more than two times in a row

as 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 code

But he run's the loop 2 times, and then continues with the main code :/

Edited by polkamatador
Link to comment
Share on other sites

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

thx :P

seems very nice but I got a problem:

is it right that you missed here a ")" ?

if stringinstr($aRecords[$x],"beta") then $betacount += 1

and the code always returns 0 betacount :/

don't know whats wrong,

Ty

Polka

Edited by polkamatador
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...