Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.02 KB | None | 0 0
  1. #include <ButtonConstants.au3>
  2. #include <EditConstants.au3>
  3. #include <GUIConstantsEx.au3>
  4. #include <StaticConstants.au3>
  5. #include <WindowsConstants.au3>
  6. #Region ### START Koda GUI section ### Form=
  7. $Form1 = GUICreate("Form1", 262, 327, 192, 124)
  8. $Input1 = GUICtrlCreateInput("", 96, 72, 121, 21)
  9. $Input2 = GUICtrlCreateInput("", 96, 104, 121, 21)
  10. $Input3 = GUICtrlCreateInput("", 96, 136, 121, 21)
  11. $Label1 = GUICtrlCreateLabel("Channel", 32, 76, 43, 17)
  12. $Label2 = GUICtrlCreateLabel("Nick", 32, 109, 26, 17)
  13. $Label3 = GUICtrlCreateLabel("Authname", 32, 140, 52, 17)
  14. $Button1 = GUICtrlCreateButton("Search", 24, 176, 75, 25, $WS_GROUP)
  15. $Button2 = GUICtrlCreateButton("create", 144, 176, 75, 25, $WS_GROUP)
  16. $Edit1 = GUICtrlCreateEdit("", 16, 208, 201, 89)
  17. GUICtrlSetData(-1, "")
  18. GUISetState(@SW_SHOW)
  19. #EndRegion ### END Koda GUI section ###
  20. Global $job=0
  21. While 1
  22.     $nMsg = GUIGetMsg()
  23.     Switch $nMsg
  24.         Case $GUI_EVENT_CLOSE
  25.             Exit
  26.         Case $button1
  27.             $check= GUICtrlRead($input1)&GUICtrlRead($input2)&GUICtrlRead($Input3)
  28.             If $check = "" Then
  29.                 MsgBox(0,"Error","You have to give at least one information")
  30.             EndIf
  31.             If GUICtrlRead($input1) Then
  32.                 $channel= GUICtrlRead($input1)&".ini"
  33.                 $aini= IniReadSectionNames($channel)
  34.                 $aSection = IniReadSection($channel, 'section')
  35.                 $strForEdit = ''
  36.                 $values = ''
  37.                 For $i=1 to UBound($aini) -1
  38.                     $values = ''
  39.     $strForEdit &= "[" & $aini[$i] & "]" & @CRLF
  40.     $aSection = IniReadSection($channel, $aini[$i])
  41.     For $v = 1 To UBound($aSection) -1
  42.     $values &= $aSection[$v][0] & '=' & $aSection[$v][1] & @CRLF
  43.    
  44.    
  45. Next
  46. $strforedit &= $values & @CRLF
  47. Next
  48.  
  49. GUICtrlSetData($edit1,$strforedit)
  50.    
  51. EndIf
  52. If GUICtrlRead($input2) Then
  53.     If GUICtrlRead($input1) Then   
  54. $channel= GUICtrlRead($input1)&".ini"
  55. $name= GUICtrlRead($input2)
  56. $value= $name & "=" &IniRead($channel,"names",$name,"NO USER FOUND")
  57. GUICtrlSetData($edit1,$value)
  58. Else
  59.     MsgBox(0,"Error","You haven't defined a channel")
  60.    
  61. EndIf
  62. EndIf
  63.  
  64.  
  65. If GUICtrlRead($input3) Then
  66.     If GUICtrlRead($input1) Then   
  67. $channel= GUICtrlRead($input1)&".ini"
  68. $name= GUICtrlRead($input3)
  69. $value= $name & "=" &IniRead($channel,"auths",$name,"NO USER FOUND")
  70. GUICtrlSetData($edit1,$value)
  71. Else
  72.     MsgBox(0,"Error","You haven't defined a channel")
  73.    
  74. EndIf
  75. EndIf
  76.  
  77. case $button2
  78.     $check= GUICtrlRead($input1)&GUICtrlRead($input2)&GUICtrlRead($Input3)
  79.     If $check = '' Then
  80.         MsgBox(0,"Error","there is nothing to create")
  81.     EndIf
  82.     If GUICtrlRead($input1) Then
  83.         If Guictrlread($input2) Then
  84.             if GUICtrlRead($input3) Then
  85.                 $channel= GUICtrlRead($input1) & ".ini"
  86.                 $section= "names"
  87.                 $section2= "auths"
  88.                 $name= GUICtrlRead($input2)
  89.                 $authname= GUICtrlRead($input3)
  90.                 $level= InputBox("Level","please define an user level")
  91.                 IniWrite($channel,$section,$name,$level)
  92.                 IniWrite($channel,$section2,$authname,$level)
  93.                 MsgBox(0,"success","New User:"& $name &"("& $authname &") have been created in "& $channel &" with userlevel:" & $level)
  94.                
  95.             EndIf
  96.         EndIf
  97.     EndIf
  98.                
  99.  
  100.     EndSwitch
  101. WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement