Sign in to follow this  
Followers 0
Clever1mba

LOAD FROM TEXT FILE

12 posts in this topic

#1 ·  Posted (edited)

Hello

i have problem getting text to file

RunWait("info.txt", "C:\WINDOWS", @SW_MAXIMIZE)

actually i dont want to run info.txt i want run text inside info.txt

text file contain few files name

like notepade.exe,explorer.exe........etc

if any one have solution share it

Edited by asimzameer

Share this post


Link to post
Share on other sites



check out _FileReadToArray


Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites

$fHandle = FileOpen("info.txt", "0")
Do
  $x = 1
  $line[$x] = FileReadLine($fHandle)
  $x += 1
Until @error = -1
SetError(0)
$arraysize = UBound($line) - 1
$line[0] = $arraysize

Hehe, _FileReadToArray() would be much easier than mine :(

Then just do

For $x = 0 To $line[0]
RunWait(@Comspec & " \c " & $line[$x])
Next

Maybe that will help you


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Hello

how we can read txt file to internet

$file = FileOpen("http://domain.com/mytext.txt", 0)

$chars = FileRead($file, 1)

MsgBox(0, "Char read:", $chars)

Share this post


Link to post
Share on other sites

InetGet() i believe


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Hello

Yeh but how to use with fileread

Share this post


Link to post
Share on other sites

save the file to, say the temp dir, and then just do FileRead($fHandle)


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

hello

Im trying to do but get error wat problem in it

$file = InetGet("http://www.domain.com/myfile.txt", "myfile.txt", 1)

$chars = FileRead($file, 1)

MsgBox(0, "Char read:", $chars)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

You're declaring $file as '1' as InetGet() returns '1' on success. You need to do

$chars = FileRead("Myfile.txt", 1)

or you can do:

InetGet("http://www.domain.com/myfile.txt", "myfile.txt", 1)

$fHandle = FileOpen("myfile.txt", 0)
$char = FileRead($fHandle, 1)
FileClose($fHandle)

MsgBox(0, "Char read:", $char)
Edited by MSLx Fanboy

Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Not that I'm aware of...you can do a FileDelete() afterwards...or, when calling the InetGet, send a fake command, so that it will think that the webpage is different with this new parameter

such as

$FakeParam = Random(1, 9999, 1)

InetGet("http://www.domain.com/myfile.txt?q=" & $FakeParam, "myfile.txt", 1)

Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Hello

$fHandle = FileOpen(@SystemDir & "\myfile.txt", 0)

$char = FileRead($fHandle, 99999999)

FileClose($fHandle)

$stopservice = StringSplit($char, ",")

For $i = 1 To $stopservice[0]RunWait("net.exe stop " & $stopservice[$i],"",@SW_HIDE)

Next

myfile.txt contains services but when i add services like

this

its not working

service1,

service2,

etc

its working

service1,service2, etc........

Share this post


Link to post
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
Sign in to follow this  
Followers 0