Sign in to follow this  
Followers 0
Unfrog

[ HELP ]How to Use String ?

2 posts in this topic

#1 ·  Posted (edited)

I'm writing a basic script as follows:

#Include <File.au3>
$FileFullPath = @ScriptDir & "\Test.txt"
#Include <Array.au3>
$FileOpen = FileOpen($FileFullPath, 0)
If $FileOpen=-1 Then
    MsgBox(0, "Notice", "Cannot open file")
    Exit
EndIf
$i = 1
$FileCountLines = _FileCountLines($FileFullPath)
Global $Array[1]
Do
    $FileReadLine = FileReadLine($FileOpen, $i)
    $StringSplit = StringSplit($FileReadLine, ":")
    _ArrayAdd($Array, $StringSplit[1] & ":" & $StringSplit[2])
    _ArrayAdd($Array, $StringSplit[3])
    $i = $i + 1
Until $i = $FileCountLines + 1
_ArrayDisplay($Array, "Show Infor")

With file test.txt is :

C:\Program Files\Yahoo!\Messenger\YahooMessenger.exe:10000
C:\Chrome\chrome.exe:20000
D:\Games\e-Games\NewGAME\~Launcher.exe:15646
C:\Program Files\Muziic\Muziic.exe:1654321

I want to write a simple script , it will be run Applications in test.txt with the number is time out.But I don't know how .

Sorry , I'm newbie

Edited by Unfrog

Share this post


Link to post
Share on other sites



Well, as a start, this replaces what you have so far:

#include <File.au3>
#include <Array.au3>

Global $FileFullPath = @ScriptDir & "\Test.txt"
Global $Array
_FileReadToArray($FileFullPath, $Array)
_ArrayDisplay($Array, "Show Infor")

Now you just loop through $Array and process each line as you wish.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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