Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 15:37

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Help with read data

Discussion on Help with read data within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
Help with read data

i need help with reading data from ini
when i open file it returns me 1 and not content of file

here is script

Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <File.au3>

#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Form1", 516, 419, 193, 124)
$List1 = GUICtrlCreateList("", 8, 8, 289, 396)
$Button1 = GUICtrlCreateButton("Open file", 312, 8, 193, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button1

			$file = FileOpen("C:\Temp\ItemTemplateAll.ini", 0)

			; Check if file opened for reading OK
			If $file = -1 Then
				MsgBox(0, "Error", "Unable to open file.")
				Exit
			Else
				$List1 = GUICtrlSetData($List1, $file & @CRLF)
			EndIf

	EndSwitch
WEnd
and here is ini file

mlukac89 is offline  
Old 11/08/2013, 00:51   #2

 
elite*gold: 64
Join Date: May 2011
Posts: 1,229
Received Thanks: 854
Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <File.au3>

#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Form1", 516, 419, 193, 124)
$List1 = GUICtrlCreateList("", 8, 8, 289, 396)
$Button1 = GUICtrlCreateButton("Open file", 312, 8, 193, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button1

			$file = FileOpen("C:\Temp\ItemTemplateAll.ini", 0)

			; Check if file opened for reading OK
			If $file = -1 Then
				MsgBox(0, "Error", "Unable to open file.")
				Exit
			Else
				$List1 = GUICtrlSetData($List1, FileRead("C:\Temp\ItemTemplateAll.ini") & @CRLF)
			EndIf

	EndSwitch
WEnd
Try FileRead.
BladeTiger12 is offline  
Old 11/08/2013, 02:35   #3
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
tried that too dont works

i now tested with normal txt file and it opens it and i tried to rename that ini to txt but still wont load data from it and i can opet it in notepad and see data in, maybe is file too big and autoit cant load it ?
mlukac89 is offline  
Old 11/08/2013, 06:40   #4
 
elite*gold: 0
Join Date: Aug 2013
Posts: 321
Received Thanks: 258
try iniread :> that is for ini Files
Sh1Rum is offline  
Old 11/08/2013, 12:43   #5
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
tried that too but this ini is diferent than normal one its from game, but if i can open it in notepad i dont see reason why i cant read it as a file. If i convert extension to .txt same happening

this is one section for 1 item

Code:
[5018]
0=AgpmItem
1=Karkaen necklace
2=0
3=1
4=1
5=0
6=0
7=0
8=0
9=0
10=0
11=0
12=0
13=0
14=0
15=0
16=0
17=0
18=0
19=0
20=0
21=0
22=0
23=0
24=0
25=0
26=0
27=0
28=0
29=0
30=0
31=0
32=0
33=0
34=0
35=0
36=0
37=0
38=0
39=0
40=0
41=0
42=0
43=0
44=0
45=0
46=0
47=0
32=0
48=0
33=0
34=0
35=0
36=0
37=0
38=0
39=0
40=0
41=0
42=0
43=0
44=0
45=0
46=0
47=0
48=0
49=0
50=0
51=0
33=0
34=0
35=0
36=0
37=0
38=0
39=0
40=0
41=0
42=0
43=0
44=0
45=0
46=0
47=0
51=0
52=0
33=0
34=0
35=0
36=0
37=0
38=0
39=0
40=0
41=0
42=0
43=0
44=0
45=0
46=0
47=0
52=0
53=0
54=0
55=0
56=0
57=0
58=0
59=0
60=0
61=0
62=0
63=0
64=0
65=0
66=0
67=0
68=0
69=0
70=0
71=0
72=1065353216
73=1166024704
74=0
75=0
76=0
5=0
6=0
7=0
8=0
9=0
10=0
11=0
12=0
13=0
14=37
15=0
16=0
17=0
77=0
78=0
79=0
80=0
81=0
75=0
82=13
83=16
84=0
85=ApmEventManager
86=AgcmItem
87=196
89=5018
90=1
93=5283840
94=0
95=-0.003082:20.687401:0.004089:32.310398
96=0:0:0:0:0:0:0:0:0:0:0:0
97=0
98=0
99=0
100=0
101=AgcmEventEffect
102=-842150451
103=0:131072
104=0:0:0:0:0:1:0:0
105=0:IS0015.WAV
106=1:1
107=1:0:0:0:0:1:0:0
108=1:IS0023.WAV
115=0
and every item have diferent code in section [] but i need to get that in list to be able for search items.

I need when i type Karkaen to get < [5018] = Karkaen necklace > not the rest of the numbers like you see here.
mlukac89 is offline  
Old 11/08/2013, 14:18   #6
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
If you looked it up on the documentation then you would know that FileOpen opens a handle for the file. You can rather use
Code:
$hFile = FileOpen(...)
$sFile = FileRead($hFile)
FileClose($hFile)
or
Code:
$sFile = FileRead("Path")
The first method is much better.
IniRead is easy too
Code:
$sEntry = IniRead("PathToIni", "5018", "0", "")
To write an Ini entry you should use
Code:
IniWrite("PathToIni", "SectionName", "EntryName", "DataToWrite")
alpines is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
Failed to read data from PFO no fix!!!!!!
07/02/2017 - SRO Private Server - 13 Replies
hi all , i use cracked version of mbot and i get this error Failed to read data from PFO when i try to choose the sro folder i searched many times on many forums and no even one come close for fix it any idea how to fix the problem Thanks.
[HELP] data base erorr Row is read-only
04/23/2012 - SRO Private Server - 4 Replies
hi when i try to add item to npc _RifObjComm i cannot add any code he say this message his row was successfully commited to database. However a problem occured when attempting to retrieve the data back after the commit. Because of this the displayed data in this row is read-only. To fix this problem please re-run the query" plz help me
cant read data.pak w/winhex
07/10/2011 - Dekaron - 11 Replies
ok i forgot what i did to read the data pk. but now i cant read it, it either opens like "1F 0E 3F.." or "#$#%#$@...." can someone tell me what option to make it in text and numeric that is readable. I chose text only under "view" but it shoews all %^&&*#^$&#..plz help
how to hex dekaron.exe to read file outside before data.pak
03/01/2009 - Dekaron - 3 Replies
guy. i want to hex dekaron.exe to read file outside data.pak if file not exit to read file in data.pak sample in process monitor program:: C:\2Moons\Data\usa\share\maplist.csv PATH NOT FOUND Desired Access: Generic Read if file not exit to read in data.pak i'm sorry for noob eng language xD



All times are GMT +1. The time now is 15:38.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.