Jump to content

Lisuter

Members
  • Posts

    7
  • Joined

  • Last visited

Lisuter's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hello! Thanks for answer, but i want like that in Edit1: ------------------------- Info: Name is: Michael XYZ, 21 years old, Boston city, Name is: Olex Marshal, 17 years old, Boston city,Name is: Alex XYZ, 19 years old, Boston city, ------------------------- Now i have only the last data from last input, also without "Info:". I want to load all. In txt i have:Michael XYZ, 21, Boston Olex Marshal, 17, Boston Alex XYZ, 19, Boston Now after click Get Data in Edit1 i have: ------------------------------ Name is: Michael XYZ, 21 years old, Boston city ------------------------------- Code: #include <Array.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() Local $sGetData Local $sFilename = @ScriptDir & "\test.txt" Local $aFilename, $x = 10, $y = 10 _FileReadToArray($sFilename, $aFilename, 0, ",") If @error Then Exit MsgBox(4096, "File Read Error", "Unable to read file into an Array") If UBound($aFilename, 2) <= 1 Then Exit MsgBox(4096, "File Read Error", "File cannot be stored in 2d Array") Local $aControl = $aFilename GUICreate("", 330, 10 + (30 * UBound($aFilename) - 1) + 100) $iStart = GUICtrlCreateDummy() For $i = 0 To UBound($aFilename) - 1 For $j = 0 To UBound($aFilename, 2) - 1 $aControl[$i][$j] = GUICtrlCreateInput($aFilename[$i][$j], $x, $y, 100, 20) $x += 105 Next $x = 10 $y += 30 Next Local $idData = GUICtrlCreateButton("Get Data", 220, $y, 100, 30) Local $ed = GUICtrlCreateEdit("", 20, $y+35, 300, 60) ;250 SZEROKOŚĆ GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop Case $idData For $i = 0 To UBound($aControl) - 1 Global $Edit1 = GUICtrlSetData(-1,"Info:"&@CRLF) Global $Edit1 = GUICtrlSetData(-1,'Name is: '&GUICtrlRead($aControl[$i][0])&', '&GUICtrlRead($aControl[$i][1])&' years old, '&GUICtrlRead($aControl[$i][2])&' city') Next EndSwitch WEnd EndFunc Please help.
  2. Thanks. Its really good working for me, but i dont know how to make print its all in Edit1: Excample: After click GetData all data from input put to Edit1 in one line: Edit1: Name is: Michael XYZ, 21 years old, Boston city, Name is: Olex Marshal, 17 years old, Boston city,Name is: Alex XYZ, 19 years old, Boston city,
  3. Okay i try some and now working with first line from txt and load it to Input1, Input2, Input3 correctly. Now, how to loop all, each line from txt to each input? My working code for each:     FileOpen("Test.txt",0)             MsgBox(0,"Test", FileReadLine("Test.txt",1))             $aas = FileReadLine("Test.txt",1)             $aSplitLine = StringSplit($aas,",")             GUICtrlSetData($Input1, $aSplitLine[1])             GUICtrlSetData($Input2, $aSplitLine[2])             GUICtrlSetData($Input3, $aSplitLine[3])             FileClose("Test.txt")
  4. Hello... How i can write data from txt to +3 Input? Example: In txt i have: Michael XYZ, 21, Boston Olex Marshal, 17, Boston Alex XYZ, 19, Boston And now i want load that data to input in autoit. Name y.o city [ Input1] [Input2] [Input3] [ Input4] [Input5] [Input6] [ Input7] [Input8] [Input9] After load should be: Name y.o city [Michael XYZ] [21] [Boston] [ Olex Marshal] [17] [Boston] [ Alex XYZ] [19] [Boston] FileOpen("Test.txt",0)                          $aas = GUICtrlSetData($Input1, FileReadLine("Test.txt",1))             FileClose("Test.txt") But its wrong. ofcourse its load all to input 1. So now how do you load this data directly into each input separately? The comma stop sign is here. Each line is a new person
  5. Hello. I have problem with my work... #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124) Global $Input1 = GUICtrlCreateInput("", 8, 8, 121, 21) $Button1 = GUICtrlCreateButton("Button1", 280, 32, 75, 25) $Edit1 = GUICtrlCreateEdit("", 8, 88, 345, 145) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 editb() EndSwitch WEnd Func blanktoplus($aa) StringReplace(GuiCtrlRead($aa), " ", "+") Global $iReplacements = @extended EndFunc Func editb() Global $Edit1 = GUICtrlSetData(-1,"The full name is:" & blanktoplus($Input1)) EndFunc On my form i have: 1x Input, 1x Button, 1x Edit In input1 i have: Sara Oconnor. I want after click button to set message in edit1 like this: The full name is: Sara+Oconnor Now i have: The full name is: 0 Where is the problem? Thanks!
  6. Hello. I write a small script to help me at work. What i Want? 1. User choose Text from ComboBox 2. Load correct string from txt () 3. Show messagebox with full string from txt Here is my code. 1. Code to open txt file - working fine when 1,2,-1 is static $file = FileOpen("txttest.txt", 0) ; open txt $txt = FileReadLine($file, 1) ; read line 1 $txt1 = stringreplace($txt,'\n',@LF) ; replace \n to next line MsgBox(0,'test',$txt1) ; msgbox for test output And here is code to make GUI with combobox, Test, Testaaa and exit button. Func Example() ; GUI Local $hGUI = GUICreate("Test App", 300, 200) ; COMBOBOX Local $idComboBox = GUICtrlCreateCombo("Choose", 10, 10, 185, 20) Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) ; Options GUICtrlSetData($idComboBox, "Test|Testaaa", "...") ; SHOW GUI GUISetState(@SW_SHOW, $hGUI) Local $sComboRead = "" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idComboBox $sComboRead = GUICtrlRead($idComboBox) MsgBox($MB_SYSTEMMODAL, "", "Your answer is: " & $sComboRead, 0, $hGUI) EndSwitch WEnd GUIDelete($hGUI) EndFunc In txt i have strings: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \n aaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb \n bbbbbbbbbbbbbbbbbbbbbbb What i want? When user choose: Test or Testaaa, in messagebox i want to display correct string from txt file - When user choose Test i want display : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \n aaaaaaaaaaaaaaaaaaaaaaaaaa - When user choose Testaaa i want display: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb \n bbbbbbbbbbbbbbbbbbbbbbb In messagebox. Ty for help
×
×
  • Create New...