Sign in to follow this  
Followers 0
Azu

Having problems writing to .ini file..

8 posts in this topic

#1 ·  Posted (edited)

#include <GUIConstants.au3>
#include <string.au3>
$inipath="AutoLogin.ini"
$readini=IniReadSectionNames($inipath)
HotKeySet("{ESC}", "_Exit")
HotKeySet("^+a", "_kill")
Func _Exit()
Exit
EndFunc
Func DAAutoLogin()
$DARunPath = IniRead($inipath, "DA", "Path", "")
If $DARunPath = "" Then
_Change()
Else
EndIf
Run($DARunPath)
WinWaitActive("Darkages")
Sleep(100)
WinWaitActive("Darkages")
Sleep(100)
Send("{ESC}")
$x = 0
$y = 0
$checksum = 1010249294
While $checksum <> PixelChecksum(528 + $x,451 + $y, 612 + $x,470 + $y)
Sleep(100)
WEnd
MouseClick("left", 168 + $x, 205 + $y, 2)
$checksum = PixelChecksum(505 + $x,386 + $y, 532 + $x,402 + $y)
While $checksum = PixelChecksum(505 + $x,386 + $y, 532 + $x,402 + $y)
Sleep(50)
WEnd
MouseClick("left", 232 + $x, 391 + $y, 1)
Sleep(100)
MouseClick("left", 108 + $x, 318 + $y, 1)
MouseClick("left", 302 + $x, 253 + $y, 1)
$DARunName = IniRead($inipath, "DA", "Name", "")
Send($DARunName)
Send("{Enter}")
$DARunPassword = IniRead($inipath, "DA", "Password", "")
ClipPut($DARunPassword)
Send($DARunPassword)
Send("{Enter}")
Exit
EndFunc
Func ROAutoLogin()
$RORunPath = IniRead($inipath, "RO", "Path", "")
If $RORunPath = "" Then
_Change()
Else
EndIf
Run($RORunPath)
WinWait ("Ragnarok")
Sleep (500)
WinWait ("Ragnarok")
Sleep (500)
$RORunName = IniRead($inipath, "RO", "Name", "")
Send($RORunName)
Send("{Tab}")
$RORunPassword = IniRead($inipath, "RO", "Password", "")
Send($RORunPassword)
Send("{Enter}")
for $x = 1 to 15
Sleep (100)
Send ("{ENTER}")
Next
Exit
EndFunc
Func SCAutoLogin()
$SCRunPath = IniRead($inipath, "SC", "Path", "")
If $SCRunPath = "" Then
_Change()
Else
EndIf
Run($SCRunPath)
WinWaitActive("Brood War")
Sleep(100)
WinWaitActive("Brood War")
Sleep(100)
$checksum = PixelChecksum(194,264,198,268)
While $checksum = PixelChecksum(194,264,198,268)
Sleep(10)
WEnd
$checksum = PixelChecksum(364,300,368,304)
MouseClick("primary", 196, 266, 1)
While $checksum = PixelChecksum(364,300,368,304)
Sleep(10)
WEnd
$checksum = PixelChecksum(347,253,347,253)
MouseClick("primary", 366, 302, 1)
While $checksum = PixelChecksum(347,253,347,253)
Sleep(10)
WEnd
$checksum = PixelChecksum(396,234,396,234)
MouseClick("primary", 520, 394, 30)
While $checksum = PixelChecksum(396,234,396,234)
Sleep(10)
WEnd
Sleep(1500)
$checksum = PixelChecksum(408,272,408,272)
While $checksum = PixelChecksum(408,272,408,272)
Sleep(10)
WEnd
for $x = 1 to 7
Sleep (10)
Send ("{Tab}")
Next
$SCRunName = IniRead($inipath, "SC", "Name", "")
Send($SCRunName)
Send("{TAB}")
$SCRunPassword = IniRead($inipath, "SC", "Password", "")
Send($SCRunPassword)
Send("{Enter}")
Exit
EndFunc
Func WoWAutoLogin()
$WoWRunPath = IniRead($inipath, "WoW", "Path", "")
If $WoWRunPath = "" Then
_Change()
Else
EndIf
Run($WoWRunPath)
WinWait ("World of Warcraft")
Sleep (400)
WinWait ("World of Warcraft")
Sleep (400)
$WoWRunName = IniRead($inipath, "WoW", "Name", "")
Send($WoWRunName)
Send("{Tab}")
$WoWRunPassword = IniRead($inipath, "WoW", "Password", "")
Send ($WoWRunPassword)
Send("{Enter}")
Sleep (8500)
Send ("{ENTER}")
Exit
EndFunc
Dim $ScanMsgBox = _MainPanel(4, '-=Auto Login Control Panel=-', 'Welcome to Auto Login!')
If $ScanMsgBox = 6 Then
DAAutoLogin()
EndIf
If $ScanMsgBox = 7 Then
ROAutoLogin()
EndIf
If $ScanMsgBox = 8 Then
WoWAutoLogin()
EndIf
If $ScanMsgBox = 9 Then
SCAutoLogin()
EndIf
If $ScanMsgBox = 10 Then
_Change()
EndIf
Func _Change()
GuiCreate("Auto Login Editer", 368, 66)
GuiSetIcon(@SystemDir & "\mspaint.exe", 0)
GuiCtrlCreateTab(1, 0, 368, 23)
GuiCtrlCreateTabItem("DA")
GuiCtrlCreateLabel("Username:", 0, 25)
$DARunName=IniRead($inipath, "DA", "Name", "")
$DAName=GuiCtrlCreateInput($DARunName, 51, 23, 130, 20)
GuiCtrlCreateLabel("Password:", 188, 25)
$DARunPassword=IniRead($inipath, "DA", "Password", "")
$DAPassword=GuiCtrlCreateInput($DARunPassword, 238, 23, 130, 20)
GuiCtrlCreateLabel("Path:", 0, 50)
$DARunPath=IniRead($inipath, "DA", "Path", "")
$DA=GuiCtrlCreateInput($DARunPath, 26, 48, 280, 20)
$BrowseDA=GuiCtrlCreateButton("Browse", 310, 48, 59, 20)
GuiCtrlCreateTabItem("RO")
GuiCtrlCreateLabel("Username:", 0, 25)
$RORunName=IniRead($inipath, "RO", "Name", "")
$ROName=GuiCtrlCreateInput($RORunName, 51, 23, 130, 20)
GuiCtrlCreateLabel("Password:", 188, 25)
$RORunPassword=IniRead($inipath, "RO", "Password", "")
$ROPassword=GuiCtrlCreateInput($RORunPassword, 238, 23, 130, 20)
GuiCtrlCreateLabel("Path:", 0, 50)
$RORunPath=IniRead($inipath, "RO", "Path", "")
$RO=GuiCtrlCreateInput($RORunPath, 26, 48, 280, 20)
$BrowseRO=GuiCtrlCreateButton("Browse", 310, 48, 59, 20)
GuiCtrlCreateTabItem("WoW")
GuiCtrlCreateLabel("Username:", 0, 25)
$WoWRunName=IniRead($inipath, "WoW", "Name", "")
$WoWName=GuiCtrlCreateInput($WoWRunName, 51, 23, 130, 20)
GuiCtrlCreateLabel("Password:", 188, 25)
$WoWRunPassword=IniRead($inipath, "WoW", "Password", "")
$WoWPassword=GuiCtrlCreateInput($WoWRunPassword, 238, 23, 130, 20)
GuiCtrlCreateLabel("Path:", 0, 50)
$WoWRunPath=IniRead($inipath, "WoW", "Path", "")
$WoW=GuiCtrlCreateInput($WoWRunPath, 26, 48, 280, 20)
$BrowseWoW=GuiCtrlCreateButton("Browse", 310, 48, 59, 20)
GuiCtrlCreateTabItem("SC")
GuiCtrlCreateLabel("Username:", 0, 25)
$SCRunName=IniRead($inipath, "SC", "Name", "")
$SCName=GuiCtrlCreateInput($SCRunName, 51, 23, 130, 20)
GuiCtrlCreateLabel("Password:", 188, 25)
$SCRunPassword=IniRead($inipath, "SC", "Password", "")
$SCPassword=GuiCtrlCreateInput($SCRunPassword, 238, 23, 130, 20)
GuiCtrlCreateLabel("Path:", 0, 50)
$SCRunPath=IniRead($inipath, "SC", "Path", "")
$SC=GuiCtrlCreateInput($SCRunPath, 26, 48, 280, 20)
$BrowseSC=GuiCtrlCreateButton("Browse", 310, 48, 59, 20)
GuiCtrlCreateTabItem("")
$Apply=GuiCtrlCreateButton("Apply", 310, 0, 59, 20)
GuiSetState()
Do
$msg = GUIGetMsg()
Select
Case $msg= $BrowseDA
$DA = FileOpenDialog("Browse to DA", "", "Dark Ages (*.exe)","", "DA.exe")
IniWrite($inipath, "DA", "Path", $DA)
Case $msg= $BrowseRO
$RO = FileOpenDialog("Browse to RO", "", "Ragnarok Online (*.exe)","", "RO.exe")
IniWrite($inipath, "RO", "Path", $RO)
Case $msg= $BrowseWoW
$WoW = FileOpenDialog("Browse to WoW", "", "World of Warcraft (*.exe)","", "WoW.exe")
IniWrite($inipath, "WoW", "Path", $WoW)
Case $msg= $BrowseSC
$SC = FileOpenDialog("Browse to SC", "", "Star Craft (*.exe)","", "SC.exe")
IniWrite($inipath, "SC", "Path", $SC)
Case $msg= $Apply
IniWrite($inipath, "DA", "Path", $DA)
IniWrite($inipath, "DA", "Password", $DAPassword)
IniWrite($inipath, "DA", "Name", $DAName)
IniWrite($inipath, "RO", "Path", $RO)
IniWrite($inipath, "RO", "Password", $ROPassword)
IniWrite($inipath, "RO", "Name", $ROName)
IniWrite($inipath, "WoW", "Path", $WoW)
IniWrite($inipath, "WoW", "Password", $WoWPassword)
IniWrite($inipath, "WoW", "Name", $WoWName)
IniWrite($inipath, "SC", "Path", $SC)
IniWrite($inipath, "SC", "Password", $SCPassword)
IniWrite($inipath, "SC", "Name", $SCName)
EndSelect
Until $msg = $GUI_EVENT_CLOSE
EndFunc
Func _MainPanel($mb_Icon, $mb_Title, $mb_Text, $mb_Time = '')
Local $StrnLenText = MsgLongestString($mb_Text)
Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 5
Local $MsgValue = 0
Local $Timer = ''
$iMsgBox = GUICreate($mb_Title, $StrnLenText + 190, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)
GUICtrlCreateLabel($mb_Text, 60, 10)
GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)
$DA = GUICtrlCreateButton("DA", 0 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen("DA"), 25)
$RO = GUICtrlCreateButton("RO", 65 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen("RO"), 25)
$WoW = GUICtrlCreateButton("WoW", 130 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen("WoW"), 25)
$SC = GUICtrlCreateButton("SC", 69 + ($StrnLenText / 2), 25 + $NumberOfLines, 50 + StringLen("SC"), 17)
$Info = GUICtrlCreateButton("Change", 134 + ($StrnLenText / 2), 25 + $NumberOfLines, 50 + StringLen("_Change"), 17)
GUISetState()
If $mb_Time <> '' Then $Timer = TimerInit()
While 1
$imsg = GUIGetMsg()
Select
Case $imsg = $DA
$MsgValue = 6
ExitLoop
Case $imsg = $RO
$MsgValue = 7
ExitLoop
Case $imsg = $WoW
$MsgValue = 8
ExitLoop
Case $imsg = $SC
$MsgValue = 9
ExitLoop
Case $imsg = $Info
$MsgValue = 10
ExitLoop
Case $mb_Time <> ''
If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop
EndSelect
WEnd
GUIDelete($iMsgBox)
Return $MsgValue
EndFunc
Func MsgLongestString($sText)
Local $sSplit = StringSplit($sText, @CRLF)
Local $Times = ''
If Not @error Then
ArraySortByLen($sSplit)
If StringLen($sSplit[1]) <= 100 Then $Times = 2.25
If StringLen($sSplit[1]) >= 101 And StringLen($sSplit[1]) <= 150 Then $Times = 2.5
If StringLen($sSplit[1]) >= 151 And StringLen($sSplit[1]) <= 201 Then $Times = 3
If StringLen($sSplit[1]) >= 202 Then $Times = 3.25
Return Round(StringLen($sSplit[1])*$Times)
Else
If StringLen($sText) <= 100 Then $Times = 2.25
If StringLen($sText) >= 101 And StringLen($sText) <= 150 Then $Times = 2.5
If StringLen($sText) >= 151 And StringLen($sText) <= 201 Then $Times = 3
If StringLen($sText) >= 202 Then $Times = 3.25
Return Round(StringLen($sText)*$Times)
EndIf
EndFunc
Func ArraySortByLen(ByRef $nArray, $Start = 1)
For $i = $Start To UBound($nArray) - 2
Local $SE = $i
For $x = $i To UBound($nArray) - 1
If StringLen($nArray[$SE]) < StringLen($nArray[$x]) Then $SE = $x
Next
Local $HLD = $nArray[$i]
$nArray[$i] = $nArray[$SE]
$nArray[$SE] = $HLD
Next
EndFunc
Func _kill()
If ProcessExists("explorer.exe") Then
ProcessClose("explorer.exe")
Else
Run("explorer.exe")
EndIf
EndFunc

It writes numbers to the ini file instead of what is suppost to be written.. example of buggered ini file:

[WoW]
Path=26
Password=24
Name=22
[SC]
Path=34
Password=32
Name=30
[DA]
Path=10
Password=8
Name=6
[RO]
Path=18
Password=16
Name=14

Please tell me how to fix my script so it writes the ini properly.. as it is now, it needs to be manuelly edited in notepad -.-

Also, ctrl alt a is suppost to toggle explorer.exe off and on, but instead, it just restarts it just from pressing the hotkey once. Rather then just shutting it off. How come? D:

Edited by Azu

Share this post


Link to post
Share on other sites



You are writing the control ID's to the ini file. To write the actual values in the text boxes you do this:

GUICtrlRead($DA)

That will return the value that is in the text box. If you don't do that, you just get the GUI Control ID numbers.


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

You mean like this?

#include <GUIConstants.au3>
#include <string.au3>
$inipath="AutoLogin.ini"
$readini=IniReadSectionNames($inipath)
HotKeySet("{ESC}", "_Exit")
HotKeySet("^+a", "_kill")
Func _Exit()
Exit
EndFunc
Func DAAutoLogin()
$DARunPath = IniRead($inipath, "DA", "Path", "")
If $DARunPath = "" Then
_Change()
Else
EndIf
Run($DARunPath)
WinWaitActive("Darkages")
Sleep(100)
WinWaitActive("Darkages")
Sleep(100)
Send("{ESC}")
$x = 0
$y = 0
$checksum = 1010249294
While $checksum <> PixelChecksum(528 + $x,451 + $y, 612 + $x,470 + $y)
Sleep(100)
WEnd
MouseClick("left", 168 + $x, 205 + $y, 2)
$checksum = PixelChecksum(505 + $x,386 + $y, 532 + $x,402 + $y)
While $checksum = PixelChecksum(505 + $x,386 + $y, 532 + $x,402 + $y)
Sleep(50)
WEnd
MouseClick("left", 232 + $x, 391 + $y, 1)
Sleep(100)
MouseClick("left", 108 + $x, 318 + $y, 1)
MouseClick("left", 302 + $x, 253 + $y, 1)
$DARunName = IniRead($inipath, "DA", "Name", "")
Send($DARunName)
Send("{Enter}")
$DARunPassword = IniRead($inipath, "DA", "Password", "")
ClipPut($DARunPassword)
Send($DARunPassword)
Send("{Enter}")
Exit
EndFunc
Func ROAutoLogin()
$RORunPath = IniRead($inipath, "RO", "Path", "")
If $RORunPath = "" Then
_Change()
Else
EndIf
Run($RORunPath)
WinWait ("Ragnarok")
Sleep (500)
WinWait ("Ragnarok")
Sleep (500)
$RORunName = IniRead($inipath, "RO", "Name", "")
Send($RORunName)
Send("{Tab}")
$RORunPassword = IniRead($inipath, "RO", "Password", "")
Send($RORunPassword)
Send("{Enter}")
for $x = 1 to 15
Sleep (100)
Send ("{ENTER}")
Next
Exit
EndFunc
Func SCAutoLogin()
$SCRunPath = IniRead($inipath, "SC", "Path", "")
If $SCRunPath = "" Then
_Change()
Else
EndIf
Run($SCRunPath)
WinWaitActive("Brood War")
Sleep(100)
WinWaitActive("Brood War")
Sleep(100)
$checksum = PixelChecksum(194,264,198,268)
While $checksum = PixelChecksum(194,264,198,268)
Sleep(10)
WEnd
$checksum = PixelChecksum(364,300,368,304)
MouseClick("primary", 196, 266, 1)
While $checksum = PixelChecksum(364,300,368,304)
Sleep(10)
WEnd
$checksum = PixelChecksum(347,253,347,253)
MouseClick("primary", 366, 302, 1)
While $checksum = PixelChecksum(347,253,347,253)
Sleep(10)
WEnd
$checksum = PixelChecksum(396,234,396,234)
MouseClick("primary", 520, 394, 30)
While $checksum = PixelChecksum(396,234,396,234)
Sleep(10)
WEnd
Sleep(1500)
$checksum = PixelChecksum(408,272,408,272)
While $checksum = PixelChecksum(408,272,408,272)
Sleep(10)
WEnd
for $x = 1 to 7
Sleep (10)
Send ("{Tab}")
Next
$SCRunName = IniRead($inipath, "SC", "Name", "")
Send($SCRunName)
Send("{TAB}")
$SCRunPassword = IniRead($inipath, "SC", "Password", "")
Send($SCRunPassword)
Send("{Enter}")
Exit
EndFunc
Func WoWAutoLogin()
$WoWRunPath = IniRead($inipath, "WoW", "Path", "")
If $WoWRunPath = "" Then
_Change()
Else
EndIf
Run($WoWRunPath)
WinWait ("World of Warcraft")
Sleep (400)
WinWait ("World of Warcraft")
Sleep (400)
$WoWRunName = IniRead($inipath, "WoW", "Name", "")
Send($WoWRunName)
Send("{Tab}")
$WoWRunPassword = IniRead($inipath, "WoW", "Password", "")
Send ($WoWRunPassword)
Send("{Enter}")
Sleep (8500)
Send ("{ENTER}")
Exit
EndFunc
Dim $ScanMsgBox = _MainPanel(4, '-=Auto Login Control Panel=-', 'Welcome to Auto Login!')
If $ScanMsgBox = 6 Then
DAAutoLogin()
EndIf
If $ScanMsgBox = 7 Then
ROAutoLogin()
EndIf
If $ScanMsgBox = 8 Then
WoWAutoLogin()
EndIf
If $ScanMsgBox = 9 Then
SCAutoLogin()
EndIf
If $ScanMsgBox = 10 Then
_Change()
EndIf
Func _Change()
GuiCreate("Auto Login Editer", 368, 66)
GuiSetIcon(@SystemDir & "\mspaint.exe", 0)
GuiCtrlCreateTab(1, 0, 368, 23)
GuiCtrlCreateTabItem("DA")
GuiCtrlCreateLabel("Username:", 0, 25)
$DARunName=IniRead($inipath, "DA", "Name", "")
$DAName=GuiCtrlCreateInput($DARunName, 51, 23, 130, 20)
GuiCtrlCreateLabel("Password:", 188, 25)
$DARunPassword=IniRead($inipath, "DA", "Password", "")
$DAPassword=GuiCtrlCreateInput($DARunPassword, 238, 23, 130, 20)
GuiCtrlCreateLabel("Path:", 0, 50)
$DARunPath=IniRead($inipath, "DA", "Path", "")
$DA=GuiCtrlCreateInput($DARunPath, 26, 48, 280, 20)
$BrowseDA=GuiCtrlCreateButton("Browse", 310, 48, 59, 20)
GuiCtrlCreateTabItem("RO")
GuiCtrlCreateLabel("Username:", 0, 25)
$RORunName=IniRead($inipath, "RO", "Name", "")
$ROName=GuiCtrlCreateInput($RORunName, 51, 23, 130, 20)
GuiCtrlCreateLabel("Password:", 188, 25)
$RORunPassword=IniRead($inipath, "RO", "Password", "")
$ROPassword=GuiCtrlCreateInput($RORunPassword, 238, 23, 130, 20)
GuiCtrlCreateLabel("Path:", 0, 50)
$RORunPath=IniRead($inipath, "RO", "Path", "")
$RO=GuiCtrlCreateInput($RORunPath, 26, 48, 280, 20)
$BrowseRO=GuiCtrlCreateButton("Browse", 310, 48, 59, 20)
GuiCtrlCreateTabItem("WoW")
GuiCtrlCreateLabel("Username:", 0, 25)
$WoWRunName=IniRead($inipath, "WoW", "Name", "")
$WoWName=GuiCtrlCreateInput($WoWRunName, 51, 23, 130, 20)
GuiCtrlCreateLabel("Password:", 188, 25)
$WoWRunPassword=IniRead($inipath, "WoW", "Password", "")
$WoWPassword=GuiCtrlCreateInput($WoWRunPassword, 238, 23, 130, 20)
GuiCtrlCreateLabel("Path:", 0, 50)
$WoWRunPath=IniRead($inipath, "WoW", "Path", "")
$WoW=GuiCtrlCreateInput($WoWRunPath, 26, 48, 280, 20)
$BrowseWoW=GuiCtrlCreateButton("Browse", 310, 48, 59, 20)
GuiCtrlCreateTabItem("SC")
GuiCtrlCreateLabel("Username:", 0, 25)
$SCRunName=IniRead($inipath, "SC", "Name", "")
$SCName=GuiCtrlCreateInput($SCRunName, 51, 23, 130, 20)
GuiCtrlCreateLabel("Password:", 188, 25)
$SCRunPassword=IniRead($inipath, "SC", "Password", "")
$SCPassword=GuiCtrlCreateInput($SCRunPassword, 238, 23, 130, 20)
GuiCtrlCreateLabel("Path:", 0, 50)
$SCRunPath=IniRead($inipath, "SC", "Path", "")
$SC=GuiCtrlCreateInput($SCRunPath, 26, 48, 280, 20)
$BrowseSC=GuiCtrlCreateButton("Browse", 310, 48, 59, 20)
GuiCtrlCreateTabItem("")
$Apply=GuiCtrlCreateButton("Apply", 310, 0, 59, 20)
GuiSetState()
Do
$msg = GUIGetMsg()
Select
Case $msg= $BrowseDA
$DA = FileOpenDialog("Browse to DA", "", "Dark Ages (*.exe)","", "DA.exe")
IniWrite($inipath, "DA", "Path", $DA)
Case $msg= $BrowseRO
$RO = FileOpenDialog("Browse to RO", "", "Ragnarok Online (*.exe)","", "RO.exe")
IniWrite($inipath, "RO", "Path", $RO)
Case $msg= $BrowseWoW
$WoW = FileOpenDialog("Browse to WoW", "", "World of Warcraft (*.exe)","", "WoW.exe")
IniWrite($inipath, "WoW", "Path", $WoW)
Case $msg= $BrowseSC
$SC = FileOpenDialog("Browse to SC", "", "Star Craft (*.exe)","", "SC.exe")
IniWrite($inipath, "SC", "Path", $SC)
Case $msg= $Apply
GUICtrlRead($DA)
IniWrite($inipath, "DA", "Path", $DA)
GUICtrlRead($DAPassword)
IniWrite($inipath, "DA", "Password", $DAPassword)
GUICtrlRead($DAName)
IniWrite($inipath, "DA", "Name", $DAName)
GUICtrlRead($RO)
IniWrite($inipath, "RO", "Path", $RO)
GUICtrlRead($ROPassword)
IniWrite($inipath, "RO", "Password", $ROPassword)
GUICtrlRead($ROName)
IniWrite($inipath, "RO", "Name", $ROName)
GUICtrlRead($WoW)
IniWrite($inipath, "WoW", "Path", $WoW)
GUICtrlRead($WoWPassword)
IniWrite($inipath, "WoW", "Password", $WoWPassword)
GUICtrlRead($WoWName)
IniWrite($inipath, "WoW", "Name", $WoWName)
GUICtrlRead($SC)
IniWrite($inipath, "SC", "Path", $SC)
GUICtrlRead($SCPassword)
IniWrite($inipath, "SC", "Password", $SCPassword)
GUICtrlRead($SCName)
IniWrite($inipath, "SC", "Name", $SCName)
EndSelect
Until $msg = $GUI_EVENT_CLOSE
EndFunc
Func _MainPanel($mb_Icon, $mb_Title, $mb_Text, $mb_Time = '')
Local $StrnLenText = MsgLongestString($mb_Text)
Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 5
Local $MsgValue = 0
Local $Timer = ''
$iMsgBox = GUICreate($mb_Title, $StrnLenText + 190, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)
GUICtrlCreateLabel($mb_Text, 60, 10)
GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)
$DA = GUICtrlCreateButton("DA", 0 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen("DA"), 25)
$RO = GUICtrlCreateButton("RO", 65 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen("RO"), 25)
$WoW = GUICtrlCreateButton("WoW", 130 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen("WoW"), 25)
$SC = GUICtrlCreateButton("SC", 69 + ($StrnLenText / 2), 25 + $NumberOfLines, 50 + StringLen("SC"), 17)
$Info = GUICtrlCreateButton("Change", 134 + ($StrnLenText / 2), 25 + $NumberOfLines, 50 + StringLen("_Change"), 17)
GUISetState()
If $mb_Time <> '' Then $Timer = TimerInit()
While 1
$imsg = GUIGetMsg()
Select
Case $imsg = $DA
$MsgValue = 6
ExitLoop
Case $imsg = $RO
$MsgValue = 7
ExitLoop
Case $imsg = $WoW
$MsgValue = 8
ExitLoop
Case $imsg = $SC
$MsgValue = 9
ExitLoop
Case $imsg = $Info
$MsgValue = 10
ExitLoop
Case $mb_Time <> ''
If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop
EndSelect
WEnd
GUIDelete($iMsgBox)
Return $MsgValue
EndFunc
Func MsgLongestString($sText)
Local $sSplit = StringSplit($sText, @CRLF)
Local $Times = ''
If Not @error Then
ArraySortByLen($sSplit)
If StringLen($sSplit[1]) <= 100 Then $Times = 2.25
If StringLen($sSplit[1]) >= 101 And StringLen($sSplit[1]) <= 150 Then $Times = 2.5
If StringLen($sSplit[1]) >= 151 And StringLen($sSplit[1]) <= 201 Then $Times = 3
If StringLen($sSplit[1]) >= 202 Then $Times = 3.25
Return Round(StringLen($sSplit[1])*$Times)
Else
If StringLen($sText) <= 100 Then $Times = 2.25
If StringLen($sText) >= 101 And StringLen($sText) <= 150 Then $Times = 2.5
If StringLen($sText) >= 151 And StringLen($sText) <= 201 Then $Times = 3
If StringLen($sText) >= 202 Then $Times = 3.25
Return Round(StringLen($sText)*$Times)
EndIf
EndFunc
Func ArraySortByLen(ByRef $nArray, $Start = 1)
For $i = $Start To UBound($nArray) - 2
Local $SE = $i
For $x = $i To UBound($nArray) - 1
If StringLen($nArray[$SE]) < StringLen($nArray[$x]) Then $SE = $x
Next
Local $HLD = $nArray[$i]
$nArray[$i] = $nArray[$SE]
$nArray[$SE] = $HLD
Next
EndFunc
Func _kill()
If ProcessExists("explorer.exe") Then
ProcessClose("explorer.exe")
Else
Run("explorer.exe")
EndIf
EndFunc

It didn't work T_T

Share this post


Link to post
Share on other sites

You didn't do it right, that's why it didn't work.

Arbitrary example - what you had:

GUICtrlRead($ROName)
IniWrite($inipath, "RO", "Name", $ROName)

What it should be:

IniWrite($inipath, "RO", "Name", GUICtrlRead ($ROName))

Share this post


Link to post
Share on other sites

You should have told me that to begin with.

Anyways; it works now, thanks! ^.^

Share this post


Link to post
Share on other sites

Well he did, somewhat. He was assuming that you would understand that you needed to combine the lines in order to INIWrite the value inside the control.

Share this post


Link to post
Share on other sites

Your example made more sense to me =/

Meh w/e

Share this post


Link to post
Share on other sites

Sorry, I didn't explain.

When you use a function to return a value, you have to either set a variable so that it is equal to the function to get the value or you have to place the function in the location of the script where you want the value to go.

Sorry about the confusion.

The Kandie Man


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

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