Jump to content

LOAD FROM TEXT FILE


Recommended Posts

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
Link to comment
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())
Link to comment
Share on other sites

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())
Link to comment
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())
Link to comment
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........

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...