fatalcoder Posted August 21, 2010 Share Posted August 21, 2010 Func load() Local $PATH, $FILE, $INDEX, $LINE, $DATA $PATH = FileOpenDialog("Load ", @DesktopDir & "\", "List Format(*.txt)", 1) GUICtrlSetData($Input2,_FileCountLines($PATH)) If Not @error Then $FILE = FileOpen($PATH,0) $INDEX = 1 While True $LINE = FileReadLine($FILE,$INDEX) If @error Then ExitLoop $DATA = StringSplit($LINE,":") If IsArray($DATA) Then If $DATA[0] = 2 Then GUICtrlCreateListViewItem($DATA[1] & "|" & $DATA[2],$ListView1) EndIf EndIf $INDEX += 1 WEnd FileClose($FILE) EndIf EndFunc and tried to read each issue of $data[1] array, but fail to be grateful if you help me,after first reading will be read the second Link to comment Share on other sites More sharing options...
BrettF Posted August 21, 2010 Share Posted August 21, 2010 Sample text please. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
fatalcoder Posted August 21, 2010 Author Share Posted August 21, 2010 Sample text please.I like to fisier.txt username: password and I log in I want everybody after he logged in a row to log the two (Sorry but no English version of Google Translate) Link to comment Share on other sites More sharing options...
BrettF Posted August 21, 2010 Share Posted August 21, 2010 Just create something I can test with. Otherwise I have no idea what your script is even trying to do. Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
fatalcoder Posted August 21, 2010 Author Share Posted August 21, 2010 Just create something I can test with. Otherwise I have no idea what your script is even trying to do.Cheers,BrettSo I want to connect to a server with username and password with all the row,I just want to tell me how I can login to each take turns with its array turns Link to comment Share on other sites More sharing options...
XKahn Posted August 21, 2010 Share Posted August 21, 2010 (edited) Make sure you are using; #include <Array.au3> and Local $PATH, $FILE, $INDEX, $LINE, $DATA[3] Hope that helps your array. However I think this could be done without the array at all using; if StringInStr($line, ":") <> 0 Then $n = StringInStr($line, ":") $data = StringLeft($line, $n-1) EndIf Edited August 21, 2010 by XKahn Link to comment Share on other sites More sharing options...
fatalcoder Posted August 21, 2010 Author Share Posted August 21, 2010 (edited) Make sure you are using; #include <Array.au3> and Local $PATH, $FILE, $INDEX, $LINE, $DATA[3] Hope that helps your array. logs only the last read Edited August 21, 2010 by fatalcoder Link to comment Share on other sites More sharing options...
XKahn Posted August 21, 2010 Share Posted August 21, 2010 logs only the last readIs it my understanding that your text file is in this format?USER_ID:USER_PASSWORDUSER_ID:USER_PASSWORDUSER_ID:USER_PASSWORDUSER_ID:USER_PASSWORDBrettF and I are just guessing at what you have given us. We really need the file format you are feeding this function. Link to comment Share on other sites More sharing options...
fatalcoder Posted August 21, 2010 Author Share Posted August 21, 2010 (edited) yes is this USER_ID:USER_PASSWORD Func loadbots() $PATH = FileOpenDialog("Load Bots list", @DesktopDir & "\", "Bots List bot:pass Format(*.txt)", 1) GUICtrlSetData($Input2,_FileCountLines($PATH)) If Not @error Then $FILE = FileOpen($PATH,0) $INDEX = 1 While True $LINE = FileReadLine($FILE,$INDEX) if StringInStr($line, ":") <> 0 Then $n = StringInStr($line, ":") $DATA = StringLeft($line, $n-1) EndIf If IsArray($DATA) Then If $DATA[0] = 2 Then GUICtrlCreateListViewItem($DATA[1] & "|" & $DATA[2],$ListView1) $ALIAS=$DATA[1] $PASSWORD=$DATA[2] EndIf EndIf $INDEX += 1 WEnd FileClose($FILE) EndIf EndFunc Edited August 21, 2010 by fatalcoder Link to comment Share on other sites More sharing options...
MvGulik Posted August 21, 2010 Share Posted August 21, 2010 [OffTopic]Mmm. Might get interesting. (Seems to aiming for two out of two.) yes is this USER_ID:USER_PASSWORD Func loadbots() $PATH = FileOpenDialog("Load Bots list", @DesktopDir & "\", "Bots List bot:pass Format(*.txt)", 1) GUICtrlSetData($Input2,_FileCountLines($PATH)) If Not @error Then $FILE = FileOpen($PATH,0) $INDEX = 1 While True $LINE = FileReadLine($FILE,$INDEX) if StringInStr($line, ":") <> 0 Then $n = StringInStr($line, ":") $DATA = StringLeft($line, $n-1) EndIf If IsArray($DATA) Then If $DATA[0] = 2 Then GUICtrlCreateListViewItem($DATA[1] & "|" & $DATA[2],$ListView1) $ALIAS=$DATA[1] $PASSWORD=$DATA[2] EndIf EndIf $INDEX += 1 WEnd FileClose($FILE) EndIf EndFunc [/OffTopic] "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
BrewManNH Posted August 21, 2010 Share Posted August 21, 2010 yes is this USER_ID:USER_PASSWORDFunc loadbots()$PATH = FileOpenDialog("Load Bots list", @DesktopDir & "\", "Bots List bot:pass Format(*.txt)", 1) GUICtrlSetData($Input2,_FileCountLines($PATH))Bots list? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator Link to comment Share on other sites More sharing options...
XKahn Posted August 22, 2010 Share Posted August 22, 2010 Then this code might work for you. It will look for temp.txt inside the working directory. expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> Global $hListView If FileExists ("temp.txt") Then GUICreate("ListView Add Item", 400, 300) $hListView = GUICtrlCreateListView("", 50, 15, 300, 270) _GUICtrlListView_SetUnicodeFormat($hListView, False) _GUICtrlListView_InsertColumn($hListView, 0, "User ID", 145) _GUICtrlListView_InsertColumn($hListView, 1, "Password", 145) Load_Settings () GuiSetState() $msg = GUIGetMsg() While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() WEnd Else MsgBox (0,"ERROR!", "File Not Found") EndIf Func Load_Settings () $setup = FileOpen ("temp.txt",0) $line = FileReadLine($setup) $index = 0 While Not @error = -1 if StringInStr($line, ":") <> 0 Then $n = StringInStr($line, ":") $uid = StringLeft($line, $n-1) $pass = StringRight($line,StringLen($line)-$n) _GUICtrlListView_AddItem($hListView, $uid, $index) _GUICtrlListView_AddSubItem($hListView, $index, $pass, 1) EndIf $index += 1 $line = FileReadLine($setup) WEnd FileClose($setup) EndFunc Link to comment Share on other sites More sharing options...
fatalcoder Posted August 22, 2010 Author Share Posted August 22, 2010 Func loadbots() $setup = FileOpen ("botlist.txt",0) $line = FileReadLine($setup) $index = 0 While Not @error = -1 if StringInStr($line, ":") <> 0 Then $n = StringInStr($line, ":") $uid = StringLeft($line, $n-1) $pass = StringRight($line,StringLen($line)-$n) _GUICtrlListView_AddItem($ListView1, $uid, $index) _GUICtrlListView_AddSubItem($ListView1, $index, $pass, 1) $ALIAS=$uid $PASSWORD=$pass EndIf $index += 1 $line = FileReadLine($setup) WEnd FileClose($setup) EndFunc read all the latest log in Link to comment Share on other sites More sharing options...
XKahn Posted August 22, 2010 Share Posted August 22, 2010 read all the latest log in Here is an example of my temp.txt with the exact same code I gave to you above. MACHO:123456 MACINTOSH:password MACKEREL:12345678 MACMILLAN:1234 MADMAX:7777777 MADAMEBUTTERFLY:12345 MADURO:dragon MAESTRO:qwerty MAFIOSO:696969 MAGGIE:mustang MAGIC:letmein MAGNA:baseball MAGNET:master MAGNOLIA:michael MAGNUM:football MAGPIE:shadow MAHIMAHI:monkey MAHOGANY:abc123 MAITAI:pass MAILMAN:apple At the very bottom it reads "MAILMAN:apple" Link to comment Share on other sites More sharing options...
BrettF Posted August 22, 2010 Share Posted August 22, 2010 (edited) Fatalcoder, if you can't accurately describe what your problem is, we can't help. No one here is mind readers. I mean we've done pretty well so far to working out what you want, but if you can't tell us what your final outcome is, we can't help you achieve that. Next time you post I do expect a better explaination of what you want help with. That does mean typing it all out (using google translate if you need to ), showing any examples of code, files. Basically so we can replicate what you need. #include <GuiConstantsEx.au3> #include <GuiListView.au3> Global $hListView If FileExists("botlist.txt") Then GUICreate("ListView Add Item", 400, 300) $hListView = GUICtrlCreateListView("", 50, 15, 300, 270) _GUICtrlListView_SetUnicodeFormat($hListView, False) _GUICtrlListView_InsertColumn($hListView, 0, "User ID", 145) _GUICtrlListView_InsertColumn($hListView, 1, "Password", 145) loadbots() GUISetState() $msg = GUIGetMsg() While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() WEnd Else MsgBox(0, "ERROR!", "File Not Found") EndIf Func loadbots() $delim = Opt("GUIDataSeparatorChar", ":") $sFile = FileRead("botlist.txt") $aList = StringSplit($sFile, @CRLF, 1) For $iX = 1 To $aList[0] If StringInStr($aList[$iX], ":") Then GUICtrlCreateListViewItem($aList[$iX], $hListView) EndIf Next Opt("GUIDataSeparatorChar", $delim) EndFunc ;==>loadbots Cheers, Brett Edited August 22, 2010 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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