Sign in to follow this  
Followers 0
johnmcloud

[SOLVED] Number of lines in a EditBox?

7 posts in this topic

#1 ·  Posted (edited)

Hi guys, i have this script:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 248, 180)
$Edit = GUICtrlCreateEdit("", 8, 8, 233, 121)
$Button = GUICtrlCreateButton("Verify", 8, 136, 233, 33)
GUISetState(@SW_SHOW)

GUICtrlSetData($Edit, "Number of lines (0)" & @CRLF & "Test1" & @CRLF & "Test2")

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button
   $FinalList = StringSplit(GUICtrlRead($Edit), @CR)
   For $i = 2 To $FinalList[0]
    MsgBox(64, "Verify", $FinalList[$i])
   Next
EndSwitch
WEnd

I can't find a way for count the number of lines in a EditBox. I have see:

_FileCountLines()

FileReadLine

But i can't apply directy to a EditBox without write them on a file and then EditBox read it.

How to solve this?

Thanks ;)

Edited by johnmcloud

Share this post


Link to post
Share on other sites



Doesn't $FinalList[0] give you the number of lines? If not try to use

$FinalList = StringSplit(GUICtrlRead($Edit), @CR, 1)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Yes, but there is a problem:

How to write the number of files without losing the data. There is a way to write the first line of a editbox without lose Test1 e Test2?

Share this post


Link to post
Share on other sites

FileWrite("C:temptest.txt", $FinalList[1])?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I don't want to write on a file ;)

if I wanted to write to the file I used _FileCountLines()

The goal is:

1) GUICtrlSetData write the data ( Test1 e Test2 )

2) I'll read the value and check the number of line with $FinalList[0]

3) GUICtrlSetData write the number of files ( $FinalList[0] ) and the data ( Test1 e Test2 ) on the EditBox [That's the problem]

All this at startup of the GUI

Edited by johnmcloud

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

lol, i have the solution by myself:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 248, 180)
$Edit = GUICtrlCreateEdit("", 8, 8, 233, 121)
$Button = GUICtrlCreateButton("Verify", 8, 136, 233, 33)
GUISetState(@SW_SHOW)

$Test = "Test1" & @CRLF & "Test2" & @CRLF & "Test3" & @CRLF & "Test4"
GUICtrlSetData($Edit, $Test)
$FinalList = StringSplit(GUICtrlRead($Edit), @CR, 1)
GUICtrlSetData($Edit, "Number of lines ( " & $FinalList[0] & ")" & @CRLF & $Test)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button
   $FinalList = StringSplit(GUICtrlRead($Edit), @CR)
   For $i = 2 To $FinalList[0]
    MsgBox(64, "Verify", $FinalList[$i])
   Next
EndSwitch
WEnd

Thanks water for support ;)

Edited by johnmcloud

Share this post


Link to post
Share on other sites

What about _GUICtrlEdit_GetLineCount() function?

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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

  • Similar Content

    • hcI
      By hcI
      Hello everyone !
      I'm making a little password generator with save function.
      And i would like to set a line limit at 25.
      For my script, the user have to enter a name in "$input1" and click on the button "$btn_save" to display it in the editbox "$edit1".
      The user can't edit himself because the edit box have $ES_READONLY
      If someone know how, Thanks you !
       
      PS: I've already looked in the help and didn't find anything..
    • olmanRvr
      By olmanRvr
      I want to show or hide a edit control depending if a radio button is checked or not.The following Autoit code appears semantically ok but not working.Can anyone please help?
      thanks
      olmar
      While 1 $nMsg = GUIGetMsg() $isradioChk=GUICtrlRead($radio_AbsP);checked=1,not checked=4 Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $isradioChk If $isradioChk<==1 Then GUICtrlSetState($edit_AbsP,$GUI_SHOW) GUICtrlSetState($edit_RelP,$GUI_HIDE) Else GUICtrlSetState($edit_AbsP,$GUI_HIDE) GUICtrlSetState($edit_RelP,$GUI_SHOW) EndIf Case $usrPrefs EndSwitch WEnd  
    • ssah8
      By ssah8
      So im creating a bot that logs in on a website. The website got a dropdown menu, and I have to choose the right one to login (Student)
      #include <IE.au3>
      #inculude <Inet.au3>
      $oIE = _IECreate("https://sms14.schoolsoft.se/engelska/jsp/Login.jsp?eventMessage=ERR_Not_Logged_In")
      $Name = _IEGetObjByName($oIE, "ssusername")
      $Pass = _IEGetObjByName($oIE, "sspassword")
      $dropdown = _IEGetObjByName($oIE, "usertype")
      _IEPropertySet($Name, 'innerText', 'censored')
      _IEPropertySet($Pass, 'innerText', 'censored')
      _IEPropertySet($dropdown, 'innerText', 'Student') <------ How do I make the dropdown list select "Student"?
       
      Website: https://sms14.schoolsoft.se/engelska/jsp/Login.jsp?eventMessage=ERR_Not_Logged_In
    • Comboku
      By Comboku
      Hi Guys,
       
      quick dumb question that i could not find an answer to.
      I created an EditBox  with the Style $ES_LEFT. I would like to "add" the $WS_EX_TRANSPARENT style so i can use to box without the borders.
      My goal is to have a multi line input that automatically breaks into the next line without the sliders or boarders essentially.
      i have tried:
      $iInput = GUICtrlCreateEdit("Hi", 0, 200, 601, 81, BitOR($ES_LEFT,  $WS_EX_TRANSPARENT)) But it doesn't seem to work. Do you know maybe a style that would fit what i was searching for?
    • Robdog1955
      By Robdog1955
      I am trying to use IE.au3 UDF to auto fill a webpage. All goes well until I get to an editbox that appears to be a javascript. I am attaching a pic of the editbox. (I would be glad to add any other information needed to help me past this last hurdle in my script. I'm just not sure what questions you have to help me with this.)