Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 04:52

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

Advertisement



Problem with regread/regwrite

Discussion on Problem with regread/regwrite 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
Problem with regread/regwrite

hi

im trying to write data from my gui to registry but it write some dummy data

here is code

Code:
$Input1 = GUICtrlCreateInput("1000", 18, 74, 38, 17, 0x0001)
$Input2 = GUICtrlCreateInput("1000", 72, 74, 38, 17, 0x0001)
$Input3 = GUICtrlCreateInput("1000", 125, 74, 38, 17, 0x0001)
$Input4 = GUICtrlCreateInput("1000", 179, 74, 38, 17, 0x0001)
$Input5 = GUICtrlCreateInput("1000", 232, 74, 38, 17, 0x0001)
$Input6 = GUICtrlCreateInput("1000", 286, 74, 38, 17, 0x0001)
$Input7 = GUICtrlCreateInput("1000", 339, 74, 38, 17, 0x0001)
$Input8 = GUICtrlCreateInput("1000", 393, 74, 38, 17, 0x0001)
$Input9 = GUICtrlCreateInput("1000", 446, 74, 38, 17, 0x0001)
$Input10 = GUICtrlCreateInput("1000", 500, 74, 38, 17, 0x0001)
$Input11 = GUICtrlCreateInput("3", 30, 46, 17, 17, 0x0001)
$Input12 = GUICtrlCreateInput("4", 84, 46, 17, 17, 0x0001)
$Input13 = GUICtrlCreateInput("5", 137, 46, 17, 17, 0x0001)
$Input14 = GUICtrlCreateInput("6", 190, 46, 17, 17, 0x0001)
$Input15 = GUICtrlCreateInput("7", 243, 46, 17, 17, 0x0001)
$Input16 = GUICtrlCreateInput("8", 296, 46, 17, 17, 0x0001)
$Input17 = GUICtrlCreateInput("9", 350, 46, 17, 17, 0x0001)
$Input18 = GUICtrlCreateInput("0", 404, 46, 17, 17, 0x0001)
$Input19 = GUICtrlCreateInput("-", 457, 46, 17, 17, 0x0001)
$Input20 = GUICtrlCreateInput("+", 510, 46, 17, 17, 0x0001)



and function to write data

Func _addToRegistry()
	; create key in registry
	RegWrite("HKEY_CURRENT_USER\Software\Test")

	; write keys and times to registry
	RegWrite("HKEY_CURRENT_USER\Software\Test", "Keys", "REG_MULTI_SZ", $Input11 & @LF & $Input12 & @LF & $Input13 & @LF & $Input14 & @LF & $Input15 & @LF & $Input16 & @LF & $Input17 & @LF & $Input18 & @LF & $Input19 & @LF & $Input20)
	RegWrite("HKEY_CURRENT_USER\Software\Test", "Times", "REG_MULTI_SZ", $Input1 & @LF & $Input2 & @LF & $Input3 & @LF & $Input4 & @LF & $Input5 & @LF & $Input6 & @LF & $Input7 & @LF & $Input8 & @LF & $Input9 & @LF & $Input10)
EndFunc
when i run this it write me this to registry

keys :
14
15
16
17
18
19
20
21
22
23

times :
4
5
6
7
8
9
10
11
12
13


and it need to write for keys 3 4 5 6 7 8 9 0 ' +
and for times 1000 1000 1000 1000 1000 etc...

anyone know the problem ?
mlukac89 is offline  
Old 11/04/2013, 17:21   #2
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
Why don't you use array for the controls? It would be much better if you use them.
By the way you're writing the handle of the control inside the Registry Entry.
You have to use GUICtrlRead($hControl) to get the data inside.

Don't forget to add #RequireAdmin, some users need admin rights to access or edit the registry.
alpines is offline  
Old 11/04/2013, 17:41   #3
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
oh thx for that i forgot GUICtrlRead() and i dont know how tu use arrays im not that good in autoit ;(

how can i now read from registry into the input fields i used this and this list me all data in first input
Code:
$readTime1 = RegRead("HKEY_CURRENT_USER\Software\Test", "Times")
$Input1 = GUICtrlSetData($Input1, $readTime1)
MsgBox(0, "Time", $readTime1)
but is i use this

Code:
$readTime1 = RegRead("HKEY_CURRENT_USER\Software\Test\Times", $Input1)
$Input1 = GUICtrlSetData($Input1, $readTime1)
i get blank result.

My question is how to take that result and put in input field separate ?
mlukac89 is offline  
Old 11/05/2013, 16:59   #4
 
elite*gold: 15
Join Date: Aug 2012
Posts: 3,041
Received Thanks: 6,397
Code:
$_rd = RegRead("HKEY_CURRENT_USER\Software\Test", "Times")
$_str = StringSplit($_rd, @LF)
;GUICtrlSetData($Input1, $_str[1])

For $i = 1 to UBound($_str) - 1
    MsgBox(0, "_str array nr: " & $i, $_str[$i])
Next
and here's the code for the *array controls*
Code:
Global $txtBOX[5]

$hGUI = GUICreate("", 120, 160)

For $i = 0 To 4
    $txtBOX[$i] = GUICtrlCreateInput("", 10, 10 + ($i * 30), 100, 20)
Next
; if you don't want to use an automated for loop do it like this
; $txtBOX[0] = GUICtrlCreateInput("1000", 18, 74, 38, 17, 0x0001)
; $txtBOX[1] = GUICtrlCreateInput("1000", 72, 74, 38, 17, 0x0001)
; $txtBOX[2] = GUICtrlCreateInput("1000", 125, 74, 38, 17, 0x0001)

GUISetState(@SW_SHOW, $hGUI)

_SetData()

While 1
	Switch GUIGetMsg()
		Case -3
			Exit
	EndSwitch
WEnd

Func _SetData()
	$_rd = RegRead("HKEY_CURRENT_USER\Software\Test", "Keys")
	$_str = StringSplit($_rd, @LF)

	For $i = 1 to UBound($_str) - 1
		GUICtrlSetData($txtBOX[$i-1], $_str[$i])
	Next
EndFunc
berkay2578 is offline  
Reply


Similar Threads Similar Threads
Can someone help me add RegWrite
05/04/2013 - AutoIt - 2 Replies
Can someone help me add RegWrite in my AutoItscripts my (Register to add "mourad"="C:\\Documents and Settings\\pc\\Application Data\\mourad.exe" my AutoItscripts



All times are GMT +1. The time now is 04:53.


Powered by vBulletin®
Copyright ©2000 - 2025, 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 ©2025 elitepvpers All Rights Reserved.